Expand description
§Parsing btrfs B-tree nodes and leaves from raw blocks
A btrfs filesystem is organized as a collection of B-trees. Each tree is stored as a hierarchy of blocks (nodesize bytes each, typically 16 KiB). Internal nodes contain key pointers to child blocks; leaves contain items with their associated data payloads.
This module provides typed Rust structs for all tree block components and enums for key types and well-known object IDs, with safe LE parsing from raw byte buffers.
Structs§
- DiskKey
- A parsed btrfs disk key (objectid, type, offset).
- Header
- Parsed header of a btrfs tree block (shared by nodes and leaves).
- Header
Flags - Tree block header flags stored in
btrfs_header::flags(lower 56 bits; the upper 8 bits hold the backref revision). - Item
- A leaf item descriptor: key + offset/size into the leaf’s data area.
- KeyPtr
- A key pointer from an internal tree node, pointing to a child block.
Enums§
- KeyType
- Btrfs item key type, identifying what kind of item a key refers to.
- Object
Id - Well-known btrfs object IDs used as tree IDs, namespace roots, and special-purpose objectids in item keys.
- Tree
Block - A parsed btrfs tree block: either an internal node or a leaf.
Functions§
- format_
key - Format a key as
(OBJECTID TYPE OFFSET)matching the C reference output.