Struct virtual_fs::mem_fs::filesystem::FileSystemInner
source · pub(super) struct FileSystemInner {
pub(super) storage: Slab<Node>,
pub(super) backing_offload: Option<OffloadBackingStore>,
pub(super) limiter: Option<DynFsMemoryLimiter>,
}
Expand description
The core of the file system. It contains a collection of Node
s,
indexed by their respective Inode
in a slab.
Fields§
§storage: Slab<Node>
§backing_offload: Option<OffloadBackingStore>
§limiter: Option<DynFsMemoryLimiter>
Implementations§
source§impl FileSystemInner
impl FileSystemInner
sourcepub(super) fn inode_of(&self, path: &Path) -> Result<InodeResolution>
pub(super) fn inode_of(&self, path: &Path) -> Result<InodeResolution>
Get the inode associated to a path if it exists.
sourcepub(super) fn inode_of_parent(
&self,
parent_path: &Path,
) -> Result<InodeResolution>
pub(super) fn inode_of_parent( &self, parent_path: &Path, ) -> Result<InodeResolution>
Get the inode associated to a “parent path”. The returned inode necessarily represents a directory.
sourcepub(super) fn as_parent_get_position_and_inode_of_directory(
&self,
inode_of_parent: usize,
name_of_directory: &OsString,
directory_must_be_empty: DirectoryMustBeEmpty,
) -> Result<(usize, InodeResolution)>
pub(super) fn as_parent_get_position_and_inode_of_directory( &self, inode_of_parent: usize, name_of_directory: &OsString, directory_must_be_empty: DirectoryMustBeEmpty, ) -> Result<(usize, InodeResolution)>
From the inode of a parent node (so, a directory), returns the
child index of name_of_directory
along with its inode.
sourcepub(super) fn as_parent_get_position_and_inode_of_file(
&self,
inode_of_parent: usize,
name_of_file: &OsString,
) -> Result<Option<(usize, InodeResolution)>>
pub(super) fn as_parent_get_position_and_inode_of_file( &self, inode_of_parent: usize, name_of_file: &OsString, ) -> Result<Option<(usize, InodeResolution)>>
From the inode of a parent node (so, a directory), returns the
child index of name_of_file
along with its inode.
sourcefn as_parent_get_position_and_inode(
&self,
inode_of_parent: usize,
name_of: &OsString,
) -> Result<Option<(usize, InodeResolution)>>
fn as_parent_get_position_and_inode( &self, inode_of_parent: usize, name_of: &OsString, ) -> Result<Option<(usize, InodeResolution)>>
From the inode of a parent node (so, a directory), returns the
child index of name_of
along with its inode, whatever the
type of inode is (directory or file).
sourcepub(super) fn update_node_name(
&mut self,
inode: usize,
new_name: OsString,
) -> Result<()>
pub(super) fn update_node_name( &mut self, inode: usize, new_name: OsString, ) -> Result<()>
Set a new name for the node represented by inode
.
sourcepub(super) fn add_child_to_node(
&mut self,
inode: usize,
new_child: usize,
) -> Result<()>
pub(super) fn add_child_to_node( &mut self, inode: usize, new_child: usize, ) -> Result<()>
Add a child to a directory node represented by inode
.
This function also updates the modified time of the directory.
§Safety
inode
must represents an existing directory.
sourcepub(super) fn remove_child_from_node(
&mut self,
inode: usize,
position: usize,
) -> Result<()>
pub(super) fn remove_child_from_node( &mut self, inode: usize, position: usize, ) -> Result<()>
Remove the child at position position
of a directory node
represented by inode
.
This function also updates the modified time of the directory.
§Safety
inode
must represents an existing directory.
sourcepub(super) fn canonicalize(
&self,
path: &Path,
) -> Result<(PathBuf, InodeResolution)>
pub(super) fn canonicalize( &self, path: &Path, ) -> Result<(PathBuf, InodeResolution)>
Canonicalize a path, i.e. try to resolve to a canonical, absolute form of the path with all intermediate components normalized:
- A path must starts with a root (
/
), - A path can contain
..
or.
components, - A path must not contain a Windows prefix (
C:
or\\server
), - A normalized path exists in the file system.
sourcepub(super) fn canonicalize_without_inode(&self, path: &Path) -> Result<PathBuf>
pub(super) fn canonicalize_without_inode(&self, path: &Path) -> Result<PathBuf>
Like Self::canonicalize
but without returning the inode of
the path, which means that there is no guarantee that the path
exists in the file system.