Struct SquashFs

Source
pub struct SquashFs<R: Manager> {
    pub superblock: SuperBlock,
    pub inode_table: InodeTable,
    pub fragments_table: FragmentsTable,
    pub directory_tables: BTreeMap<u32, DirectoryTable>,
    pub handles: RwLock<BTreeMap<u64, ReadFlags>>,
    /* private fields */
}
Expand description

Base structure representing a loaded SquashFS image.

Note that the tables (inode, directory…) are fully parsed on creation and kept in memory, rather than being accessed lazily.

This implements the fuser_async::Filesystem trait.

The type R is a deadpool pool manager for the underlying filesystem readers. See crate::pools.

Fields§

§superblock: SuperBlock§inode_table: InodeTable§fragments_table: FragmentsTable§directory_tables: BTreeMap<u32, DirectoryTable>

Table for each directory inode

§handles: RwLock<BTreeMap<u64, ReadFlags>>

Implementations§

Source§

impl<T: AsyncSeekBufRead, R: Manager<Type = T, Error = Error> + Send + Sync> SquashFs<R>

Source

pub async fn read_file( &self, inode: u32, offset: usize, size: usize, flags: ReadFlags, compression: Compression, ) -> Result<Bytes, Error>

Read from a file from the archive

Source

pub async fn read_file_impl( &self, file: &Box<dyn FileInode + Send + Sync>, __arg2: (impl AsyncSeekBufRead, u64), inode: u32, __arg4: (usize, usize), compression: Compression, ) -> Result<Bytes, Error>

Source§

impl<R: Manager> SquashFs<R>

Source

pub fn ino_to_fuse(&self, ino: u32) -> u64

Remapping to ensure that the root inode is fuser::FUSE_ROOT_ID

Source§

impl<T, P> SquashFs<P>
where T: AsyncSeekBufRead, P: LocalReadersPool + Manager<Type = T, Error = Error> + Send + Sync,

Source

pub async fn open(file: &Path, options: &Options) -> Result<Self, Error>

Open squashfs image from a local file

Source§

impl<R: Manager> SquashFs<R>

Source

pub fn inodes(&self) -> impl Iterator<Item = u32> + '_

Source§

impl<T, R> SquashFs<R>
where T: AsyncSeekBufRead, R: Manager<Type = T, Error = Error> + Send + Sync,

Source

pub async fn has_handles(&self) -> bool

Source

pub async fn from_reader( options: &Options, manager_factory: impl ManagerFactory<R>, ) -> Result<Self, Error>

Open squashfs image from a reader factory, responsible for creating readers with the requested open flags.

Trait Implementations§

Source§

impl<R: Manager> Debug for SquashFs<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: AsyncSeekBufRead, R: Manager<Type = T, Error = Error> + Send + Sync> Filesystem for SquashFs<R>

Source§

type Error = Error

Source§

fn inodes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the set of inodes from the filesystem. Read more
Source§

fn open<'life0, 'async_trait>( &'life0 self, _ino: u64, flags: i32, ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open a file and get a handle. See also fuser::Filesystem::open.
Source§

fn release<'life0, 'async_trait>( &'life0 self, _ino: u64, fh: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Release a file handle. See also fuser::Filesystem::release.
Source§

fn lookup<'life0, 'life1, 'async_trait>( &'life0 self, parent: u64, name: &'life1 OsStr, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lookup an entry by name in a directory. See also fuser::Filesystem::lookup.
Source§

fn getattr<'life0, 'async_trait>( &'life0 self, ino_fuse: u64, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get attributes on an entry. See also fuser::Filesystem::getattr.
Source§

fn setattr<'life0, 'async_trait>( &'life0 mut self, _ino: u64, _size: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set attributes. Currently only supports setting the size
Source§

fn readdir<'life0, 'async_trait>( &'life0 self, ino_fuse: u64, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = DirEntry> + Send + Sync + '_>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read a directory. To be called repeatedly by specifying a gradually increasing offset, until the returned iterator is empty. A minimum of two calls is required to be certain that the end has been reached. offset represents the index of the starting element. See also fuser::Filesystem::readdir.
Source§

fn read<'life0, 'async_trait>( &'life0 self, ino_fuse: u64, fh: u64, offset: i64, size: u32, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read from a file. See also fuser::Filesystem::read.
Source§

fn write<'life0, 'async_trait>( &'life0 self, _ino: u64, _fh: u64, _data: Bytes, _offset: i64, ) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Write to file. See also fuser::Filesystem::write.
Source§

fn create<'life0, 'async_trait>( &'life0 mut self, _parent: u64, _name: OsString, _mode: u32, _umask: u32, _flags: i32, ) -> Pin<Box<dyn Future<Output = Result<(FileAttr, u64), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create and open a file. See also fuser::Filesystem::create.
Source§

fn mkdir<'life0, 'async_trait>( &'life0 mut self, _parent: u64, _name: OsString, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a directory. See also fuser::Filesystem::mkdir.
Source§

fn destroy<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

Close filesystem. See also fuser::Filesystem::destroy.

Auto Trait Implementations§

§

impl<R> !Freeze for SquashFs<R>

§

impl<R> !RefUnwindSafe for SquashFs<R>

§

impl<R> Send for SquashFs<R>
where <R as Manager>::Type: Send,

§

impl<R> Sync for SquashFs<R>
where <R as Manager>::Type: Send,

§

impl<R> Unpin for SquashFs<R>

§

impl<R> !UnwindSafe for SquashFs<R>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<F> InodeAllocator for F
where F: Filesystem + Send + Sync,

Source§

type Error = <F as Filesystem>::Error

Source§

fn allocate<'life0, 'async_trait>( &'life0 mut self, _n: usize, ) -> Pin<Box<dyn Future<Output = Result<u64, <F as InodeAllocator>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, F: 'async_trait,

Reserve a continuous number of inodes, returning the start. The range is disjoint from the previously allocated ones.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

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.

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<_INNER> FilesystemSSUS for _INNER
where _INNER: Filesystem + Send + Sync + Unpin + 'static,