pub struct Vfs { /* private fields */ }Expand description
Virtual Filesystem Manager
Implementations§
Source§impl Vfs
impl Vfs
Sourcepub fn mount_root(&mut self, fs: Arc<dyn Filesystem>) -> Result<(), KernelError>
pub fn mount_root(&mut self, fs: Arc<dyn Filesystem>) -> Result<(), KernelError>
Mount the root filesystem
Sourcepub fn mount(
&mut self,
path: String,
fs: Arc<dyn Filesystem>,
) -> Result<(), KernelError>
pub fn mount( &mut self, path: String, fs: Arc<dyn Filesystem>, ) -> Result<(), KernelError>
Mount a filesystem at the specified path
Sourcepub fn mount_by_type(
&mut self,
path: &str,
fs_type: &str,
_flags: u32,
) -> Result<(), KernelError>
pub fn mount_by_type( &mut self, path: &str, fs_type: &str, _flags: u32, ) -> Result<(), KernelError>
Mount a filesystem by type at the specified path
Sourcepub fn swap_root(&mut self, fs: Arc<dyn Filesystem>)
pub fn swap_root(&mut self, fs: Arc<dyn Filesystem>)
Replace the root filesystem (used for persistent BlockFS mount at boot).
The previous root filesystem (if any) is dropped. Mount points under
/dev and /proc should be re-mounted after calling this.
Sourcepub fn unmount(&mut self, path: &str) -> Result<(), KernelError>
pub fn unmount(&mut self, path: &str) -> Result<(), KernelError>
Unmount a filesystem at the specified path
Sourcepub fn resolve_path(&self, path: &str) -> Result<Arc<dyn VfsNode>, KernelError>
pub fn resolve_path(&self, path: &str) -> Result<Arc<dyn VfsNode>, KernelError>
Resolve a path to a VFS node, following symlinks (including the final component).
Sourcepub fn resolve_path_no_follow(
&self,
path: &str,
) -> Result<Arc<dyn VfsNode>, KernelError>
pub fn resolve_path_no_follow( &self, path: &str, ) -> Result<Arc<dyn VfsNode>, KernelError>
Resolve a path to a VFS node without following the final symlink
component. Intermediate symlinks are still followed. Used by
lstat() and readlink().
Sourcepub fn resolve_from(
&self,
path: &str,
cwd: &str,
) -> Result<Arc<dyn VfsNode>, KernelError>
pub fn resolve_from( &self, path: &str, cwd: &str, ) -> Result<Arc<dyn VfsNode>, KernelError>
Resolve a path to a VFS node using an explicit cwd (per-thread FS state).
Sourcepub fn resolve_from_no_follow(
&self,
path: &str,
cwd: &str,
) -> Result<Arc<dyn VfsNode>, KernelError>
pub fn resolve_from_no_follow( &self, path: &str, cwd: &str, ) -> Result<Arc<dyn VfsNode>, KernelError>
Resolve a path to a VFS node using an explicit cwd, without following the final symlink component.
Sourcepub fn set_cwd(&mut self, path: String) -> Result<(), KernelError>
pub fn set_cwd(&mut self, path: String) -> Result<(), KernelError>
Set current working directory
Sourcepub fn open(
&self,
path: &str,
flags: OpenFlags,
) -> Result<Arc<dyn VfsNode>, KernelError>
pub fn open( &self, path: &str, flags: OpenFlags, ) -> Result<Arc<dyn VfsNode>, KernelError>
Open a file
Checks MAC policy before allowing access.
Sourcepub fn mkdir(
&self,
path: &str,
permissions: Permissions,
) -> Result<(), KernelError>
pub fn mkdir( &self, path: &str, permissions: Permissions, ) -> Result<(), KernelError>
Create a directory
Checks MAC policy (Write access to file domain) before creating.
Sourcepub fn unlink(&self, path: &str) -> Result<(), KernelError>
pub fn unlink(&self, path: &str) -> Result<(), KernelError>
Remove a file or directory
Sourcepub fn list_mounts(&self) -> Vec<(String, String, bool)>
pub fn list_mounts(&self) -> Vec<(String, String, bool)>
List all mount points and their filesystem types.
Returns a vector of (path, fs_name, readonly) tuples.
Sourcepub fn sync(&self) -> Result<(), KernelError>
pub fn sync(&self) -> Result<(), KernelError>
Sync all filesystems