#[repr(C, packed(1))]pub struct Ext2Superblock {Show 38 fields
pub inodes_count: u32,
pub blocks_count: u32,
pub r_blocks_count: u32,
pub free_blocks_count: u32,
pub free_inodes_count: u32,
pub first_data_block: u32,
pub log_block_size: u32,
pub log_frag_size: u32,
pub blocks_per_group: u32,
pub frags_per_group: u32,
pub inodes_per_group: u32,
pub mtime: u32,
pub wtime: u32,
pub mnt_count: u16,
pub max_mnt_count: u16,
pub magic: u16,
pub state: u16,
pub errors: u16,
pub minor_rev_level: u16,
pub lastcheck: u32,
pub checkinterval: u32,
pub creator_os: u32,
pub rev_level: u32,
pub def_resuid: u16,
pub def_resgid: u16,
pub first_ino: u32,
pub inode_size: u16,
pub block_group_nr: u16,
pub feature_compat: u32,
pub feature_incompat: u32,
pub feature_ro_compat: u32,
pub uuid: [u8; 16],
pub volume_name: [u8; 16],
pub last_mounted: [u8; 64],
pub algorithm_usage_bitmap: u32,
pub prealloc_blocks: u8,
pub prealloc_dir_blocks: u8,
pub padding: [u8; 820],
}Expand description
ext2 Superblock structure
This structure represents the superblock of an ext2 filesystem. It contains essential information about the filesystem layout and parameters.
Fields§
§inodes_count: u32Total number of inodes
blocks_count: u32Total number of blocks
r_blocks_count: u32Number of blocks reserved for superuser
free_blocks_count: u32Number of free blocks
free_inodes_count: u32Number of free inodes
first_data_block: u32First data block (0 for 1K blocks, 1 for larger blocks)
log_block_size: u32Block size (log2(block_size) - 10)
log_frag_size: u32Fragment size (log2(fragment_size) - 10)
blocks_per_group: u32Number of blocks per group
frags_per_group: u32Number of fragments per group
inodes_per_group: u32Number of inodes per group
mtime: u32Mount time
wtime: u32Write time
mnt_count: u16Mount count
max_mnt_count: u16Maximum mount count
magic: u16Magic signature
state: u16File system state
errors: u16Behavior when detecting errors
minor_rev_level: u16Minor revision level
lastcheck: u32Time of last check
checkinterval: u32Maximum time between checks
creator_os: u32Creator OS
rev_level: u32Revision level
def_resuid: u16Default uid for reserved blocks
def_resgid: u16Default gid for reserved blocks
first_ino: u32First non-reserved inode
inode_size: u16Size of inode structure
block_group_nr: u16Block group this superblock is part of
feature_compat: u32Compatible feature set
feature_incompat: u32Incompatible feature set
feature_ro_compat: u32Read-only feature set
uuid: [u8; 16]128-bit UUID for volume
volume_name: [u8; 16]Volume name
last_mounted: [u8; 64]Directory where last mounted
algorithm_usage_bitmap: u32Algorithm usage bitmap
prealloc_blocks: u8Number of blocks to try to preallocate for files
prealloc_dir_blocks: u8Number of blocks to preallocate for directories
padding: [u8; 820]Padding to 1024 bytes
Implementations§
Source§impl Ext2Superblock
impl Ext2Superblock
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, FileSystemError>
pub fn from_bytes(data: &[u8]) -> Result<Self, FileSystemError>
Parse superblock from raw bytes using unsafe type conversion for efficiency
Sourcepub fn from_bytes_boxed(data: &[u8]) -> Result<Box<Self>, FileSystemError>
pub fn from_bytes_boxed(data: &[u8]) -> Result<Box<Self>, FileSystemError>
Parse superblock from raw bytes and return as Box to avoid stack overflow
Sourcepub fn get_block_size(&self) -> u32
pub fn get_block_size(&self) -> u32
Get block size in bytes
Sourcepub fn get_blocks_count(&self) -> u32
pub fn get_blocks_count(&self) -> u32
Get total blocks count
Sourcepub fn get_inodes_count(&self) -> u32
pub fn get_inodes_count(&self) -> u32
Get total inodes count
Sourcepub fn get_blocks_per_group(&self) -> u32
pub fn get_blocks_per_group(&self) -> u32
Get blocks per group
Sourcepub fn get_inodes_per_group(&self) -> u32
pub fn get_inodes_per_group(&self) -> u32
Get inodes per group
Sourcepub fn get_inode_size(&self) -> u16
pub fn get_inode_size(&self) -> u16
Get inode size
Sourcepub fn get_first_data_block(&self) -> u32
pub fn get_first_data_block(&self) -> u32
Get first data block
Trait Implementations§
Source§impl Clone for Ext2Superblock
impl Clone for Ext2Superblock
Source§fn clone(&self) -> Ext2Superblock
fn clone(&self) -> Ext2Superblock
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Ext2Superblock
impl Debug for Ext2Superblock
impl Copy for Ext2Superblock
Auto Trait Implementations§
impl Freeze for Ext2Superblock
impl RefUnwindSafe for Ext2Superblock
impl Send for Ext2Superblock
impl Sync for Ext2Superblock
impl Unpin for Ext2Superblock
impl UnwindSafe for Ext2Superblock
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)