btrfs_diskformat/extent/
extent_data_ref.rs

1use static_assertions::const_assert_eq;
2use zerocopy::little_endian::{U32 as U32LE, U64 as U64LE};
3use zerocopy_derive::*;
4
5/// Contains an indirect back reference for a file data extent.
6///
7/// Immediately follows an [`ExtentInlineRef`]. See that documentation for more details.
8///
9/// [`ExtentInlineRef`]: crate::ExtentInlineRef
10#[derive(Copy, Clone, Debug, Hash, IntoBytes, FromBytes, Unaligned, KnownLayout, Immutable)]
11#[repr(C, packed)]
12pub struct ExtentDataRef {
13    /// The object ID for the file tree that references this extent.
14    pub root: U64LE,
15
16    /// The object ID of the inode that contains the extent data that references this extent.
17    pub objectid: U64LE,
18
19    /// The offset within the file that corresponds to this extent.
20    pub offset: U64LE,
21
22    /// The reference count being held.
23    pub count: U32LE,
24}
25const_assert_eq!(core::mem::size_of::<ExtentDataRef>(), 28);