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