Skip to main content

FileSystem

Struct FileSystem 

Source
pub struct FileSystem { /* private fields */ }
Expand description

Thread-safe in-RAM file system holding directories and metadata-only device/pipe nodes.

Implementations§

Source§

impl FileSystem

Source

pub fn new() -> Self

Create a new mounted in-memory file system containing an empty root directory.

Trait Implementations§

Source§

impl AttributeOperations for FileSystem

Source§

fn get_attributes( &self, context: &mut Context, attributes: &mut Attributes, ) -> Result<()>

Populate the requested attributes for the open file or directory. Read more
Source§

fn set_attributes( &self, context: &mut Context, attributes: &Attributes, ) -> Result<()>

Change the fields selected by attributes.get_mask(). Read more
Source§

impl BaseOperations for FileSystem

Source§

fn read( &self, _context: &mut Context, _task_context: &mut TaskContext<'_>, _buffer: &mut [u8], _absolute_position: Size, ) -> Poll<Result<usize>>

Source§

fn write( &self, _context: &mut Context, _task_context: &mut TaskContext<'_>, _buffer: &[u8], _absolute_position: Size, ) -> Poll<Result<usize>>

Source§

fn set_position( &self, _context: &mut Context, _current: Size, _position: &Position, ) -> Result<Size>

Source§

fn flush( &self, _context: &mut Context, _task_context: &mut TaskContext<'_>, ) -> Poll<Result<()>>

Source§

fn open(&self, _context: &mut Context) -> Result<()>

Source§

fn close(&self, _context: &mut Context) -> Result<()>

Source§

fn clone_context(&self, context: &Context) -> Result<Context>

§

fn control( &self, _context: &mut Context, _cx: &mut Context<'_>, _command: ControlCommandIdentifier, _input: &AnyByLayout, _output: &mut AnyByLayout, ) -> Poll<Result<(), Kind>>

§

fn read_until( &self, context: &mut Context, cx: &mut Context<'_>, buffer: &mut [u8], absolute_position: u64, delimiter: &[u8], ) -> Poll<Result<usize, Kind>>

§

fn write_pattern( &self, context: &mut Context, cx: &mut Context<'_>, pattern: &[u8], count: usize, absolute_position: u64, ) -> Poll<Result<usize, Kind>>

§

fn write_vectored( &self, context: &mut Context, cx: &mut Context<'_>, buffers: &[&[u8]], absolute_position: u64, ) -> Poll<Result<usize, Kind>>

§

fn read_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: u64, ) -> Result<usize, Kind>

§

fn write_sync( &self, context: &mut Context, buffer: &[u8], absolute_position: u64, ) -> Result<usize, Kind>

§

fn flush_sync(&self, context: &mut Context) -> Result<(), Kind>

§

fn control_sync( &self, context: &mut Context, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Result<(), Kind>

§

fn read_until_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: u64, delimiter: &[u8], ) -> Result<usize, Kind>

§

fn write_pattern_sync( &self, context: &mut Context, pattern: &[u8], count: usize, absolute_position: u64, ) -> Result<usize, Kind>

§

fn write_vectored_sync( &self, context: &mut Context, buffers: &[&[u8]], absolute_position: u64, ) -> Result<usize, Kind>

§

fn cancel_operation(&self, _context: &mut Context, _operation: Operation)

Detach this opening’s registration after completion, error or cancellation. This hook is idempotent and must not consume data or change the cursor. Wake and drop retired wakers outside device locks.
Source§

impl Default for FileSystem

Source§

fn default() -> Self

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

impl DirectoryOperations for FileSystem

Source§

fn read(&self, context: &mut Context) -> Result<Option<Entry>>

Source§

fn get_position(&self, context: &mut Context) -> Result<Size>

Source§

fn set_position(&self, context: &mut Context, position: Size) -> Result<()>

Source§

fn rewind(&self, context: &mut Context) -> Result<()>

Source§

fn close(&self, context: &mut Context) -> Result<()>

Source§

impl FileSystemOperations for FileSystem

Source§

fn supports_confined_namespace(&self) -> bool

Return whether this backend enforces confined, non-following namespace semantics for operations beneath a directory root. Read more
Source§

fn writable_attributes(&self) -> AttributeFlags

Return the fields this backend can accept through set_attributes. Read more
Source§

fn persistent_attributes(&self) -> AttributeFlags

Return the fields that are stored durably by this filesystem. Read more
Source§

fn lookup_directory(&self, context: &mut Context, path: &Path) -> Result<()>

Source§

fn lookup_file( &self, _context: &mut Context, path: &Path, _flags: Flags, ) -> Result<()>

Source§

fn create_directory(&self, path: &Path, attributes: &Attributes) -> Result<()>

Create a directory at path, persisting attributes with the new entry in the same commit as the entry creation where the backend can. Read more
Source§

fn create_file(&self, path: &Path, attributes: &Attributes) -> Result<()>

Create a regular file at path, persisting attributes with the new entry in the same commit as the entry creation where the backend can. Read more
Source§

fn remove(&self, path: &Path) -> Result<()>

Remove a file or directory from the file system. Read more
Source§

fn rename(&self, source: &Path, destination: &Path) -> Result<()>

Rename or move a file or directory. Read more
Source§

fn get_attributes(&self, path: &Path, attributes: &mut Attributes) -> Result<()>

Populate the requested attributes for a path. Read more
Source§

fn set_attributes(&self, path: &Path, attributes: &Attributes) -> Result<()>

Change the fields selected by attributes.get_mask() for a path. Read more
§

fn supports_directory_entry_operations(&self) -> bool

Return whether this backend operates on single normal entry names relative to an already-opened directory [Context]. Read more
§

fn lookup_directory_entry( &self, _parent: &Context, _name: &str, _context: &mut Context, ) -> Result<(), Kind>

Open a child directory entry name inside the opened parent directory into context, without following symbolic links. Read more
§

fn lookup_file_entry( &self, _parent: &Context, _name: &str, _context: &mut Context, _flags: Flags, ) -> Result<(), Kind>

Open a child regular file name inside the opened parent directory into context, without following symbolic links.
§

fn create_directory_entry( &self, _parent: &Context, _name: &str, _attributes: &Attributes, ) -> Result<(), Kind>

Create a child directory name inside the opened parent directory, persisting attributes with the new entry where the backend can.
§

fn create_file_entry( &self, _parent: &Context, _name: &str, _attributes: &Attributes, ) -> Result<(), Kind>

Create a child regular file name inside the opened parent directory, persisting attributes with the new entry where the backend can.
§

fn remove_entry(&self, _parent: &Context, _name: &str) -> Result<(), Kind>

Remove a child entry name inside the opened parent directory without following symbolic links.
§

fn rename_entry( &self, _source_parent: &Context, _source_name: &str, _destination_parent: &Context, _destination_name: &str, ) -> Result<(), Kind>

Rename source_name inside source_parent to destination_name inside destination_parent without following symbolic links.
§

fn link_entry( &self, _existing_parent: &Context, _existing_name: &str, _new_parent: &Context, _new_name: &str, ) -> Result<(), Kind>

Create new_name inside new_parent as a hard link to existing_name inside existing_parent without following symbolic links.
§

fn create_symlink_entry( &self, _target: &Path, _parent: &Context, _name: &str, _attributes: &Attributes, ) -> Result<(), Kind>

Create a symbolic link named name inside the opened parent directory pointing to target, persisting attributes with the new entry where the backend can.
§

fn read_symlink_entry( &self, _parent: &Context, _name: &str, _buffer: &mut [u8], ) -> Result<usize, Kind>

Read the target of symbolic link name inside the opened parent directory into buffer without following it.
§

fn get_entry_attributes( &self, _parent: &Context, _name: &str, _attributes: &mut Attributes, ) -> Result<(), Kind>

Populate attributes for child entry name inside the opened parent directory without following symbolic links.
§

fn set_entry_attributes( &self, _parent: &Context, _name: &str, _attributes: &Attributes, ) -> Result<(), Kind>

Update attributes for child entry name inside the opened parent directory without following symbolic links.
Create a symbolic link without resolving its target, persisting attributes with the new entry where the backend can. Backends that do not support native links or a durable Xila link representation may keep the default implementation.
Create new as an additional directory entry for the existing, non-directory object at existing, sharing its data. Backends without hard links (including LittleFS) keep the default implementation, which reports [crate::IoErrorKind::Unsupported].
Copy the stored target of a symbolic link into a caller-owned buffer. This operation must inspect the final directory entry without following it.
Source§

impl MountOperations for FileSystem

Source§

fn mount(&self) -> Result<()>

Source§

fn unmount(&self) -> Result<()>

Source§

impl FileOperations for FileSystem

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.

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.

Source§

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

Source§

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>,

Source§

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.