Struct SuperBlock

Source
#[repr(C)]
pub struct SuperBlock {
Show 92 fields pub e2fs_icount: U32, pub e2fs_bcount: U32, pub e2fs_rbcount: U32, pub e2fs_fbcount: U32, pub e2fs_ficount: U32, pub e2fs_first_dblock: U32, pub e2fs_log_bsize: U32, pub e2fs_log_fsize: U32, pub e2fs_bpg: U32, pub e2fs_fpg: U32, pub e2fs_ipg: U32, pub e2fs_mtime: U32, pub e2fs_wtime: U32, pub e2fs_mnt_count: U16, pub e2fs_max_mnt_count: U16, pub e2fs_magic: U16, pub e2fs_state: U16, pub e2fs_beh: U16, pub e2fs_minrev: U16, pub e2fs_lastfsck: U32, pub e2fs_fsckintv: U32, pub e2fs_creator: U32, pub e2fs_rev: U32, pub e2fs_ruid: U16, pub e2fs_rgid: U16, pub e2fs_first_ino: U32, pub e2fs_inode_size: U16, pub e2fs_block_group_nr: U16, pub e2fs_features_compat: U32, pub e2fs_features_incompat: U32, pub e2fs_features_rocompat: U32, pub e2fs_uuid: [u8; 16], pub e2fs_vname: [u8; 16], pub e2fs_fsmnt: [u8; 64], pub e2fs_algo: U32, pub e2fs_prealloc: u8, pub e2fs_dir_prealloc: u8, pub e2fs_reserved_ngdb: U16, pub e3fs_journal_uuid: [u8; 16], pub e3fs_journal_inum: U32, pub e3fs_journal_dev: U32, pub e3fs_last_orphan: U32, pub e3fs_hash_seed: [U32; 4], pub e3fs_def_hash_version: u8, pub e3fs_jnl_backup_type: u8, pub e3fs_desc_size: U16, pub e3fs_default_mount_opts: U32, pub e3fs_first_meta_bg: U32, pub e3fs_mkfs_time: U32, pub e3fs_jnl_blks: [U32; 17], pub e4fs_bcount_hi: U32, pub e4fs_rbcount_hi: U32, pub e4fs_fbcount_hi: U32, pub e4fs_min_extra_isize: U16, pub e4fs_want_extra_isize: U16, pub e4fs_flags: U32, pub e4fs_raid_stride: U16, pub e4fs_mmpintv: U16, pub e4fs_mmpblk: U64, pub e4fs_raid_stripe_wid: U32, pub e4fs_log_gpf: u8, pub e4fs_chksum_type: u8, pub e4fs_encrypt: u8, pub e4fs_reserved_pad: u8, pub e4fs_kbytes_written: U64, pub e4fs_snapinum: U32, pub e4fs_snapid: U32, pub e4fs_snaprbcount: U64, pub e4fs_snaplist: U32, pub e4fs_errcount: U32, pub e4fs_first_errtime: U32, pub e4fs_first_errino: U32, pub e4fs_first_errblk: U64, pub e4fs_first_errfunc: [u8; 32], pub e4fs_first_errline: U32, pub e4fs_last_errtime: U32, pub e4fs_last_errino: U32, pub e4fs_last_errline: U32, pub e4fs_last_errblk: U64, pub e4fs_last_errfunc: [u8; 32], pub e4fs_mount_opts: [u8; 64], pub e4fs_usrquota_inum: U32, pub e4fs_grpquota_inum: U32, pub e4fs_overhead_clusters: U32, pub e4fs_backup_bgs: [U32; 2], pub e4fs_encrypt_algos: [u8; 4], pub e4fs_encrypt_pw_salt: [u8; 16], pub e4fs_lpf_ino: U32, pub e4fs_proj_quota_inum: U32, pub e4fs_chksum_seed: U32, pub e4fs_reserved: [U32; 98], pub e4fs_sbchksum: U32,
}

Fields§

§e2fs_icount: U32

INode count.

§e2fs_bcount: U32

Block count.

§e2fs_rbcount: U32

Reserved blocks count.

§e2fs_fbcount: U32

Free blocks count.

§e2fs_ficount: U32

Free INodes count.

§e2fs_first_dblock: U32

First data block.

§e2fs_log_bsize: U32

Block Size = 2^(e2fs_log_bsize+10).

§e2fs_log_fsize: U32

Fragment size.

§e2fs_bpg: U32

Blocks per group.

§e2fs_fpg: U32

Fragments per group.

§e2fs_ipg: U32

INodes per group.

§e2fs_mtime: U32

Mount time.

§e2fs_wtime: U32

Write time.

§e2fs_mnt_count: U16

Mount count.

§e2fs_max_mnt_count: U16

Max mount count.

§e2fs_magic: U16

