pub struct Header {
pub csum: [u8; 32],
pub fsid: Uuid,
pub bytenr: u64,
pub flags: HeaderFlags,
pub chunk_tree_uuid: Uuid,
pub generation: u64,
pub owner: u64,
pub nritems: u32,
pub level: u8,
}Expand description
Parsed header of a btrfs tree block (shared by nodes and leaves).
Every tree block (node or leaf) begins with this 101-byte header. It identifies the block’s position in the tree, its owning tree, and contains a checksum covering the entire block.
Fields§
§csum: [u8; 32]Checksum of everything past this field to the end of the tree block.
fsid: UuidFilesystem UUID (must match the superblock’s fsid or metadata_uuid).
bytenr: u64Logical byte offset where this block is stored.
flags: HeaderFlagsHeader flags (lower 56 bits) and backref revision (upper 8 bits).
chunk_tree_uuid: UuidUUID of the chunk tree that maps this block’s logical address.
generation: u64Transaction generation when this block was last written.
owner: u64Objectid of the tree that owns this block (e.g. 1 = root tree, 5 = FS tree).
nritems: u32Number of items (leaf) or key pointers (node) in this block.
level: u8Tree level: 0 for leaves, >0 for internal nodes.
Implementations§
Source§impl Header
impl Header
Sourcepub fn parse(buf: &[u8]) -> Self
pub fn parse(buf: &[u8]) -> Self
Parse a tree block header from the start of buf.
§Panics
Panics if buf is smaller than the on-disk header size (101 bytes).
Sourcepub fn backref_rev(&self) -> u64
pub fn backref_rev(&self) -> u64
Return the backref revision from the flags field.
Sourcepub fn block_flags(&self) -> HeaderFlags
pub fn block_flags(&self) -> HeaderFlags
Return the block flags with the backref revision bits masked out.