diff --git a/src/blocked_device.rs b/src/blocked_device.rs index f55ebe1..98e1bf2 100644 --- a/src/blocked_device.rs +++ b/src/blocked_device.rs @@ -2,7 +2,7 @@ use util::*; use vfs::Device; /// Device which can only R/W in blocks -pub trait BlockedDevice { +pub trait BlockedDevice: Send { const BLOCK_SIZE_LOG2: u8; fn read_at(&mut self, block_id: usize, buf: &mut [u8]) -> bool; fn write_at(&mut self, block_id: usize, buf: &[u8]) -> bool; diff --git a/src/vfs.rs b/src/vfs.rs index 85327ca..8dbd6f2 100644 --- a/src/vfs.rs +++ b/src/vfs.rs @@ -4,13 +4,13 @@ use core::any::Any; /// Interface for FS to read & write /// TODO: use std::io::{Read, Write} -pub trait Device { +pub trait Device: Send { fn read_at(&mut self, offset: usize, buf: &mut [u8]) -> Option; fn write_at(&mut self, offset: usize, buf: &[u8]) -> Option; } /// Abstract operations on a inode. -pub trait INode: Debug + Any { +pub trait INode: Debug + Any + Sync + Send { fn open(&self, flags: u32) -> Result<()>; fn close(&self) -> Result<()>; fn read_at(&self, offset: usize, buf: &mut [u8]) -> Result; @@ -101,7 +101,7 @@ pub struct FsInfo { pub type Result = core::result::Result; /// Abstract filesystem -pub trait FileSystem { +pub trait FileSystem: Sync { fn sync(&self) -> Result<()>; fn root_inode(&self) -> Arc; fn info(&self) -> &'static FsInfo;