Magic number: 0xEF53

§e2fs_state: U16

Filesystem state.

§e2fs_beh: U16

Behavior on errors.

§e2fs_minrev: U16

Minor revision level.

§e2fs_lastfsck: U32

Time of last filesystem check.

§e2fs_fsckintv: U32

Max time between filesystem checks.

§e2fs_creator: U32

Creator OS.

§e2fs_rev: U32

Revision level.

§e2fs_ruid: U16

Default UID for reserved blocks.

§e2fs_rgid: U16

Default GID for reserved blocks.

§e2fs_first_ino: U32

First non-reserved inode.

§e2fs_inode_size: U16

Size of INode structure.

§e2fs_block_group_nr: U16

Block group number of this super block.

§e2fs_features_compat: U32

Compatible feature set.

§e2fs_features_incompat: U32

Incompatible feature set.

§e2fs_features_rocompat: U32

RO-compatible feature set.

§e2fs_uuid: [u8; 16]

128-bit uuid for volume.

§e2fs_vname: [u8; 16]

Volume name.

§e2fs_fsmnt: [u8; 64]

Name as mounted.

§e2fs_algo: U32

Compression algorithm.

§e2fs_prealloc: u8

§of blocks for old prealloc.

§e2fs_dir_prealloc: u8

§of blocks for old prealloc dirs.

§e2fs_reserved_ngdb: U16

§of reserved gd blocks for resize.

§e3fs_journal_uuid: [u8; 16]

UUID of journal super block.

§e3fs_journal_inum: U32

INode number of journal file.

§e3fs_journal_dev: U32

Device number of journal file.

§e3fs_last_orphan: U32

Start of list of inodes to delete.

§e3fs_hash_seed: [U32; 4]

HTREE hash seed.

§e3fs_def_hash_version: u8

Default hash version to use.

§e3fs_jnl_backup_type: u8

Journal backup type.

§e3fs_desc_size: U16

size of group descriptor.

§e3fs_default_mount_opts: U32

Default mount options.

§e3fs_first_meta_bg: U32

First metablock block group.

§e3fs_mkfs_time: U32

When the filesystem was created.

§e3fs_jnl_blks: [U32; 17]

Backup of the journal INode.

§e4fs_bcount_hi: U32

High bits of block count.

§e4fs_rbcount_hi: U32

High bits of reserved blocks count.

§e4fs_fbcount_hi: U32

High bits of free blocks count.

§e4fs_min_extra_isize: U16

All inodes have some bytes.

§e4fs_want_extra_isize: U16

Inodes must reserve some bytes.

§e4fs_flags: U32

Miscellaneous flags.

§e4fs_raid_stride: U16

RAID stride.

§e4fs_mmpintv: U16

Seconds to wait in MMP checking.

§e4fs_mmpblk: U64

Block for multi-mount protection.

§e4fs_raid_stripe_wid: U32

Blocks on data disks (N * stride).

§e4fs_log_gpf: u8

FLEX_BG group size.

§e4fs_chksum_type: u8

Metadata checksum algorithm used.

§e4fs_encrypt: u8

Versioning level for encryption.

§e4fs_reserved_pad: u8§e4fs_kbytes_written: U64

Number of lifetime kilobytes.

§e4fs_snapinum: U32

INode number of active snapshot.

§e4fs_snapid: U32

Sequential ID of active snapshot.

§e4fs_snaprbcount: U64

Reserved blocks for active snapshot.

§e4fs_snaplist: U32

INode number for on-disk snapshot.

§e4fs_errcount: U32

Number of filesystem errors.

§e4fs_first_errtime: U32

First time an error happened.

§e4fs_first_errino: U32

INode involved in first error.

§e4fs_first_errblk: U64

Block involved of first error.

§e4fs_first_errfunc: [u8; 32]

Function where error happened.

§e4fs_first_errline: U32

Line number where error happened.

§e4fs_last_errtime: U32

Most recent time of an error.

§e4fs_last_errino: U32

INode involved in last error.

§e4fs_last_errline: U32

Line number where error happened.

§e4fs_last_errblk: U64

Block involved of last error.

§e4fs_last_errfunc: [u8; 32]

Function where error happened.

§e4fs_mount_opts: [u8; 64]

Mount options.

§e4fs_usrquota_inum: U32

INode for tracking user quota.

§e4fs_grpquota_inum: U32

INode for tracking group quota.

§e4fs_overhead_clusters: U32

Overhead blocks/clusters.

§e4fs_backup_bgs: [U32; 2]

Groups with sparse_super2 SBs.

§e4fs_encrypt_algos: [u8; 4]

Encryption algorithms in use.

§e4fs_encrypt_pw_salt: [u8; 16]

Salt used for string2key.

§e4fs_lpf_ino: U32

Location of the lost+found inode.

