Skip to main content

ErofsFilesystem

Struct ErofsFilesystem 

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

The filesystem implementation for an EROFS image.

Implementations§

Source§

impl ErofsFilesystem

Source

pub fn new(reader: Arc<dyn Reader>) -> Result<Self, ErofsError>

Creates a new filesystem instance for an EROFS image from a reader.

Source

pub fn feature_incompat(&self) -> FeatureIncompat

Returns the feature incompat flags of the EROFS image.

Source

pub fn block_size(&self) -> u64

Returns the block size of the EROFS image.

Source

pub fn node(&self, nid: u64) -> Result<Node, ErofsError>

Returns the node with the given nid.

Source

pub fn root_node(&self) -> DirectoryNode

Returns the root node of the EROFS image.

Source

pub fn total_bytes(&self) -> u64

Source

pub fn total_inodes(&self) -> u64

Source

pub fn read_file_range( &self, node: &FileNode, offset: u64, buf: &mut [u8], ) -> Result<usize, ErofsError>

Reads the data of the given file node into a buffer.

Reads the target path of the given symlink node.

Source

pub fn read_directory( &self, node: &DirectoryNode, entry_offset: usize, entries: &mut [DirectoryEntry], ) -> Result<usize, ErofsError>

Read a number of entries from a directory, starting at entry_offset. Will retrieve up to the number of entries in the directory or the size of the provided buffer, returning the number of entries filled in the buffer. If there are less filled entries then the number of entry slots provided in the buffer, there are no more entries in this directory. Entries are sorted lexicographically. Reads past the end of the number of entries will return zero entries filled.

TODO(https://fxbug.dev/479841115): It is possible for directories to omit their “.” entries in erofs, and in that case there is a flag marking it and we are expected to synthesize it. Parse that flag and implement it. TODO(https://fxbug.dev/479841115): This API is slightly awkward to hold. We should consider making it an iterator interface.

Source

pub fn lookup( &self, dir: &DirectoryNode, name: &str, ) -> Result<Option<Node>, ErofsError>

Looks up a node by name in a directory.

Source

pub fn iter_xattrs<'a>( &'a self, node: &NodeInner, ) -> Result<XattrIterator<'a>, ErofsError>

Returns an iterator over the xattr entry headers for a node.

Source

pub fn list_xattrs(&self, node: &NodeInner) -> Result<Vec<Vec<u8>>, ErofsError>

List all xattr names for a given node.

Source

pub fn get_xattr( &self, node: &NodeInner, name: &[u8], ) -> Result<Option<Vec<u8>>, ErofsError>

Get the value of a specific xattr for a given node.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

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
§

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.