Skip to main content

Ext4Processor

Struct Ext4Processor 

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

A processor that wraps an ext4 parser and adds write functionality if not in read-only mode.

Implementations§

Source§

impl Ext4Processor

Source

pub fn new(reader_writer: Arc<dyn ReaderWriter>, read_only: bool) -> Self

Source

pub fn read_only(&self) -> bool

Source

pub fn overwrite_extents( &self, inode_num: u32, data: impl AsRef<[u8]>, offset: u64, ) -> Result<(), ParsingError>

Overwrites existing extents of a file with new data. Partial writes of data are not supported - if write requires allocating new extent, a NOT_SUPPORTED error is returned.

Source

pub fn sync(&self) -> Result<(), ParsingError>

Methods from Deref<Target = Parser>§

Source

pub fn block_size(&self) -> Result<u64, ParsingError>

Reads block size from the Super Block.

Source

pub fn inode(&self, inode_number: u32) -> Result<INode, ParsingError>

Reads the INode at the given inode number.

Source

pub fn root_inode(&self) -> Result<INode, ParsingError>

Helper function to get the root directory INode.

Source

pub fn read_extents( &self, inode_num: u32, ) -> Result<(u64, Vec<Extent>), ParsingError>

Reads the inode size and raw extent data for a regular file. Fails if the provided inode is not a regular file.

Source

pub fn entries_from_inode( &self, inode: &INode, ) -> Result<Vec<DirEntry2>, ParsingError>

Lists directory entries from the directory that is the given Inode.

Errors if the Inode does not map to a Directory.

Source

pub fn entry_at_path(&self, path: &Path) -> Result<DirEntry2, ParsingError>

Gets any DirEntry2 that isn’t root.

Root doesn’t have a DirEntry2.

When dynamic loading of files is supported, this is the required mechanism.

Source

pub fn read_data(&self, inode_num: u32) -> Result<Vec<u8>, ParsingError>

Reads all raw data for a given inode.

For a file, this will be the file data. For a symlink, this will be the symlink target.

Source

pub fn index<R, E>( &self, inode: INode, prefix: Vec<&str>, receiver: &mut R, ) -> Result<bool, E>
where E: From<ParsingError>, R: FnMut(&Parser, Vec<&str>, &DirEntry2) -> Result<bool, E>,

Progress through the entire directory tree starting from the given INode.

If given the root directory INode, this will process through every directory entry in the filesystem in a DFS manner.

Takes in a closure that will be called for each entry found. Closure should return Ok(true) in order to continue the process, otherwise the process will stop.

Returns Ok(true) if it has indexed its subtree successfully. Otherwise, if the receiver chooses to cancel indexing early, an Ok(false) is returned and propagated up.

Source

pub fn inode_xattrs(&self, inode_number: u32) -> Result<XattrMap, ParsingError>

Returns the xattrs associated with inode_number.

Trait Implementations§

Source§

impl Deref for Ext4Processor

Source§

type Target = Parser

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. 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.

§

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V