Struct btrfs_no_std::SuperBlock
source · [−]#[repr(C, packed)]pub struct SuperBlock {Show 35 fields
pub csum: [u8; 32],
pub fsid: [u8; 16],
pub bytenr: U64<LE>,
pub flags: U64<LE>,
pub magic: U64<LE>,
pub generation: U64<LE>,
pub root: U64<LE>,
pub chunk_root: U64<LE>,
pub log_root: U64<LE>,
pub log_root_transid: U64<LE>,
pub total_bytes: U64<LE>,
pub bytes_used: U64<LE>,
pub root_dir_objectid: U64<LE>,
pub num_devices: U64<LE>,
pub sectorsize: U32<LE>,
pub nodesize: U32<LE>,
pub leafsize: U32<LE>,
pub stripesize: U32<LE>,
pub sys_chunk_array_size: U32<LE>,
pub chunk_root_generation: U64<LE>,
pub compat_flags: U64<LE>,
pub compat_ro_flags: U64<LE>,
pub incompat_flags: U64<LE>,
pub csum_type: U16<LE>,
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<LE>,
pub uuid_tree_generation: U64<LE>,
pub _reserved: [U64<LE>; 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<LE>
The physical address of this block.
flags: U64<LE>
Flags
magic: U64<LE>
The magic must be equal to "_BHRfS_M"
in ASCII.
generation: U64<LE>
The generation of the superblock. In SSD mode, not all superblocks may be updated, so the latest generation superblock should be used.
root: U64<LE>
The logical address of the root tree’s root.
chunk_root: U64<LE>
The logical address of the chunk tree’s root.
log_root: U64<LE>
The logical address of the log tree’s root.
log_root_transid: U64<LE>
FIXME: find out what this is!
total_bytes: U64<LE>
FIXME: document this!
bytes_used: U64<LE>
root_dir_objectid: U64<LE>
The root directory’s object ID, which is typically 6.
num_devices: U64<LE>
The number of devices the current filesystem spans.
sectorsize: U32<LE>
The size of a sector.
nodesize: U32<LE>
leafsize: U32<LE>
This is currently unused.
stripesize: U32<LE>
sys_chunk_array_size: U32<LE>
The size of sys_chunk_array
found in the superblock.
chunk_root_generation: U64<LE>
compat_flags: U64<LE>
compat_ro_flags: U64<LE>
Only implementations that support these flags can write to the filesystem.
incompat_flags: U64<LE>
Only implementations that support these flags can use the filesystem.
csum_type: U16<LE>
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<LE>
uuid_tree_generation: U64<LE>
_reserved: [U64<LE>; 30]
Reserved for extensibility.
sys_chunk_array: [u8; 2048]
super_roots: [RootBackup; 4]
_unused1: [u8; 565]
Trait Implementations
sourceimpl AsBytes for SuperBlock
impl AsBytes for SuperBlock
sourcefn as_bytes_mut(&mut self) -> &mut [u8] where
Self: FromBytes,
fn as_bytes_mut(&mut self) -> &mut [u8] where
Self: FromBytes,
Gets the bytes of this value mutably. Read more
sourcefn write_to<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self
to bytes
. Read more
sourcefn write_to_prefix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to_prefix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self
to the prefix of bytes
. Read more
sourcefn write_to_suffix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to_suffix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self
to the suffix of bytes
. Read more
sourceimpl Clone for SuperBlock
impl Clone for SuperBlock
sourcefn clone(&self) -> SuperBlock
fn clone(&self) -> SuperBlock
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl FromBytes for SuperBlock
impl FromBytes for SuperBlock
sourcefn read_from<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self
from bytes
. Read more
sourcefn read_from_prefix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from_prefix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self
from the prefix of bytes
. Read more
sourcefn read_from_suffix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from_suffix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self
from the suffix of bytes
. Read more
sourcefn new_zeroed() -> Self
fn new_zeroed() -> Self
Creates an instance of Self
from zeroed bytes.
impl Copy for SuperBlock
impl Unaligned for SuperBlock
Auto Trait Implementations
impl RefUnwindSafe for SuperBlock
impl Send for SuperBlock
impl Sync for SuperBlock
impl Unpin for SuperBlock
impl UnwindSafe for SuperBlock
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more