Skip to main content

SuperblockV2V3

Struct SuperblockV2V3 

Source
pub struct SuperblockV2V3 {
    pub version: u8,
    pub sizeof_offsets: u8,
    pub sizeof_lengths: u8,
    pub file_consistency_flags: u8,
    pub base_address: u64,
    pub superblock_extension_address: u64,
    pub end_of_file_address: u64,
    pub root_group_object_header_address: u64,
}
Expand description

Superblock v2/v3 structure.

Layout (O = sizeof_offsets):

[0..8]              Signature (8 bytes)
[8]                 Version (1 byte)
[9]                 Size of Offsets (1 byte)
[10]                Size of Lengths (1 byte)
[11]                File Consistency Flags (1 byte)
[12..12+O]          Base Address (O bytes)
[12+O..12+2O]       Superblock Extension Address (O bytes)
[12+2O..12+3O]      End of File Address (O bytes)
[12+3O..12+4O]      Root Group Object Header Address (O bytes)
[12+4O..12+4O+4]    Checksum (4 bytes)

Fields§

§version: u8

Superblock version: 2 or 3.

§sizeof_offsets: u8

Size of file offsets in bytes (typically 8).

§sizeof_lengths: u8

Size of file lengths in bytes (typically 8).

§file_consistency_flags: u8

File consistency flags (see FLAG_* constants).

§base_address: u64

Base address of the file (usually 0).

§superblock_extension_address: u64

Address of the superblock extension object header, or UNDEF.

§end_of_file_address: u64

End-of-file address.

§root_group_object_header_address: u64

Address of the root group object header.

Implementations§

Source§

impl SuperblockV2V3

Source

pub fn encoded_size(&self) -> usize

Returns the total encoded size in bytes: 12 + 4*O + 4 (checksum).

Source

pub fn encode(&self) -> Vec<u8>

Encode the superblock to a byte vector, including the trailing checksum.

Source

pub fn decode(buf: &[u8]) -> FormatResult<Self>

Decode a superblock from a byte buffer. Verifies the signature, version, and checksum. Returns the parsed superblock.

Trait Implementations§

Source§

impl Clone for SuperblockV2V3

Source§

fn clone(&self) -> SuperblockV2V3

Returns a duplicate 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 Debug for SuperblockV2V3

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SuperblockV2V3

Source§

fn eq(&self, other: &SuperblockV2V3) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SuperblockV2V3

Source§

impl StructuralPartialEq for SuperblockV2V3

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.