diff --git a/Cargo.toml b/Cargo.toml index a64eedfb..60a8cf5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,6 @@ authentication = { workspace = true, optional = true } log = { workspace = true, optional = true } shared = { workspace = true, optional = true } synchronization = { workspace = true, optional = true } -futures = { workspace = true, optional = true } host_bindings = { workspace = true, optional = true } bootsplash = { workspace = true, optional = true } @@ -54,7 +53,6 @@ host = [ "dep:abi_declarations", "dep:abi_definitions", "dep:little_fs", - "dep:futures", "dep:virtual_file_system", "dep:graphics", "dep:task", @@ -100,7 +98,6 @@ host_bindings = { path = "modules/bindings/host" } bindings_utilities = { path = "modules/bindings/utilities" } authentication = { path = "modules/authentication" } log = { path = "modules/log" } -futures = { path = "modules/futures" } shared = { path = "modules/shared" } synchronization = { path = "modules/synchronization" } target = { path = "modules/target" } @@ -183,7 +180,6 @@ members = [ "modules/network", "modules/synchronization", "modules/task/task_macros", - "modules/futures", "modules/log", "examples/native", "executables/calculator", diff --git a/drivers/native/Cargo.toml b/drivers/native/Cargo.toml index 5763759a..2203cc7b 100644 --- a/drivers/native/Cargo.toml +++ b/drivers/native/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dependencies] file_system = { workspace = true } -futures = { workspace = true } + graphics = { workspace = true, features = ["rendering_xrgb8888"] } task = { workspace = true } log = { workspace = true } diff --git a/drivers/native/src/devices/window_screen/screen.rs b/drivers/native/src/devices/window_screen/screen.rs index dc0be1bf..891979b4 100644 --- a/drivers/native/src/devices/window_screen/screen.rs +++ b/drivers/native/src/devices/window_screen/screen.rs @@ -25,7 +25,7 @@ impl<'a> DirectBaseOperations for ScreenDevice<'a> { let data: &[RenderingColor] = align_slice_to(buffer).ok_or(file_system::Error::InvalidParameter)?; - futures::block_on(self.0.draw(data)).unwrap(); + task::block_on(self.0.draw(data)).unwrap(); Ok(size_of::() as _) } @@ -41,21 +41,21 @@ impl<'a> DirectBaseOperations for ScreenDevice<'a> { .cast() .ok_or(file_system::Error::InvalidParameter)?; - futures::block_on(self.0.set_drawing_area(*area)).unwrap(); + task::block_on(self.0.set_drawing_area(*area)).unwrap(); } GET_RESOLUTION => { let resolution: &mut graphics::Point = argument .cast() .ok_or(file_system::Error::InvalidParameter)?; - *resolution = futures::block_on(self.0.get_resolution()).unwrap(); + *resolution = task::block_on(self.0.get_resolution()).unwrap(); } WAS_RESIZED => { let was_resized: &mut bool = argument .cast() .ok_or(file_system::Error::InvalidParameter)?; - *was_resized = futures::block_on(self.0.was_resized()).unwrap(); + *was_resized = task::block_on(self.0.was_resized()).unwrap(); } _ => return Err(file_system::Error::UnsupportedOperation), } diff --git a/drivers/native/src/devices/window_screen/window.rs b/drivers/native/src/devices/window_screen/window.rs index 37ac82ed..97fbcf37 100644 --- a/drivers/native/src/devices/window_screen/window.rs +++ b/drivers/native/src/devices/window_screen/window.rs @@ -96,20 +96,20 @@ impl<'a> ApplicationHandler for Window<'a> { .unwrap() }; - futures::block_on(self.inner_window.replace(window, pixels)); + task::block_on(self.inner_window.replace(window, pixels)); } fn window_event(&mut self, _: &ActiveEventLoop, _: WindowId, event: WindowEvent) { match event { WindowEvent::RedrawRequested => { - futures::block_on(self.inner_window.render()).unwrap(); + task::block_on(self.inner_window.render()).unwrap(); } WindowEvent::Resized(size) => { let new_resolution = Point::new(size.width as i16, size.height as i16); self.resolution = new_resolution; - futures::block_on(self.inner_window.resize(new_resolution)).unwrap(); + task::block_on(self.inner_window.resize(new_resolution)).unwrap(); } WindowEvent::KeyboardInput { device_id: _, diff --git a/drivers/wasm/Cargo.toml b/drivers/wasm/Cargo.toml index c62ef436..de5b2b4b 100644 --- a/drivers/wasm/Cargo.toml +++ b/drivers/wasm/Cargo.toml @@ -8,7 +8,7 @@ file_system = { workspace = true } memory = { workspace = true } graphics = { workspace = true, features = ["rendering_xrgb8888"] } critical-section = { workspace = true, features = ["std"] } -futures = { workspace = true } +task = { workspace = true } synchronization = { workspace = true } log = { workspace = true } shared = { workspace = true } diff --git a/drivers/wasm/src/devices/drive.rs b/drivers/wasm/src/devices/drive.rs index 679b7fd0..25721bd2 100644 --- a/drivers/wasm/src/devices/drive.rs +++ b/drivers/wasm/src/devices/drive.rs @@ -1,7 +1,7 @@ use alloc::string::{String, ToString}; use file_system::{DirectBaseOperations, Path, Size}; -use futures::block_on; use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock}; +use task::block_on; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; use web_sys::*; diff --git a/drivers/wasm/src/devices/graphics/canvas_screen.rs b/drivers/wasm/src/devices/graphics/canvas_screen.rs index 1db8dc55..96d577b0 100644 --- a/drivers/wasm/src/devices/graphics/canvas_screen.rs +++ b/drivers/wasm/src/devices/graphics/canvas_screen.rs @@ -2,10 +2,10 @@ use core::slice; use alloc::{boxed::Box, rc::Rc, string::String, vec::Vec}; use file_system::{DirectBaseOperations, DirectCharacterDevice, MountOperations, Size}; -use futures::block_on; use graphics::{Area, GET_RESOLUTION, Point, RenderingColor, SET_DRAWING_AREA, WAS_RESIZED}; use shared::align_slice_to; use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock}; +use task::block_on; use wasm_bindgen::{Clamped, JsCast, JsValue, prelude::Closure}; use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement, ImageData}; diff --git a/drivers/wasm/src/devices/graphics/mouse.rs b/drivers/wasm/src/devices/graphics/mouse.rs index 7c29bc56..e113db57 100644 --- a/drivers/wasm/src/devices/graphics/mouse.rs +++ b/drivers/wasm/src/devices/graphics/mouse.rs @@ -1,8 +1,8 @@ use alloc::{boxed::Box, string::String, sync::Arc}; use file_system::{DirectBaseOperations, DirectCharacterDevice, MountOperations, Size}; -use futures::block_on; use graphics::{InputData, Point, State}; use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock}; +use task::block_on; use wasm_bindgen::{JsCast, prelude::Closure}; use web_sys::{HtmlCanvasElement, MouseEvent, TouchEvent}; diff --git a/executables/shell/graphical/src/layout.rs b/executables/shell/graphical/src/layout.rs index 41f7ffa8..da5732c7 100644 --- a/executables/shell/graphical/src/layout.rs +++ b/executables/shell/graphical/src/layout.rs @@ -5,7 +5,7 @@ use xila::graphics::{self, EventKind, lvgl, theme}; use xila::shared::unix_to_human_time; use xila::time; -const KEYBOARD_SIZE_RATIO: f64 = 4.0 / 1.0; +const KEYBOARD_SIZE_RATIO: f64 = 3.0 / 1.0; pub struct Layout { window: *mut lvgl::lv_obj_t, diff --git a/modules/abi/context/Cargo.toml b/modules/abi/context/Cargo.toml index 9287e1fa..f01beeff 100644 --- a/modules/abi/context/Cargo.toml +++ b/modules/abi/context/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] task = { workspace = true } -futures = { workspace = true } + synchronization = { workspace = true } file_system = { workspace = true } log = { workspace = true } diff --git a/modules/abi/context/src/lib.rs b/modules/abi/context/src/lib.rs index 310e90bd..e64e63df 100644 --- a/modules/abi/context/src/lib.rs +++ b/modules/abi/context/src/lib.rs @@ -9,10 +9,10 @@ pub use file::*; use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; use file_system::{Path, PathOwned}; -use futures::block_on; use smol_str::SmolStr; use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock}; use task::TaskIdentifier; +use task::block_on; use unique_file::UniqueFileIdentifier; use virtual_file_system::{SynchronousDirectory, SynchronousFile}; diff --git a/modules/abi/definitions/Cargo.toml b/modules/abi/definitions/Cargo.toml index dec58526..32fe6ec5 100644 --- a/modules/abi/definitions/Cargo.toml +++ b/modules/abi/definitions/Cargo.toml @@ -11,7 +11,7 @@ time = { workspace = true } memory = { workspace = true } network = { workspace = true } synchronization = { workspace = true } -futures = { workspace = true } + log = { workspace = true } abi_context = { workspace = true } diff --git a/modules/abi/definitions/src/file_system/functions.rs b/modules/abi/definitions/src/file_system/functions.rs index 0bd54e2d..0b6d16fd 100644 --- a/modules/abi/definitions/src/file_system/functions.rs +++ b/modules/abi/definitions/src/file_system/functions.rs @@ -6,7 +6,7 @@ use core::{ ptr::copy_nonoverlapping, }; use file_system::{AccessFlags, CreateFlags, Flags, StateFlags, character_device}; -use futures::block_on; +use task::block_on; use virtual_file_system::{ Error, SynchronousDirectory, SynchronousFile, get_instance as get_file_system_instance, }; diff --git a/modules/abi/definitions/src/file_system/socket.rs b/modules/abi/definitions/src/file_system/socket.rs index e91474a1..0f434bd0 100644 --- a/modules/abi/definitions/src/file_system/socket.rs +++ b/modules/abi/definitions/src/file_system/socket.rs @@ -1,5 +1,5 @@ use super::{XilaFileIdentifier, XilaFileSystemResult, into_u32}; -use futures::block_on; +use task::block_on; use task::get_instance as get_task_manager_instance; use virtual_file_system::Error; diff --git a/modules/abi/definitions/src/memory/allocation.rs b/modules/abi/definitions/src/memory/allocation.rs index 1d6d7346..3487bc94 100644 --- a/modules/abi/definitions/src/memory/allocation.rs +++ b/modules/abi/definitions/src/memory/allocation.rs @@ -34,11 +34,11 @@ use core::ptr::null_mut; use core::{ffi::c_void, ptr::NonNull}; -use futures::block_on; use log::warning; use memory::CapabilityFlags; use synchronization::blocking_mutex::raw::CriticalSectionRawMutex; use synchronization::mutex::Mutex; +use task::block_on; use crate::Allocated; diff --git a/modules/abi/definitions/src/task/thread.rs b/modules/abi/definitions/src/task/thread.rs index bd7cd325..5e10fbf3 100644 --- a/modules/abi/definitions/src/task/thread.rs +++ b/modules/abi/definitions/src/task/thread.rs @@ -2,8 +2,8 @@ use core::ffi::c_int; use core::ptr::null_mut; use core::{ffi::c_void, time::Duration}; -use futures::block_on; use task::Manager; +use task::block_on; use abi_context as context; diff --git a/modules/bindings/host/Cargo.toml b/modules/bindings/host/Cargo.toml index 3578da1e..a60cd900 100644 --- a/modules/bindings/host/Cargo.toml +++ b/modules/bindings/host/Cargo.toml @@ -13,7 +13,7 @@ task = { workspace = true } graphics = { workspace = true } time = { workspace = true } include_bytes_aligned = "0.1" -futures = { workspace = true } + log = { workspace = true } #wit-bindgen = "0.34.0" diff --git a/modules/bindings/host/src/graphics.rs b/modules/bindings/host/src/graphics.rs index 5a564555..3d3f7ef6 100644 --- a/modules/bindings/host/src/graphics.rs +++ b/modules/bindings/host/src/graphics.rs @@ -4,8 +4,8 @@ use std::{ os::raw::c_void, }; -use futures::block_on; pub use graphics::lvgl; +use task::block_on; use task::TaskIdentifier; use virtual_machine::{ diff --git a/modules/bindings/utilities/src/additional.rs b/modules/bindings/utilities/src/additional.rs index 771a2f4d..9012d030 100644 --- a/modules/bindings/utilities/src/additional.rs +++ b/modules/bindings/utilities/src/additional.rs @@ -13,7 +13,7 @@ pub fn get() -> TokenStream { } pub unsafe fn window_create() -> *mut lv_obj_t { - futures::block_on( + task::block_on( graphics::get_instance().create_window() ).unwrap().into_raw() } diff --git a/modules/bootsplash/Cargo.toml b/modules/bootsplash/Cargo.toml index 8de09473..a50a0955 100644 --- a/modules/bootsplash/Cargo.toml +++ b/modules/bootsplash/Cargo.toml @@ -4,5 +4,5 @@ version = "0.1.0" edition = "2024" [dependencies] -futures = { workspace = true } + graphics = { workspace = true } diff --git a/modules/executable/Cargo.toml b/modules/executable/Cargo.toml index 6f9c5908..28726c03 100644 --- a/modules/executable/Cargo.toml +++ b/modules/executable/Cargo.toml @@ -8,7 +8,7 @@ file_system = { workspace = true } virtual_file_system = { workspace = true } task = { workspace = true } users = { workspace = true } -futures = { workspace = true } + log = { workspace = true } [dev-dependencies] diff --git a/modules/executable/src/lib.rs b/modules/executable/src/lib.rs index 59130152..7bafb073 100644 --- a/modules/executable/src/lib.rs +++ b/modules/executable/src/lib.rs @@ -14,7 +14,6 @@ pub use arguments_parser::*; pub use building::*; pub use error::*; pub use file_system as exported_file_system; -pub use futures as exported_futures; pub use standard::*; pub use task as exported_task; pub use traits::*; diff --git a/modules/file_system/Cargo.toml b/modules/file_system/Cargo.toml index ca260e16..d00e5c4e 100644 --- a/modules/file_system/Cargo.toml +++ b/modules/file_system/Cargo.toml @@ -8,7 +8,7 @@ task = { workspace = true } users = { workspace = true } shared = { workspace = true } synchronization = { workspace = true } -futures = { workspace = true } + embedded-io-async = { workspace = true } [dev-dependencies] diff --git a/modules/futures/Cargo.toml b/modules/futures/Cargo.toml deleted file mode 100644 index 20427d62..00000000 --- a/modules/futures/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "futures" -version = "0.1.0" -edition = "2024" - -[dependencies] -embassy-futures = { workspace = true } diff --git a/modules/futures/src/lib.rs b/modules/futures/src/lib.rs deleted file mode 100644 index 489a4312..00000000 --- a/modules/futures/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -pub use embassy_futures::*; diff --git a/modules/graphics/Cargo.toml b/modules/graphics/Cargo.toml index 2f97f54b..eb4cfdf1 100644 --- a/modules/graphics/Cargo.toml +++ b/modules/graphics/Cargo.toml @@ -16,7 +16,8 @@ synchronization = { workspace = true } log = { workspace = true } abi_declarations = { workspace = true } internationalization = { workspace = true } -futures = { workspace = true } + +task = { workspace = true } [dev-dependencies] drivers_native = { workspace = true } @@ -25,7 +26,7 @@ drivers_shared = { workspace = true } drivers_std = { workspace = true } users = { workspace = true } task = { workspace = true } -futures = { workspace = true } + abi_definitions = { workspace = true } [features] diff --git a/modules/graphics/src/manager.rs b/modules/graphics/src/manager.rs index d7b79232..e1c7e8e4 100644 --- a/modules/graphics/src/manager.rs +++ b/modules/graphics/src/manager.rs @@ -4,10 +4,10 @@ use alloc::{ vec::Vec, }; use file_system::DirectCharacterDevice; -use futures::block_on; use synchronization::blocking_mutex::raw::CriticalSectionRawMutex; use synchronization::mutex::{Mutex, MutexGuard}; use synchronization::{once_lock::OnceLock, rwlock::RwLock}; +use task::block_on; use core::{future::Future, mem::forget}; diff --git a/modules/little_fs/Cargo.toml b/modules/little_fs/Cargo.toml index de726040..9543b2a8 100644 --- a/modules/little_fs/Cargo.toml +++ b/modules/little_fs/Cargo.toml @@ -14,7 +14,7 @@ users = { workspace = true } time = { workspace = true } littlefs2-sys = { version = "0.3.1", features = ["malloc"] } synchronization = { workspace = true } -futures = { workspace = true } + log = { workspace = true } abi_declarations = { workspace = true } @@ -23,5 +23,5 @@ drivers_native = { workspace = true } drivers_core = { workspace = true } drivers_shared = { workspace = true } drivers_std = { workspace = true } -futures = { workspace = true } + abi_definitions = { workspace = true } diff --git a/modules/log/src/lib.rs b/modules/log/src/lib.rs index a08dd4c2..42a731fe 100644 --- a/modules/log/src/lib.rs +++ b/modules/log/src/lib.rs @@ -102,9 +102,16 @@ impl Log for Logger { static LOGGER_INSTANCE: OnceLock = OnceLock::new(); pub fn initialize(logger: &'static dyn LoggerTrait) -> Result<(), log_external::SetLoggerError> { - let logger = LOGGER_INSTANCE.get_or_init(|| Logger(logger)); + let log = LOGGER_INSTANCE.get_or_init(|| Logger(logger)); + + if set_logger(log).is_err() { + logger.log(&Record { + level: Level::Error, + target: "log", + arguments: format_args!("Logger has already been initialized."), + }); + } - set_logger(logger).expect("Failed to set logger"); set_max_level(log_external::LevelFilter::Trace); Ok(()) } diff --git a/modules/network/Cargo.toml b/modules/network/Cargo.toml index 0d71c930..39b2301a 100644 --- a/modules/network/Cargo.toml +++ b/modules/network/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] file_system = { workspace = true } -futures = { workspace = true } + synchronization = { workspace = true } time = { workspace = true } embassy-net = { workspace = true, features = [ diff --git a/modules/task/Cargo.toml b/modules/task/Cargo.toml index e41173d9..53561e50 100644 --- a/modules/task/Cargo.toml +++ b/modules/task/Cargo.toml @@ -10,7 +10,7 @@ embassy-executor = { workspace = true, default-features = false } embassy-futures = { workspace = true } smol_str = { version = "0.3" } synchronization = { workspace = true } -futures = { workspace = true } + [target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dependencies] embassy-time = { workspace = true, features = ["std"] } diff --git a/modules/task/src/lib.rs b/modules/task/src/lib.rs index d0e46c9d..affa8acd 100644 --- a/modules/task/src/lib.rs +++ b/modules/task/src/lib.rs @@ -18,8 +18,6 @@ use embassy_time::Timer; pub use embassy_executor; pub use environment_variable::*; pub use error::*; -pub use futures; -pub use futures::yield_now; pub use join_handle::*; pub use manager::*; pub use signal::*; @@ -32,3 +30,14 @@ pub async fn sleep(duration: Duration) { Timer::after(embassy_time::Duration::from_nanos(nano_seconds as u64)).await } + +#[cfg(target_arch = "wasm32")] +pub async fn yield_now() { + sleep(Duration::from_millis(10)).await +} +#[cfg(not(target_arch = "wasm32"))] +pub use embassy_futures::yield_now; + +pub fn block_on(future: F) -> F::Output { + embassy_futures::block_on(future) +} diff --git a/modules/task/src/manager/tests.rs b/modules/task/src/manager/tests.rs index 5b07be45..1b578f65 100644 --- a/modules/task/src/manager/tests.rs +++ b/modules/task/src/manager/tests.rs @@ -5,7 +5,6 @@ use super::*; use crate::test; use alloc::{collections::BTreeMap, format, vec::Vec}; use core::time::Duration; -use futures::yield_now; use users::{GroupIdentifier, UserIdentifier}; #[test(task_path = crate)] diff --git a/modules/task/task_macros/src/lib.rs b/modules/task/task_macros/src/lib.rs index d2a7d24a..3f20d4ae 100644 --- a/modules/task/task_macros/src/lib.rs +++ b/modules/task/task_macros/src/lib.rs @@ -143,7 +143,7 @@ pub fn test(arguments: TokenStream, input: TokenStream) -> TokenStream { __SPAWNER = manager.register_spawner(Spawner).expect("Failed to register spawner"); } - #task_path::futures::block_on(async move { + #task_path::block_on(async move { manager.spawn( #task_path::Manager::ROOT_TASK_IDENTIFIER, #function_name_string, @@ -273,7 +273,7 @@ pub fn run(arguments: TokenStream, input: TokenStream) -> TokenStream { __SPAWNER = manager.register_spawner(Spawner).expect("Failed to register spawner"); } - #task_path::futures::block_on(async move { + #task_path::block_on(async move { manager.spawn( #task_path::Manager::ROOT_TASK_IDENTIFIER, #function_name_string, diff --git a/modules/users/Cargo.toml b/modules/users/Cargo.toml index c9216dbd..f148ec9b 100644 --- a/modules/users/Cargo.toml +++ b/modules/users/Cargo.toml @@ -11,5 +11,5 @@ drivers_native = { workspace = true } drivers_core = { workspace = true } drivers_shared = { workspace = true } drivers_std = { workspace = true } -futures = { workspace = true } + task = { workspace = true } diff --git a/modules/virtual_file_system/Cargo.toml b/modules/virtual_file_system/Cargo.toml index 81d249b9..91e04067 100644 --- a/modules/virtual_file_system/Cargo.toml +++ b/modules/virtual_file_system/Cargo.toml @@ -10,7 +10,7 @@ users = { workspace = true } time = { workspace = true } network = { workspace = true } synchronization = { workspace = true } -futures = { workspace = true } + log = { workspace = true } embedded-io-async = { workspace = true } diff --git a/modules/virtual_file_system/src/directory.rs b/modules/virtual_file_system/src/directory.rs index c08475d4..e6cc18fa 100644 --- a/modules/virtual_file_system/src/directory.rs +++ b/modules/virtual_file_system/src/directory.rs @@ -2,8 +2,8 @@ use core::mem::forget; use exported_file_system::{FileSystemOperations, StateFlags}; use file_system::{Context, Entry, Flags, Path, Size}; -use futures::block_on; use task::TaskIdentifier; +use task::block_on; use crate::{ItemStatic, Result, SynchronousDirectory, VirtualFileSystem, poll}; diff --git a/modules/virtual_file_system/src/file.rs b/modules/virtual_file_system/src/file.rs index f8c3c8bc..f8d3b592 100644 --- a/modules/virtual_file_system/src/file.rs +++ b/modules/virtual_file_system/src/file.rs @@ -5,8 +5,8 @@ use core::mem::forget; use embedded_io_async::ErrorType; use exported_file_system::{AccessFlags, ControlCommand, CreateFlags, Permissions}; use file_system::{Context, Flags, Path, Position, Size, StateFlags, Statistics}; -use futures::block_on; use task::TaskIdentifier; +use task::block_on; use users::{GroupIdentifier, UserIdentifier}; /// File structure. diff --git a/modules/virtual_file_system/src/file_system/mod.rs b/modules/virtual_file_system/src/file_system/mod.rs index 01f66e62..83bad7f8 100644 --- a/modules/virtual_file_system/src/file_system/mod.rs +++ b/modules/virtual_file_system/src/file_system/mod.rs @@ -128,11 +128,8 @@ impl<'a> VirtualFileSystem<'a> { let mut attributes = Attributes::new().set_mask(AttributeFlags::Kind | AttributeFlags::Inode); - FileSystemOperations::get_attributes( - underlying_file_system.file_system, - path, - &mut attributes, - )?; + Self::get_attributes(underlying_file_system.file_system, path, &mut attributes).await?; + let kind = attributes.get_kind().ok_or(Error::MissingAttribute)?; let inode = *attributes.get_inode().ok_or(Error::MissingAttribute)?; @@ -236,7 +233,7 @@ impl<'a> VirtualFileSystem<'a> { | AttributeFlags::Group | AttributeFlags::Permissions, ); - FileSystemOperations::get_attributes(file_system.file_system, path, &mut attributes)?; + Self::get_attributes(file_system.file_system, path, &mut attributes).await?; let kind = attributes.get_kind().ok_or(Error::MissingAttribute)?; if *kind != Kind::Directory { @@ -334,11 +331,7 @@ impl<'a> VirtualFileSystem<'a> { let mut attributes = Attributes::new().set_mask(AttributeFlags::Inode | AttributeFlags::Kind); - FileSystemOperations::get_attributes( - file_system.file_system, - relative_path, - &mut attributes, - )?; + Self::get_attributes(file_system.file_system, path, &mut attributes).await?; let kind = attributes.get_kind().ok_or(Error::MissingAttribute)?; let inode = *attributes.get_inode().ok_or(Error::MissingAttribute)?; diff --git a/modules/virtual_file_system/src/lib.rs b/modules/virtual_file_system/src/lib.rs index d63bf62a..8f784918 100644 --- a/modules/virtual_file_system/src/lib.rs +++ b/modules/virtual_file_system/src/lib.rs @@ -14,8 +14,6 @@ mod socket; mod synchronous_directory; mod synchronous_file; -use core::time::Duration; - pub use directory::*; pub use error::*; use exported_file_system::{Flags, StateFlags}; @@ -34,7 +32,7 @@ pub async fn poll(mut operation: impl FnMut() -> Result) -> Result { match operation() { Err(Error::FileSystem(::file_system::Error::RessourceBusy)) | Err(Error::RessourceBusy) => { - task::sleep(Duration::from_millis(10)).await; + task::yield_now().await; } other => return other, } diff --git a/modules/virtual_file_system/src/pipe.rs b/modules/virtual_file_system/src/pipe.rs index 5790ea30..55d0950e 100644 --- a/modules/virtual_file_system/src/pipe.rs +++ b/modules/virtual_file_system/src/pipe.rs @@ -1,8 +1,8 @@ use alloc::collections::VecDeque; use exported_file_system::{DirectBaseOperations, MountOperations}; -use futures::block_on; use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock}; +use task::block_on; use file_system::{Error, Result, Size}; diff --git a/modules/virtual_file_system/src/synchronous_directory.rs b/modules/virtual_file_system/src/synchronous_directory.rs index a49c168f..6c2d8519 100644 --- a/modules/virtual_file_system/src/synchronous_directory.rs +++ b/modules/virtual_file_system/src/synchronous_directory.rs @@ -3,8 +3,8 @@ use exported_file_system::{ AccessFlags, AttributeFlags, AttributeOperations, Attributes, StateFlags, Statistics, }; use file_system::{Context, DirectoryOperations, Entry, Flags, Path, Size}; -use futures::block_on; use task::TaskIdentifier; +use task::block_on; use crate::{Error, ItemStatic, Result, VirtualFileSystem, blocking_operation}; diff --git a/modules/virtual_file_system/src/synchronous_file.rs b/modules/virtual_file_system/src/synchronous_file.rs index e7fe833a..f7a1ae2a 100644 --- a/modules/virtual_file_system/src/synchronous_file.rs +++ b/modules/virtual_file_system/src/synchronous_file.rs @@ -6,8 +6,8 @@ use exported_file_system::{ControlArgument, ControlCommand, Permissions}; use file_system::{ AccessFlags, AttributeFlags, Attributes, Context, Flags, Path, Position, Size, Statistics, }; -use futures::block_on; use task::TaskIdentifier; +use task::block_on; use users::{GroupIdentifier, UserIdentifier}; pub struct SynchronousFile { diff --git a/modules/virtual_machine/Cargo.toml b/modules/virtual_machine/Cargo.toml index 2daa0696..dd7dfcee 100644 --- a/modules/virtual_machine/Cargo.toml +++ b/modules/virtual_machine/Cargo.toml @@ -26,7 +26,7 @@ drivers_native = { workspace = true } drivers_core = { workspace = true } drivers_shared = { workspace = true } drivers_std = { workspace = true } -futures = { workspace = true } + log = { workspace = true } executable = { workspace = true, features = ["building"] } testing = { workspace = true } diff --git a/src/lib.rs b/src/lib.rs index 9acd0134..85d02715 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,8 +22,6 @@ pub use executable; #[cfg(feature = "host")] pub use file_system; #[cfg(feature = "host")] -pub use futures; -#[cfg(feature = "host")] pub use graphics; #[cfg(feature = "virtual_machine")] pub use host_bindings;