SimpleFs

Struct SimpleFs 

Source
pub struct SimpleFs {
    device: Option<Arc<dyn BlockDriver>>,
    root: Arc<SimpleFsInode>,
}
Expand description

简单的内存文件系统(用于测试)

Fields§

§device: Option<Arc<dyn BlockDriver>>§root: Arc<SimpleFsInode>

Implementations§

Source§

impl SimpleFs

Source

pub fn new() -> Arc<Self>

创建新的简单文件系统

Source§

impl SimpleFs

Source

pub fn from_ramdisk(device: Arc<dyn BlockDriver>) -> Result<Self, FsError>

从块设备和镜像创建 SimpleFS

Source

fn parse_file_entry( device: Arc<dyn BlockDriver>, offset: usize, parent: Arc<SimpleFsInode>, ) -> Result<usize, FsError>

解析镜像中的单个文件条目并添加到父目录

Source

fn read_at_offset( device: Arc<dyn BlockDriver>, offset: usize, buf: &mut [u8], ) -> Result<(), FsError>

从设备的任意偏移位置读取数据(支持跨块读取)

Source

fn insert_inode_by_path( path: &str, inode: Arc<SimpleFsInode>, root: Arc<SimpleFsInode>, ) -> Result<(), FsError>

按路径插入 inode,自动创建不存在的中间目录

Trait Implementations§

Source§

impl FileSystem for SimpleFs

Source§

fn fs_type(&self) -> &'static str

文件系统类型名称 Read more
Source§

fn root_inode(&self) -> Arc<dyn Inode>

获取根 inode Read more
Source§

fn sync(&self) -> Result<(), FsError>

同步文件系统 Read more
Source§

fn statfs(&self) -> Result<StatFs, FsError>

获取文件系统统计信息
Source§

fn umount(&self) -> Result<(), FsError>

卸载文件系统(可选) Read more

Auto Trait Implementations§

§

impl Freeze for SimpleFs

§

impl !RefUnwindSafe for SimpleFs

§

impl Send for SimpleFs

§

impl Sync for SimpleFs

§

impl Unpin for SimpleFs

§

impl !UnwindSafe for SimpleFs

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.