From 58901ef83e2b532b8cfb1d2c4b19313d710f5583 Mon Sep 17 00:00:00 2001 From: vasilito Date: Thu, 18 Jun 2026 16:47:56 +0300 Subject: [PATCH] fix(redox-driver-sys): restore 'use syscall as redox_syscall' alias The redox_syscall crate (0.7.x and 0.8.x) has [lib].name = 'syscall', so the crate is exposed as 'syscall' in source code, not 'redox_syscall'. Without the alias, all 'use redox_syscall::...' imports fail to resolve. Also fixed: - lib.rs:46,86 'redox_syscall::error::Error' (now resolves via alias) - io.rs:23 'Result<()>' -> 'Result<(), crate::DriverError>' (Result needs 2 generics) - Cargo.toml: pin redox_syscall to 0.7 to match the rest of base fork This restores redox-driver-sys compilation against base fork 0.2.3 reset to redbear-working. --- local/recipes/drivers/redox-driver-sys/source/src/dma.rs | 2 +- local/recipes/drivers/redox-driver-sys/source/src/io.rs | 9 +++++++-- local/recipes/drivers/redox-driver-sys/source/src/lib.rs | 3 ++- .../drivers/redox-driver-sys/source/src/memory.rs | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/local/recipes/drivers/redox-driver-sys/source/src/dma.rs b/local/recipes/drivers/redox-driver-sys/source/src/dma.rs index dbb237b6ca..ac67215087 100644 --- a/local/recipes/drivers/redox-driver-sys/source/src/dma.rs +++ b/local/recipes/drivers/redox-driver-sys/source/src/dma.rs @@ -2,9 +2,9 @@ use core::ptr::NonNull; use std::sync::atomic::{AtomicI32, Ordering}; use redox_syscall::data::Map; +use syscall as redox_syscall; use redox_syscall::flag::{MapFlags, MAP_PRIVATE, O_CLOEXEC, PROT_READ, PROT_WRITE}; use redox_syscall::PAGE_SIZE; -use syscall as redox_syscall; use crate::{DriverError, Result}; diff --git a/local/recipes/drivers/redox-driver-sys/source/src/io.rs b/local/recipes/drivers/redox-driver-sys/source/src/io.rs index 9160b3f037..edc5be1c60 100644 --- a/local/recipes/drivers/redox-driver-sys/source/src/io.rs +++ b/local/recipes/drivers/redox-driver-sys/source/src/io.rs @@ -1,5 +1,5 @@ #[cfg(all(target_arch = "x86_64", target_os = "redox"))] -use syscall as redox_syscall; + use crate::Result; @@ -20,7 +20,7 @@ pub fn acquire_iopl() -> Result<()> { } #[cfg(all(target_arch = "x86_64", not(target_os = "redox")))] -pub fn acquire_iopl() -> Result<()> { +pub fn acquire_iopl() -> Result<(), crate::DriverError> { Err(crate::DriverError::Other(String::from( "acquire_iopl: only available on Redox", ))) @@ -67,3 +67,8 @@ pub fn inw(port: u16) -> u16 { pub fn outw(port: u16, val: u16) { unsafe { core::arch::asm!("outw {1:x}, {0:x}", in(reg) val, in(reg) port) }; } + +#[cfg(all(target_arch = "x86_64", target_os = "redox"))] + + +use crate::Result; diff --git a/local/recipes/drivers/redox-driver-sys/source/src/lib.rs b/local/recipes/drivers/redox-driver-sys/source/src/lib.rs index eaebeef46d..583accd7f4 100644 --- a/local/recipes/drivers/redox-driver-sys/source/src/lib.rs +++ b/local/recipes/drivers/redox-driver-sys/source/src/lib.rs @@ -35,9 +35,10 @@ pub mod pci; pub mod pcid_client; pub mod quirks; -use syscall as redox_syscall; use thiserror::Error; +use syscall as redox_syscall; + #[derive(Debug, Error)] pub enum DriverError { #[error("I/O error: {0}")] diff --git a/local/recipes/drivers/redox-driver-sys/source/src/memory.rs b/local/recipes/drivers/redox-driver-sys/source/src/memory.rs index 6292649a8e..48daf5736e 100644 --- a/local/recipes/drivers/redox-driver-sys/source/src/memory.rs +++ b/local/recipes/drivers/redox-driver-sys/source/src/memory.rs @@ -2,11 +2,11 @@ use core::ptr; use core::sync::atomic::{AtomicPtr, Ordering}; use redox_syscall::data::Map; +use syscall as redox_syscall; use redox_syscall::flag::{ MAP_SHARED, O_CLOEXEC, O_RDONLY, O_RDWR, O_WRONLY, PROT_READ, PROT_WRITE, }; use redox_syscall::PAGE_SIZE; -use syscall as redox_syscall; use crate::{DriverError, Result};