Struct MountTree

Source
pub struct MountTree {
    pub root_mount: RwLock<Arc<MountPoint>>,
}
Expand description

Mount tree manager for VFS v2

Fields§

§root_mount: RwLock<Arc<MountPoint>>

Root mount point (can be updated when mounting at “/”)

Implementations§

Source§

impl MountTree

Source

pub fn new(root_entry: VfsEntryRef) -> Self

Create a new mount tree with the given root

Source

pub fn bind_mount( &self, source_entry: VfsEntryRef, target_entry: VfsEntryRef, target_mount_point: Arc<MountPoint>, ) -> VfsResult<MountId>

Create a bind mount.

§Arguments
  • source_entry - The VFS entry to be mounted.
  • target_entry - The VFS entry where the source will be mounted.
  • target_mount_point - The mount point containing the target entry.
Source

pub fn mount( &self, target_entry: VfsEntryRef, target_mount_point: Arc<MountPoint>, filesystem: Arc<dyn FileSystemOperations>, ) -> VfsResult<MountId>

Mount a filesystem at a specific entry in the mount tree.

Source

pub fn replace_root(&self, new_root: Arc<MountPoint>)

Replaces the root mount point.

Source

pub fn is_mount_point( &self, entry_to_check: &VfsEntryRef, mount_point_to_check: &Arc<MountPoint>, ) -> bool

Check if a path is a mount point

§Arguments
  • entry_to_check - The VFS entry to check if it is a mount point.
  • mount_point_to_check - The mount point to check against.
§Notes

entry_to_check and mount_point_to_check should be in the same mount point.

Source

pub fn is_bind_source(&self, entry_to_check: &VfsEntryRef) -> bool

Check if an entry is a source for a bind mount

Source

pub fn is_entry_used_in_mount( &self, entry_to_check: &VfsEntryRef, mount_point_to_check: &Arc<MountPoint>, ) -> bool

Check if an entry is used in a mount (either as a mount point or a bind source)

Source

pub fn unmount( &self, entry: &VfsEntryRef, parent_mount_point: &Arc<MountPoint>, ) -> VfsResult<Arc<MountPoint>>

Unmount a filesystem

Source

pub fn resolve_path( &self, path: &str, ) -> VfsResult<(VfsEntryRef, Arc<MountPoint>)>

Resolve a path to a VFS entry, handling mount boundaries

Source

pub fn resolve_mount_point( &self, path: &str, ) -> VfsResult<(VfsEntryRef, Arc<MountPoint>)>

Resolve a path to the mount point entry (not the mounted content) This is used for unmount operations where we need the actual mount point

Source

pub fn resolve_path_with_options( &self, path: &str, options: &PathResolutionOptions, ) -> VfsResult<(VfsEntryRef, Arc<MountPoint>)>

Resolve a path with specified options

Source

pub fn resolve_mount_point_with_options( &self, path: &str, options: &PathResolutionOptions, ) -> VfsResult<(VfsEntryRef, Arc<MountPoint>)>

Resolve a path to the mount point entry with options

Source

fn resolve_path_internal( &self, path: &str, resolve_mount: bool, options: &PathResolutionOptions, ) -> VfsResult<(VfsEntryRef, Arc<MountPoint>)>

Resolve a single path component without following symlinks

Source

pub fn parse_path(&self, path: &str) -> Vec<String>

Parse a path into components

Source

fn get_mount_path(&self, mount: &Arc<MountPoint>) -> String

Get the full path of a mount point

Source

fn resolve_component( &self, entry: VfsEntryRef, component: &str, ) -> VfsResult<VfsEntryRef>

Resolve a single path component within a VFS entry

Source

fn resolve_component_with_depth( &self, entry: VfsEntryRef, component: &str, symlink_depth: u32, ) -> VfsResult<VfsEntryRef>

Resolve a single path component with symlink depth tracking

Resolve a symbolic link target

Resolve a symbolic link target with depth tracking

Trait Implementations§

Source§

impl Debug for MountTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for MountTree

§

impl !RefUnwindSafe for MountTree

§

impl Send for MountTree

§

impl Sync for MountTree

§

impl Unpin for MountTree

§

impl !UnwindSafe for MountTree

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.