pub struct RootItem {Show 24 fields
pub inode_data: Vec<u8>,
pub generation: u64,
pub root_dirid: u64,
pub bytenr: u64,
pub byte_limit: u64,
pub bytes_used: u64,
pub last_snapshot: u64,
pub flags: RootItemFlags,
pub refs: u32,
pub drop_progress: DiskKey,
pub drop_level: u8,
pub level: u8,
pub generation_v2: u64,
pub uuid: Uuid,
pub parent_uuid: Uuid,
pub received_uuid: Uuid,
pub ctransid: u64,
pub otransid: u64,
pub stransid: u64,
pub rtransid: u64,
pub ctime: Timespec,
pub otime: Timespec,
pub stime: Timespec,
pub rtime: Timespec,
}Expand description
Root item describing a tree (subvolume, snapshot, or internal tree).
Stored in the root tree with key (tree_objectid, ROOT_ITEM, 0). Contains
the root block pointer, subvolume UUIDs, and transaction timestamps needed
for snapshot management and send/receive.
Fields§
§inode_data: Vec<u8>Raw bytes of the embedded btrfs_inode_item (160 bytes).
The on-disk ROOT_ITEM starts with an embedded inode describing the
root directory of the subvolume. This is preserved as raw bytes to
avoid losing data during parse/serialize round-trips, since the
embedded inode fields are not otherwise tracked by this struct.
generation: u64Generation when this root was last modified.
root_dirid: u64Objectid of the root directory inode (always 256 for FS trees).
bytenr: u64Logical bytenr of this tree’s root block.
byte_limit: u64Quota byte limit (0 = unlimited).
bytes_used: u64Bytes used by this tree.
last_snapshot: u64Generation of the last snapshot taken from this subvolume.
flags: RootItemFlagsRoot flags (RDONLY for read-only snapshots).
refs: u32Reference count.
drop_progress: DiskKeyProgress key for in-progress drop operations.
drop_level: u8Tree level of the drop progress.
level: u8B-tree level of this tree’s root block.
generation_v2: u64Extended generation (v2 root items, matches generation in practice).
uuid: UuidUUID of this subvolume.
parent_uuid: UuidUUID of the parent subvolume (for snapshots).
received_uuid: UuidUUID of the subvolume this was received from (for send/receive).
ctransid: u64Transaction ID of the last change to this subvolume.
otransid: u64Transaction ID when this subvolume was created.
stransid: u64Transaction ID when this subvolume was sent.
rtransid: u64Transaction ID when this subvolume was received.
ctime: TimespecTime of the last change.
otime: TimespecCreation time.
stime: TimespecTime when sent.
rtime: TimespecTime when received.
Implementations§
Source§impl RootItem
impl RootItem
Sourcepub fn parse(data: &[u8]) -> Option<Self>
pub fn parse(data: &[u8]) -> Option<Self>
Parse a root item from a raw byte buffer. Handles both v1 (shorter) and v2 (full) root item formats gracefully, defaulting missing fields to zero/nil.
Sourcepub fn new_internal(generation: u64, bytenr: u64, level: u8) -> Self
pub fn new_internal(generation: u64, bytenr: u64, level: u8) -> Self
Create a minimal root item for internal trees (not subvolumes).
Sets generation, bytenr, level, and refs=1. All other fields are zeroed/nil.