Skip to main content

NxSuperblock

Struct NxSuperblock 

Source
#[non_exhaustive]
pub struct NxSuperblock {
Show 13 fields pub xid: u64, pub uuid: [u8; 16], pub block_size: u32, pub block_count: u64, pub incompatible_features: u64, pub xp_desc_base: u64, pub xp_desc_blocks: u32, pub xp_data_base: u64, pub xp_data_blocks: u32, pub omap_oid: u64, pub spaceman_oid: u64, pub reaper_oid: u64, pub fs_oids: Vec<u64>, /* private fields */
}
Expand description

A parsed container superblock (subset; #[non_exhaustive] for additive growth).

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§xid: u64

Transaction id of this superblock (nx_o.o_xid).

§uuid: [u8; 16]

Container UUID (nx_uuid).

§block_size: u32

nx_block_size — the authoritative block size (never assumed).

§block_count: u64

nx_block_count.

§incompatible_features: u64

nx_incompatible_features — feature bits a reader must understand to mount safely (e.g. NX_INCOMPAT_FUSION); an unrecognised bit means the image cannot be read correctly.

§xp_desc_base: u64

Checkpoint descriptor-area base (nx_xp_desc_base) — a block address when contiguous, or a B-tree oid when Self::xp_desc_is_tree.

§xp_desc_blocks: u32

Checkpoint descriptor-area length in blocks (nx_xp_desc_blocks, flag bit already masked off).

§xp_data_base: u64

Checkpoint data-area base (nx_xp_data_base).

§xp_data_blocks: u32

Checkpoint data-area length in blocks (nx_xp_data_blocks, flag bit masked).

§omap_oid: u64

Container object-map oid (nx_omap_oid).

§spaceman_oid: u64

Space-manager ephemeral oid (nx_spaceman_oid) — resolve to a paddr via the checkpoint map.

§reaper_oid: u64

Reaper ephemeral oid (nx_reaper_oid) — resolve to a paddr via the checkpoint map.

§fs_oids: Vec<u64>

Volume oids (nx_fs_oid[]), one per APSB volume (trailing zeros trimmed).

Implementations§

Source§

impl NxSuperblock

Source

pub fn parse(block: &[u8]) -> Result<Self>

Parse and validate an NXSB from a block (checks magic + checksum).

§Errors

crate::ApfsError::NoValidSuperblock on a short block or bad magic (carrying the offending magic value); crate::ApfsError::ChecksumMismatch on a Fletcher-64 failure (carrying both the stored and computed checksums).

Source

pub fn xp_desc_is_tree(&self) -> bool

Whether the checkpoint descriptor area is stored as a B-tree (high bit of nx_xp_desc_blocks set) rather than a contiguous run. A contiguous area can be walked directly; a tree-backed one needs B-tree resolution (P2).

Source

pub fn xp_data_is_tree(&self) -> bool

Whether the checkpoint data area is stored as a B-tree.

Trait Implementations§

Source§

impl Clone for NxSuperblock

Source§

fn clone(&self) -> NxSuperblock

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NxSuperblock

Source§

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

Formats the value using the given formatter. Read more

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.