btrfs_diskformat/core/root_ref.rs
1use static_assertions::const_assert_eq;
2use zerocopy::little_endian::{U16 as U16LE, U64 as U64LE};
3use zerocopy_derive::*;
4
5/// References a subvolume filesystem tree root. This is used for both forward and
6/// backward root references.
7///
8/// The name of the tree is stored after the end of the struct.
9#[derive(Copy, Clone, Debug, IntoBytes, FromBytes, Unaligned, KnownLayout)]
10#[repr(C, packed)]
11pub struct RootRef {
12 /// The subtree ID.
13 pub dirid: U64LE,
14
15 /// The directory sequence number of the subtree entry.
16 pub sequence: U64LE,
17
18 /// The length of the subtree name, stored after this field.
19 pub name_len: U16LE,
20}
21const_assert_eq!(core::mem::size_of::<RootRef>(), 18);