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> Encode<Ambiguous1> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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> Encode<Ambiguous2> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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 + Sync + Send>

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

§

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

§

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