pub struct Superblock {Show 35 fields
pub csum: [u8; 32],
pub fsid: Uuid,
pub bytenr: u64,
pub flags: u64,
pub magic: u64,
pub generation: u64,
pub root: u64,
pub chunk_root: u64,
pub log_root: u64,
pub log_root_transid: u64,
pub total_bytes: u64,
pub bytes_used: u64,
pub root_dir_objectid: u64,
pub num_devices: u64,
pub sectorsize: u32,
pub nodesize: u32,
pub leafsize: u32,
pub stripesize: u32,
pub sys_chunk_array_size: u32,
pub chunk_root_generation: u64,
pub compat_flags: u64,
pub compat_ro_flags: u64,
pub incompat_flags: u64,
pub csum_type: ChecksumType,
pub root_level: u8,
pub chunk_root_level: u8,
pub log_root_level: u8,
pub dev_item: DeviceItem,
pub label: String,
pub cache_generation: u64,
pub uuid_tree_generation: u64,
pub metadata_uuid: Uuid,
pub nr_global_roots: u64,
pub backup_roots: [BackupRoot; 4],
pub sys_chunk_array: [u8; 2048],
}Expand description
Parsed btrfs superblock.
The superblock is the entry point for reading a btrfs filesystem. It lives
at a fixed offset on each device (see super_mirror_offset) and contains
the root pointers, feature flags, and embedded system chunk array needed to
bootstrap access to all other on-disk structures.
Fields§
§csum: [u8; 32]Checksum of everything past this field (bytes 32..4096).
fsid: UuidFilesystem UUID. Shared by all devices in a multi-device filesystem.
bytenr: u64Physical byte offset where this superblock is stored on disk.
flags: u64Superblock flags (BTRFS_SUPER_FLAG_*).
magic: u64Magic number (_BHRfS_M). See Superblock::magic_is_valid.
generation: u64Transaction generation of this superblock write.
root: u64Logical bytenr of the root tree root block.
chunk_root: u64Logical bytenr of the chunk tree root block.
log_root: u64Logical bytenr of the log tree root block (0 if no log tree).
log_root_transid: u64Transaction ID of the log tree root.
total_bytes: u64Total usable bytes across all devices.
bytes_used: u64Total bytes used by data and metadata.
root_dir_objectid: u64Objectid of the root directory (always 6).
num_devices: u64Number of devices in this filesystem.
sectorsize: u32Minimum I/O alignment (typically 4096).
nodesize: u32Size of tree blocks in bytes (typically 16384).
leafsize: u32Legacy field, equal to nodesize in modern filesystems.
stripesize: u32Stripe size for RAID (typically 65536).
sys_chunk_array_size: u32Number of valid bytes in the sys_chunk_array.
chunk_root_generation: u64Generation of the chunk tree root.
compat_flags: u64Compatible feature flags.
compat_ro_flags: u64Compatible read-only feature flags.
incompat_flags: u64Incompatible feature flags (e.g. MIXED_GROUPS, SKINNY_METADATA).
csum_type: ChecksumTypeChecksum algorithm for this filesystem.
root_level: u8B-tree level of the root tree root.
chunk_root_level: u8B-tree level of the chunk tree root.
log_root_level: u8B-tree level of the log tree root.
dev_item: DeviceItemEmbedded device item describing this device.
label: StringFilesystem label (up to 255 bytes, NUL-terminated on disk).
cache_generation: u64Generation when the free space cache was written (v1 cache).
uuid_tree_generation: u64Generation when the UUID tree was last updated.
metadata_uuid: UuidMetadata UUID (differs from fsid when METADATA_UUID incompat flag is set).
nr_global_roots: u64Number of global root entries (extent-tree-v2, not yet used).
backup_roots: [BackupRoot; 4]Four rotating backup copies of critical tree root pointers.
sys_chunk_array: [u8; 2048]Embedded chunk tree entries for bootstrapping the chunk cache.
Implementations§
Source§impl Superblock
impl Superblock
Sourcepub fn magic_is_valid(&self) -> bool
pub fn magic_is_valid(&self) -> bool
Whether the magic bytes match BTRFS_MAGIC.
Sourcepub fn has_metadata_uuid(&self) -> bool
pub fn has_metadata_uuid(&self) -> bool
Whether the METADATA_UUID incompat flag is set.
Sourcepub fn to_bytes(&self) -> [u8; 4096]
pub fn to_bytes(&self) -> [u8; 4096]
Serialize the superblock to a 4096-byte buffer.
The checksum field is written as-is from self.csum; call
csum_superblock on the result to recompute it.
Trait Implementations§
Source§impl Clone for Superblock
impl Clone for Superblock
Source§fn clone(&self) -> Superblock
fn clone(&self) -> Superblock
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more