⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Vfs

Struct Vfs 

Source
pub struct Vfs { /* private fields */ }
Expand description

Virtual Filesystem Manager

Implementations§

Source§

impl Vfs

Source

pub fn new() -> Self

Create a new VFS instance

Source§

impl Vfs

Source

pub fn mount_root(&mut self, fs: Arc<dyn Filesystem>) -> Result<(), KernelError>

Mount the root filesystem

Source

pub fn mount( &mut self, path: String, fs: Arc<dyn Filesystem>, ) -> Result<(), KernelError>

Mount a filesystem at the specified path

Source

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

Source

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.

Source

pub fn unmount(&mut self, path: &str) -> Result<(), KernelError>

Unmount a filesystem at the specified path

Source

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).

Source

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().

Source

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).

Source

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.

Source

pub fn get_cwd(&self) -> &str

Get current working directory

Source

pub fn set_cwd(&mut self, path: String) -> Result<(), KernelError>

Set current working directory

Source

pub fn open( &self, path: &str, flags: OpenFlags, ) -> Result<Arc<dyn VfsNode>, KernelError>

Open a file

Checks MAC policy before allowing access.

Source

pub fn mkdir( &self, path: &str, permissions: Permissions, ) -> Result<(), KernelError>

Create a directory

Checks MAC policy (Write access to file domain) before creating.

Remove a file or directory

Source

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.

Source

pub fn sync(&self) -> Result<(), KernelError>

Sync all filesystems

Trait Implementations§

Source§

impl Default for Vfs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Vfs

§

impl !RefUnwindSafe for Vfs

§

impl Send for Vfs

§

impl Sync for Vfs

§

impl Unpin for Vfs

§

impl !UnwindSafe for Vfs

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.