From f77c4d57fce469b5cdee5f7b871ffe3ee4f633ef Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 15 Feb 2024 17:52:24 +0100 Subject: [PATCH] std: move locks to `sys` on xous --- library/std/src/sys/locks/condvar/mod.rs | 3 +++ .../{pal/xous/locks/condvar.rs => locks/condvar/xous.rs} | 2 +- library/std/src/sys/locks/mutex/mod.rs | 5 ++++- .../sys/{pal/xous/locks/mutex.rs => locks/mutex/xous.rs} | 0 library/std/src/sys/locks/rwlock/mod.rs | 3 +++ .../sys/{pal/xous/locks/rwlock.rs => locks/rwlock/xous.rs} | 0 library/std/src/sys/pal/xous/locks/mod.rs | 7 ------- library/std/src/sys/pal/xous/mod.rs | 1 - 8 files changed, 11 insertions(+), 10 deletions(-) rename library/std/src/sys/{pal/xous/locks/condvar.rs => locks/condvar/xous.rs} (99%) rename library/std/src/sys/{pal/xous/locks/mutex.rs => locks/mutex/xous.rs} (100%) rename library/std/src/sys/{pal/xous/locks/rwlock.rs => locks/rwlock/xous.rs} (100%) delete mode 100644 library/std/src/sys/pal/xous/locks/mod.rs diff --git a/library/std/src/sys/locks/condvar/mod.rs b/library/std/src/sys/locks/condvar/mod.rs index 889fcbaaaf1..425b88c1bf0 100644 --- a/library/std/src/sys/locks/condvar/mod.rs +++ b/library/std/src/sys/locks/condvar/mod.rs @@ -26,5 +26,8 @@ cfg_if::cfg_if! { } else if #[cfg(target_os = "teeos")] { mod teeos; pub use teeos::Condvar; + } else if #[cfg(target_os = "xous")] { + mod xous; + pub use xous::Condvar; } } diff --git a/library/std/src/sys/pal/xous/locks/condvar.rs b/library/std/src/sys/locks/condvar/xous.rs similarity index 99% rename from library/std/src/sys/pal/xous/locks/condvar.rs rename to library/std/src/sys/locks/condvar/xous.rs index 510235046e1..0e51449e0af 100644 --- a/library/std/src/sys/pal/xous/locks/condvar.rs +++ b/library/std/src/sys/locks/condvar/xous.rs @@ -1,6 +1,6 @@ -use super::mutex::Mutex; use crate::os::xous::ffi::{blocking_scalar, scalar}; use crate::os::xous::services::{ticktimer_server, TicktimerScalar}; +use crate::sys::locks::Mutex; use crate::time::Duration; use core::sync::atomic::{AtomicUsize, Ordering}; diff --git a/library/std/src/sys/locks/mutex/mod.rs b/library/std/src/sys/locks/mutex/mod.rs index 2c4c2f4ef48..cb229d50e55 100644 --- a/library/std/src/sys/locks/mutex/mod.rs +++ b/library/std/src/sys/locks/mutex/mod.rs @@ -27,6 +27,9 @@ cfg_if::cfg_if! { pub use sgx::Mutex; } else if #[cfg(target_os = "solid_asp3")] { mod itron; - pub use itron::Condvar; + pub use itron::Mutex; + } else if #[cfg(target_os = "xous")] { + mod xous; + pub use xous::Mutex; } } diff --git a/library/std/src/sys/pal/xous/locks/mutex.rs b/library/std/src/sys/locks/mutex/xous.rs similarity index 100% rename from library/std/src/sys/pal/xous/locks/mutex.rs rename to library/std/src/sys/locks/mutex/xous.rs diff --git a/library/std/src/sys/locks/rwlock/mod.rs b/library/std/src/sys/locks/rwlock/mod.rs index 35fff36c25d..9d656e57bb3 100644 --- a/library/std/src/sys/locks/rwlock/mod.rs +++ b/library/std/src/sys/locks/rwlock/mod.rs @@ -26,5 +26,8 @@ cfg_if::cfg_if! { } else if #[cfg(target_os = "teeos")] { mod teeos; pub use teeos::RwLock; + } else if #[cfg(target_os = "xous")] { + mod xous; + pub use xous::RwLock; } } diff --git a/library/std/src/sys/pal/xous/locks/rwlock.rs b/library/std/src/sys/locks/rwlock/xous.rs similarity index 100% rename from library/std/src/sys/pal/xous/locks/rwlock.rs rename to library/std/src/sys/locks/rwlock/xous.rs diff --git a/library/std/src/sys/pal/xous/locks/mod.rs b/library/std/src/sys/pal/xous/locks/mod.rs deleted file mode 100644 index f3c5c5d9fb0..00000000000 --- a/library/std/src/sys/pal/xous/locks/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod condvar; -mod mutex; -mod rwlock; - -pub use condvar::*; -pub use mutex::*; -pub use rwlock::*; diff --git a/library/std/src/sys/pal/xous/mod.rs b/library/std/src/sys/pal/xous/mod.rs index c9bad4ef019..7914a255aea 100644 --- a/library/std/src/sys/pal/xous/mod.rs +++ b/library/std/src/sys/pal/xous/mod.rs @@ -9,7 +9,6 @@ pub mod env; pub mod fs; #[path = "../unsupported/io.rs"] pub mod io; -pub mod locks; pub mod net; pub mod os; #[path = "../unsupported/pipe.rs"]