Struct Cpiofs

Source
pub struct Cpiofs {
    name: &'static str,
    entries: Mutex<Vec<CpiofsEntry>>,
    mounted: bool,
    mount_point: String,
}
Expand description

Structure representing the entire Initramfs

Fields§

§name: &'static str§entries: Mutex<Vec<CpiofsEntry>>§mounted: bool§mount_point: String

Implementations§

Source§

impl Cpiofs

Source

pub fn new(name: &'static str, cpio_data: &[u8]) -> Result<Self>

Create a new Initramfs

§Arguments
  • name - The name of the filesystem
  • cpio_data - The CPIO data to parse
§Returns

A result containing the created Cpiofs instance or an error

Source

fn parse_cpio(cpio_data: &[u8]) -> Result<Vec<CpiofsEntry>>

Parse CPIO data to generate entries

§Arguments
  • cpio_data - The CPIO data to parse
§Returns

A result containing a vector of CpiofsEntry or an error

Source

fn normalize_path(&self, path: &str) -> String

Trait Implementations§

Source§

impl FileOperations for Cpiofs

Source§

fn open(&self, path: &str, _flags: u32) -> Result<Arc<dyn FileHandle>>

Open a file
Source§

fn read_dir(&self, _path: &str) -> Result<Vec<DirectoryEntry>>

Read directory entries
Source§

fn create_file(&self, _path: &str, _file_type: FileType) -> Result<()>

Create a file with the specified type. Read more
Source§

fn create_dir(&self, _path: &str) -> Result<()>

Create a directory
Source§

fn remove(&self, _path: &str) -> Result<()>

Remove a file/directory
Source§

fn metadata(&self, path: &str) -> Result<FileMetadata>

Get the metadata
Source§

fn root_dir(&self) -> Result<Directory<'_>>

Get the root directory of the file system
Source§

impl FileSystem for Cpiofs

Source§

fn mount(&mut self, mount_point: &str) -> Result<()>

Mount operation
Source§

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

Unmount operation
Source§

fn name(&self) -> &str

Get the name of the file system

Auto Trait Implementations§

§

impl !Freeze for Cpiofs

§

impl !RefUnwindSafe for Cpiofs

§

impl Send for Cpiofs

§

impl Sync for Cpiofs

§

impl Unpin for Cpiofs

§

impl UnwindSafe for Cpiofs

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
§

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

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

Performs the conversion.
Source§

impl<T> VirtualFileSystem for T