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 Nodes, indexed by their respective Inode in a slab.

Fields§

§storage: Slab<Node>§backing_offload: Option<OffloadBackingStore>§limiter: Option<DynFsMemoryLimiter>

Implementations§

source§

impl FileSystemInner

source

pub(super) fn inode_of(&self, path: &Path) -> Result<InodeResolution>

Get the inode associated to a path if it exists.

source

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.

source

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.

source

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.

source

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

source

pub(super) fn update_node_name( &mut self, inode: usize, new_name: OsString, ) -> Result<()>

Set a new name for the node represented by inode.

source

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.

source

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.

source

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

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.

Trait Implementations§

source§

impl Debug for FileSystemInner

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for FileSystemInner

source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

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> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcastable for T
where T: Any + Debug + 'static,

source§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

source§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more