diff --git a/src/fd/mod.rs b/src/fd/mod.rs index e2a4eff..f983188 100644 --- a/src/fd/mod.rs +++ b/src/fd/mod.rs @@ -6,7 +6,7 @@ use async_trait::async_trait; use core::cell::RefCell; use lazy_static::lazy_static; -pub type FDt = Arc>; +pub type FDt = Arc>; lazy_static! { pub static ref FD_TABLE: AsyncMutex = { diff --git a/src/fs/iso/fd.rs b/src/fs/iso/fd.rs index 95b8e04..ee9954a 100644 --- a/src/fs/iso/fd.rs +++ b/src/fs/iso/fd.rs @@ -12,7 +12,7 @@ pub struct IsoFD { impl IsoFD { pub fn new() -> FDt { - Arc::new(AsyncMutex::new(IsoFD { + Arc::new(RefCell::new(IsoFD { fd: FDId::new(), })) } diff --git a/src/fs/iso/mod.rs b/src/fs/iso/mod.rs index 81297b3..610c5a7 100644 --- a/src/fs/iso/mod.rs +++ b/src/fs/iso/mod.rs @@ -13,12 +13,12 @@ use fd::IsoFD; use alloc::{sync::Arc, boxed::Box}; use async_trait::async_trait; -struct IsoFS { +pub struct IsoFS { } -#[async_trait] +#[async_trait(?Send)] impl FileSystem for IsoFS { - async fn open(&mut self, path: &str, flags: u32) -> Option { + async fn open(path: &str, flags: u32) -> Option { if flags != crate::syscalls::io::O_RDONLY { return None; } diff --git a/src/fs/mod.rs b/src/fs/mod.rs index 76d187f..7631314 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -5,7 +5,7 @@ use crate::fd::FDt; use alloc::{sync::Arc, boxed::Box}; use async_trait::async_trait; -#[async_trait] +#[async_trait(?Send)] pub trait FileSystem { - async fn open(&mut self, path: &str, flags: u32) -> Option; + async fn open(path: &str, flags: u32) -> Option; } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 55bb752..240a2ec 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,7 @@ use core::panic::PanicInfo; use drivers::vga::{self, Color, ColorCode}; use multiboot2::BootInformation; use task::{executor::Executor, keyboard, Task}; +use crate::fs::FileSystem; #[alloc_error_handler] fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! { @@ -65,6 +66,6 @@ pub extern "C" fn julios_main(multiboot_info_addr: usize) -> ! { async fn get_file() { - let fd = fs::iso::open("test", syscalls::io::O_RDONLY).await.unwrap(); + let fd = fs::iso::IsoFS::open("test", syscalls::io::O_RDONLY).await.unwrap(); fd.borrow_mut().read(&[], 0).await; } \ No newline at end of file