pub struct RootRef {
pub dirid: u64,
pub sequence: u64,
pub name: Vec<u8>,
}Expand description
Reference linking a subvolume to its parent directory.
ROOT_REF keys (parent → child) and ROOT_BACKREF keys (child → parent)
use the same on-disk format.
Fields§
§dirid: u64Inode number of the directory containing the subvolume entry.
sequence: u64Directory sequence number (matches the DIR_INDEX offset).
name: Vec<u8>Name of the subvolume entry in the parent directory.
Implementations§
Source§impl RootRef
impl RootRef
Sourcepub fn parse(data: &[u8]) -> Option<Self>
pub fn parse(data: &[u8]) -> Option<Self>
Parse a root ref (or root backref) from a raw byte buffer.
Sourcepub fn serialize(dirid: u64, sequence: u64, name: &[u8]) -> Vec<u8> ⓘ
pub fn serialize(dirid: u64, sequence: u64, name: &[u8]) -> Vec<u8> ⓘ
Serialize a (dirid, sequence, name) tuple to the on-disk
btrfs_root_ref byte representation: 18-byte fixed header
(dirid u64 + sequence u64 + name_len u16, all
little-endian) followed by the raw name bytes.
§Panics
Panics if name.len() does not fit in a u16 (the on-disk
name_len field is 16 bits). Practical names are always far
below 65535 bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RootRef
impl RefUnwindSafe for RootRef
impl Send for RootRef
impl Sync for RootRef
impl Unpin for RootRef
impl UnsafeUnpin for RootRef
impl UnwindSafe for RootRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more