Struct MountNode

Source
pub struct MountNode {
    pub component: RwLock<String>,
    mount_point: RwLock<Option<Arc<MountPoint>>>,
    children: RwLock<BTreeMap<String, Arc<MountNode>>>,
}
Expand description

Mount tree node representing a single component in the filesystem hierarchy

Each MountNode represents a directory component in the filesystem path. Nodes can optionally contain mount points and have child nodes for subdirectories. The tree structure enables efficient path traversal and mount point resolution.

§Thread Safety

All fields are protected by RwLock to ensure thread-safe access in a multi-threaded kernel environment.

Fields§

§component: RwLock<String>

Path component

§mount_point: RwLock<Option<Arc<MountPoint>>>

Mount information if this node is a mount point

§children: RwLock<BTreeMap<String, Arc<MountNode>>>

Child nodes

Implementations§

Source§

impl MountNode

Source

fn new(component: String) -> Self

Create a new mount node with the specified path component

§Arguments
  • component - The path component name for this node
§Returns

A new MountNode instance with the given component name

Source

pub fn get_mount_point(&self) -> Result<Arc<MountPoint>>

Get the mount point associated with this node

§Returns
  • Ok(Arc<MountPoint>) - The mount point if it exists.
  • Err(FileSystemError) - If no mount point is found.
Source

fn resolve_internal( self_arc: Arc<MountNode>, components: &[String], depth: usize, ) -> Result<Option<(Arc<MountNode>, String)>>

Resolve path within this mount node and its children (transparent resolution)

This method resolves the given path components starting from this node. For bind mounts, it recursively resolves through the source mount tree to find the deepest actual mount that handles the requested path.

This is an internal method that operates on Arc

§Arguments
  • self_arc - Arc reference to this node
  • components - The path components to resolve.
  • depth - Current recursion depth to prevent infinite loops.
§Returns
  • Ok(Some((Arc<MountNode>, String))) - A tuple containing the resolved mount node and the relative path.
  • Ok(None) - If this node is the final target (self-resolution).
  • Err(FileSystemError) - If the path is invalid or no mount point is found.
Source

fn resolve_non_transparent_internal( self_arc: Arc<MountNode>, components: &[String], ) -> Result<Option<(Arc<MountNode>, String)>>

Resolve path within this mount node and its children (non-transparent resolution)

This method resolves the given path components starting from this node without resolving through bind mounts. This is useful for mount management operations where you need to work with the bind mount node itself.

This is an internal method that operates on Arc

§Arguments
  • self_arc - Arc reference to this node
  • components - The path components to resolve.
§Returns
  • Ok(Some((Arc<MountNode>, String))) - A tuple containing the mount node and the relative path.
  • Ok(None) - If this node is the final target (self-resolution).
  • Err(FileSystemError) - If the path is invalid or no mount point is found.

Auto Trait Implementations§

§

impl !Freeze for MountNode

§

impl !RefUnwindSafe for MountNode

§

impl Send for MountNode

§

impl Sync for MountNode

§

impl Unpin for MountNode

§

impl !UnwindSafe for MountNode

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.