Struct SuperBlock

Source
#[repr(C, packed(1))]
pub struct SuperBlock {
Show 35 fields pub csum: [u8; 32], pub fsid: [u8; 16], pub bytenr: U64, pub flags: U64, pub magic: U64, pub generation: U64, pub root: U64, pub chunk_root: U64, pub log_root: U64, pub log_root_transid: U64, pub total_bytes: U64, pub bytes_used: U64, pub root_dir_objectid: U64, pub num_devices: U64, pub sectorsize: U32, pub nodesize: U32, pub leafsize: U32, pub stripesize: U32, pub sys_chunk_array_size: U32, pub chunk_root_generation: U64, pub compat_flags: U64, pub compat_ro_flags: U64, pub incompat_flags: U64, pub csum_type: ChecksumType, pub root_level: u8, pub chunk_root_level: u8, pub log_root_level: u8, pub dev_item: DevItem, pub label: [u8; 256], pub cache_generation: U64, pub uuid_tree_generation: U64, pub _reserved: [U64; 30], pub sys_chunk_array: [u8; 2048], pub super_roots: [RootBackup; 4], pub _unused1: [u8; 565],
}
Expand description

The layout of the superblock. A valid superblock must exist for most btrfs implementations to mount the filesystem.

The primary superblock is located at PRIMARY_SUPERBLOCK_ADDR.

There are additional copies of the superblock located at SUPERBLOCK_ADDRS, if those addresses are valid, respectively.

§Resources

Fields§

§csum: [u8; 32]

Checksum of everything past this field.

§fsid: [u8; 16]

Filesystem UUID.

§bytenr: U64

The physical address of this block.

§flags: U64

Flags

§magic: U64

The magic must be equal to "_BHRfS_M" in ASCII.

§generation: U64

The generation of the superblock. In SSD mode, not all superblocks may be updated, so the latest generation superblock should be used.

§root: U64

The logical address of the root tree’s root.

§chunk_root: U64

The logical address of the chunk tree’s root.

§log_root: U64

The logical address of the log tree’s root.

§log_root_transid: U64

FIXME: find out what this is!

§total_bytes: U64

FIXME: document this!

§bytes_used: U64§root_dir_objectid: U64

The root directory’s object ID, which is typically 6.

§num_devices: U64

The number of devices the current filesystem spans.

§sectorsize: U32

The size of a sector.

§nodesize: U32§leafsize: U32

This is currently unused.

§stripesize: U32§sys_chunk_array_size: U32

The size of sys_chunk_array found in the superblock.

§chunk_root_generation: U64§compat_flags: U64§compat_ro_flags: U64

Only implementations that support these flags can write to the filesystem.

§incompat_flags: U64

Only implementations that support these flags can use the filesystem.

§csum_type: ChecksumType

The checksum type.

This should correspond with a value from ChecksumType.

§root_level: u8§chunk_root_level: u8§log_root_level: u8§dev_item: DevItem§label: [u8; 256]

The label represented as a null-terminated UTF-8 string. May not contain '/' or '\\'.

§cache_generation: U64§uuid_tree_generation: U64§_reserved: [U64; 30]

Reserved for extensibility.

§sys_chunk_array: [u8; 2048]§super_roots: [RootBackup; 4]§_unused1: [u8; 565]

Trait Implementations§

Source§

impl Clone for SuperBlock

Source§

fn clone(&self) -> SuperBlock

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl KnownLayout for SuperBlock
where [u8; 565]: KnownLayout,

Source§

type PointerMetadata = <[u8; 565] as KnownLayout>::PointerMetadata

The type of metadata stored in a pointer to Self. Read more
Source§

impl TryFromBytes for SuperBlock

Source§

fn try_mut_from_bytes( bytes: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the given source as a &mut Self without copying. Read more
Source§

fn try_mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self. Read more
Source§

fn try_mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self. Read more
Source§

fn try_mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
Source§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
Source§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more
Source§

impl Copy for SuperBlock

Source§

impl IntoBytes for SuperBlock

Source§

impl Unaligned for SuperBlock

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.