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
impl MountNode
Sourcepub fn get_mount_point(&self) -> Result<Arc<MountPoint>>
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.
Sourcefn resolve_internal(
self_arc: Arc<MountNode>,
components: &[String],
depth: usize,
) -> Result<Option<(Arc<MountNode>, String)>>
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 nodecomponents
- 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.
Sourcefn resolve_non_transparent_internal(
self_arc: Arc<MountNode>,
components: &[String],
) -> Result<Option<(Arc<MountNode>, String)>>
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 nodecomponents
- 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.