Skip to main content

FileSystemManager

Struct FileSystemManager 

Source
pub struct FileSystemManager {
    pub root: Arc<Mutex<RamInode>>,
    pub ramfs: Arc<RamFS>,
    pub mounts: Vec<MountPoint>,
}
Expand description

文件系统管理器

管理全局文件系统实例和挂载表

Fields§

§root: Arc<Mutex<RamInode>>

根目录 (RamFS)

§ramfs: Arc<RamFS>

RamFS实例

§mounts: Vec<MountPoint>

挂载表

Implementations§

Source§

impl FileSystemManager

Source

pub fn new(ramfs: Arc<RamFS>) -> Self

创建新的文件系统管理器

Source

pub fn root(&self) -> Arc<Mutex<RamInode>> ⓘ

获取根目录

Source

pub fn ramfs(&self) -> Arc<RamFS> ⓘ

获取RamFS实例

Source

pub fn mount_blkfs( &mut self, path: &str, dev: BlockDeviceHandle, ) -> Result<(), &'static str>

挂载一个块设备文件系统(兼容旧接口)

§参数
  • path: 挂载路径(在RamFS中创建目录作为挂载点)
  • dev: 块设备句柄

先尝试打开已有文件系统;如果设备未格式化,则创建新文件系统。

Source

pub fn mount_blkfs_with_options( &mut self, path: &str, dev: BlockDeviceHandle, options: BlkFsMountOptions, ) -> Result<(), &'static str>

按显式策略挂载一个 AhRightOS-native BlkFS。

OpenOnly 适合把 QEMU virtio-blk 镜像当作“真实磁盘镜像”挂载: 如果镜像不是 BlkFS,内核会清晰失败而不会误格式化。Format 必须由 调用者显式指定,用于实验中的重新格式化场景。

Source

pub fn mount_virtualfs( &mut self, path: &str, fs_type: FsType, virtualfs: Arc<dyn VirtualFileSystem>, ) -> Result<(), &'static str>

挂载一个虚拟文件系统(如 procfs/sysfs/devtmpfs)。

Source

pub fn get_blkfs(&self, path: &str) -> Option<Arc<BlkFS>>

获取指定路径的BlkFS(如果已挂载)

Source

pub fn umount(&mut self, path: &str) -> Result<(), &'static str>

卸载文件系统

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.