§e4fs_proj_quota_inum: U32

INode for tracking project quota.

§e4fs_chksum_seed: U32

Checksum seed.

§e4fs_reserved: [U32; 98]

Padding to the end of the block.

§e4fs_sbchksum: U32

Super block checksum.

Implementations§

Source§

impl SuperBlock

Source

pub fn parse(reader: &dyn Reader) -> Result<SuperBlock, ParsingError>

Parse the Super Block at its default location.

Source

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

Source

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

Source

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

Gets file system block size.

Per spec, the only valid block sizes are 1KiB, 2KiB, 4KiB, and 64KiB. We will only permit these values.

Source

pub fn block_group_descriptor_size(&self) -> usize

Returns the size of the block group descriptors

Source

pub fn is_64bit(&self) -> bool

Returns whether the filesystem is 64bit enabled

Trait Implementations§

Source§

impl FromBytes for SuperBlock
where U32: FromBytes, U16: FromBytes, [u8; 16]: FromBytes, [u8; 64]: FromBytes, u8: FromBytes, [U32; 4]: FromBytes, [U32; 17]: FromBytes, U64: FromBytes, [u8; 32]: FromBytes, [U32; 2]: FromBytes, [u8; 4]: FromBytes, [U32; 98]: FromBytes,

§

fn ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the given source as a &Self. Read more
§

fn ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the prefix of the given source as a &Self without copying. Read more
§

fn ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: Immutable + KnownLayout,

Interprets the suffix of the given bytes as a &Self. Read more
§

fn ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &Self with a DST length equal to count. Read more
§

fn ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the prefix of the given source as a DST &Self with length equal to count. Read more
§

fn ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the suffix of the given source as a DST &Self with length equal to count. Read more
§

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source. Read more
§

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source. Read more
§

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source. Read more
Source§

impl FromZeros for SuperBlock
where U32: FromZeros, U16: FromZeros, [u8; 16]: FromZeros, [u8; 64]: FromZeros, u8: FromZeros, [U32; 4]: FromZeros, [U32; 17]: FromZeros, U64: FromZeros, [u8; 32]: FromZeros, [U32; 2]: FromZeros, [u8; 4]: FromZeros, [U32; 98]: FromZeros,

§

fn zero(&mut self)

Overwrites self with zeros. Read more
§

fn new_zeroed() -> Self
where Self: Sized,

Creates an instance of Self from zeroed bytes. Read more
Source§

impl KnownLayout for SuperBlock
where LEU32: KnownLayout,

Source§

type PointerMetadata = <U32<LittleEndian> as KnownLayout>::PointerMetadata

The type of metadata stored in a pointer to Self. Read more
Source§

impl TryFromBytes for SuperBlock
where U32: TryFromBytes, U16: TryFromBytes, [u8; 16]: TryFromBytes, [u8; 64]: TryFromBytes, u8: TryFromBytes, [U32; 4]: TryFromBytes, [U32; 17]: TryFromBytes, U64: TryFromBytes, [u8; 32]: TryFromBytes, [U32; 2]: TryFromBytes, [u8; 4]: TryFromBytes, [U32; 98]: TryFromBytes,

§

fn try_ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the given source as a &Self. Read more
§

fn try_ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the prefix of the given source as a &Self. Read more
§

fn try_ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the suffix of the given source as a &Self. Read more
§

fn try_ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the given source as a &Self with a DST length equal to count. Read more
§

fn try_ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the prefix of the given source as a &Self with a DST length equal to count. Read more
§

fn try_ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the suffix of the given source as a &Self with a DST length equal to count. Read more
§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more
Source§

impl Immutable for SuperBlock
where U32: Immutable, U16: Immutable, [u8; 16]: Immutable, [u8; 64]: Immutable, u8: Immutable, [U32; 4]: Immutable, [U32; 17]: Immutable, U64: Immutable, [u8; 32]: Immutable, [U32; 2]: Immutable, [u8; 4]: Immutable, [U32; 98]: Immutable,

Source§

impl Unaligned for SuperBlock
where U32: Unaligned, U16: Unaligned, [u8; 16]: Unaligned, [u8; 64]: Unaligned, u8: Unaligned, [U32; 4]: Unaligned, [U32; 17]: Unaligned, U64: Unaligned, [u8; 32]: Unaligned, [U32; 2]: Unaligned, [u8; 4]: Unaligned, [U32; 98]: Unaligned,

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> 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.
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> ParseToStruct for T
where T: FromBytes + KnownLayout + Immutable + Unaligned,

Source§

fn from_reader_with_offset( reader: &dyn Reader, offset: u64, ) -> Result<Self, ParsingError>

Source§

fn to_struct_ref( data: &[u8], error_type: ParsingError, ) -> Result<&Self, ParsingError>

Casts the &u8 data to &Self. 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, 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