pub struct Superblock {Show 35 fields
pub inodes_count: u32,
pub blocks_count: u64,
pub reserved_blocks: u64,
pub free_blocks: u64,
pub free_inodes: u32,
pub first_data_block: u32,
pub block_size: u32,
pub blocks_per_group: u32,
pub inodes_per_group: u32,
pub magic: u16,
pub state: u16,
pub rev_level: u32,
pub inode_size: u16,
pub desc_size: u16,
pub feature_compat: CompatFeatures,
pub feature_incompat: IncompatFeatures,
pub feature_ro_compat: RoCompatFeatures,
pub uuid: [u8; 16],
pub volume_name: [u8; 16],
pub last_mounted: [u8; 64],
pub mkfs_time: u32,
pub mount_time: u32,
pub write_time: u32,
pub lastcheck_time: u32,
pub journal_inum: u32,
pub hash_seed: [u32; 4],
pub def_hash_version: u8,
pub checksum_type: u8,
pub checksum_seed: u32,
pub checksum: u32,
pub is_64bit: bool,
pub log_groups_per_flex: u32,
pub last_orphan: u32,
pub first_error_time: u32,
pub last_error_time: u32,
}Expand description
Parsed ext4 superblock. All multi-byte fields are converted from little-endian on disk to native endianness.
Fields§
§inodes_count: u32§blocks_count: u64Combined lo + hi (64-bit mode).
reserved_blocks: u64§free_blocks: u64§free_inodes: u32§first_data_block: u32§block_size: u32Computed: 2^(10 + s_log_block_size).
blocks_per_group: u32§inodes_per_group: u32§magic: u16§state: u16§rev_level: u32§inode_size: u16§desc_size: u16§feature_compat: CompatFeatures§feature_incompat: IncompatFeatures§feature_ro_compat: RoCompatFeatures§uuid: [u8; 16]§volume_name: [u8; 16]§last_mounted: [u8; 64]§mkfs_time: u32§mount_time: u32§write_time: u32§lastcheck_time: u32§journal_inum: u32§hash_seed: [u32; 4]§def_hash_version: u8§checksum_type: u8§checksum_seed: u32§checksum: u32§is_64bit: bool§log_groups_per_flex: u32§last_orphan: u32§first_error_time: u32§last_error_time: u32Implementations§
Source§impl Superblock
impl Superblock
Sourcepub fn parse(buf: &[u8]) -> Result<Self>
pub fn parse(buf: &[u8]) -> Result<Self>
Parse an ext4 superblock from the given byte slice.
The slice should begin at the start of the superblock (i.e. byte 1024
of the filesystem image has already been skipped by the caller).
A minimum of MIN_SUPERBLOCK_LEN bytes is required; a full 1024-byte
superblock is needed to access all extended fields.
Sourcepub fn uuid_string(&self) -> String
pub fn uuid_string(&self) -> String
UUID formatted as a standard hyphenated string.
Sourcepub fn has_metadata_csum(&self) -> bool
pub fn has_metadata_csum(&self) -> bool
Whether the filesystem has metadata checksumming enabled.
Sourcepub fn has_extents(&self) -> bool
pub fn has_extents(&self) -> bool
Whether the filesystem uses extents (vs. block maps).
Sourcepub fn verify_checksum(&self, raw_buf: &[u8]) -> bool
pub fn verify_checksum(&self, raw_buf: &[u8]) -> bool
Verify the superblock CRC32C checksum.
The checksum covers bytes 0..0x3FC (everything except the 4-byte checksum field itself at offset 0x3FC).
The superblock checksum is special: unlike other ext4 metadata, it is computed with the default CRC32C initial value (~0 / 0xFFFFFFFF) rather than the UUID-derived or stored seed. This is because the superblock itself contains the UUID used to derive seeds for other structures.
The Linux kernel’s crc32c_le() does NOT apply the final XOR that the
standard CRC-32/ISCSI algorithm specifies (xorout=0xFFFFFFFF). We use
a custom algorithm definition with xorout=0 to match kernel behavior.
Sourcepub fn has_inline_data(&self) -> bool
pub fn has_inline_data(&self) -> bool
Whether inline data is supported.
Sourcepub fn has_journal(&self) -> bool
pub fn has_journal(&self) -> bool
Whether the filesystem has a journal.
Sourcepub fn group_count(&self) -> u32
pub fn group_count(&self) -> u32
Number of block groups (rounded up).
Trait Implementations§
Source§impl Clone for Superblock
impl Clone for Superblock
Source§fn clone(&self) -> Superblock
fn clone(&self) -> Superblock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more