ext4_read_only::parser

Struct Parser

Source
pub struct Parser { /* private fields */ }

Implementations§

Source§

impl Parser

EXT4 Parser

Takes in a Reader that is able to read arbitrary chunks of data from the filesystem image.

Basic use: let mut parser = Parser::new(VecReader::new(vec_of_u8)); let tree = parser.build_fuchsia_tree()

Source

pub fn new(reader: Box<dyn Reader>) -> Self

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>( &self, inode: INode, prefix: Vec<&str>, receiver: &mut R, ) -> Result<bool, ParsingError>

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.

Source

pub fn build_fuchsia_tree(&self) -> Result<Arc<Simple>, ParsingError>

Returns a Simple filesystem as built by TreeBuilder.build().

Auto Trait Implementations§

§

impl !Freeze for Parser

§

impl !RefUnwindSafe for Parser

§

impl Send for Parser

§

impl Sync for Parser

§

impl Unpin for Parser

§

impl !UnwindSafe for Parser

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.

§

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> IntoAny for T
where T: 'static + Send + Sync,

§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Cast the given object into a dyn std::any::Any.
§

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

§

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