btrfs_diskformat/chunk/stripe.rs
1use crate::UuidBytes;
2use static_assertions::const_assert_eq;
3use zerocopy::little_endian::U64 as U64LE;
4use zerocopy_derive::*;
5
6/// This structure is used to define the backing device storage that compose a
7/// [`Chunk`].
8///
9/// [`Chunk`]: crate::Chunk
10#[derive(
11 Copy, Clone, Debug, Hash, PartialEq, IntoBytes, FromBytes, Unaligned, KnownLayout, Immutable,
12)]
13#[repr(C, packed)]
14pub struct Stripe {
15 /// The ID of the device that contains this stripe.
16 pub devid: U64LE,
17
18 /// Location of the start of the stripe, in bytes.
19 ///
20 /// The length is determined by the `stripe_len` field of the associated
21 /// `Chunk`.
22 pub offset: U64LE,
23
24 /// UUID of the device that contains this stripe.
25 ///
26 /// This can be used to confirm that the correct device has been retrieved.
27 pub dev_uuid: UuidBytes,
28}
29const_assert_eq!(core::mem::size_of::<Stripe>(), 32);