Skip to main content

RamfsScheme

Struct RamfsScheme 

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

Kernel-resident RAM filesystem implementing the Scheme trait.

Implementations§

Source§

impl RamfsScheme

Source

pub fn new() -> Self

Creates a new instance.

Source

pub fn ensure_dir(&self, path: &str)

Ensure that path (relative to mount root) exists as a directory.

Silently succeeds if the directory already exists.

Source

pub fn insert_file(&self, name: &str, content: &[u8])

Insert a read-only file into the root.

Convenience helper used during vfs::init() to pre-populate files.

Trait Implementations§

Source§

impl Scheme for RamfsScheme

Source§

fn open(&self, path: &str, flags: OpenFlags) -> Result<OpenResult, SyscallError>

Performs the open operation.

Source§

fn read( &self, file_id: u64, offset: u64, buf: &mut [u8], ) -> Result<usize, SyscallError>

Performs the read operation.

Source§

fn write( &self, file_id: u64, offset: u64, buf: &[u8], ) -> Result<usize, SyscallError>

Performs the write operation.

Source§

fn close(&self, _file_id: u64) -> Result<(), SyscallError>

Performs the close operation.

Source§

fn size(&self, file_id: u64) -> Result<u64, SyscallError>

Performs the size operation.

Source§

fn truncate(&self, file_id: u64, new_size: u64) -> Result<(), SyscallError>

Performs the truncate operation.

Source§

fn create_file(&self, path: &str, mode: u32) -> Result<OpenResult, SyscallError>

Creates file.

Source§

fn create_directory( &self, path: &str, mode: u32, ) -> Result<OpenResult, SyscallError>

Creates directory.

Performs the unlink operation.

Source§

fn stat(&self, file_id: u64) -> Result<FileStat, SyscallError>

Performs the stat operation.

Source§

fn readdir(&self, file_id: u64) -> Result<Vec<DirEntry>, SyscallError>

Performs the readdir operation.

Source§

fn rename(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>

Performs the rename operation.

Source§

fn chmod(&self, path: &str, mode: u32) -> Result<(), SyscallError>

Performs the chmod operation.

Source§

fn fchmod(&self, file_id: u64, mode: u32) -> Result<(), SyscallError>

Performs the fchmod operation.

Performs the link operation.

Performs the symlink operation.

Performs the readlink operation.

Source§

fn sync(&self, file_id: u64) -> Result<(), SyscallError>

Sync file to storage (if applicable).

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.