btrfs_no_std/chunk/
stripe.rs

1use {
2    crate::UuidBytes,
3    byteorder::LE,
4    static_assertions::const_assert_eq,
5    zerocopy::{AsBytes, FromBytes, Unaligned, U64},
6};
7
8/// This structure is used to define the backing device storage that compose a
9/// [`Chunk`].
10///
11/// [`Chunk`]: crate::Chunk
12#[derive(Copy, Clone, Debug, Hash, PartialEq, AsBytes, FromBytes, Unaligned)]
13#[repr(C, packed)]
14pub struct Stripe {
15    /// The ID of the device that contains this stripe.
16    pub devid: U64<LE>,
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: U64<LE>,
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);