Skip to main content

ApfsVolume

Struct ApfsVolume 

Source
#[non_exhaustive]
pub struct ApfsVolume { /* private fields */ }
Expand description

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

The fs-tree navigation entry points (Self::root_tree_oid / Self::omap_oid) are consumed by crate::dir for name→inode path resolution.

Implementations§

Source§

impl ApfsVolume

Source

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

Parse and validate an APSB block (magic-by-type + signature + Fletcher-64 checksum) before trusting any field.

§Errors

crate::ApfsError::UnexpectedObjectType on a short block, a non-FS object type, or a wrong apfs_magic signature (carrying the offending value); crate::ApfsError::ChecksumMismatch on a Fletcher-64 failure.

Source

pub fn oid(&self) -> u64

The volume superblock object id (nx_o.o_oid).

Source

pub fn xid(&self) -> u64

The transaction id of this volume superblock (nx_o.o_xid). Used as the xid for resolving virtual fs-tree oids through the volume omap.

Source

pub fn fs_index(&self) -> u32

apfs_fs_index — this volume’s index within the container’s nx_fs_oid[].

Source

pub fn features(&self) -> u64

apfs_features — compatible feature flags.

Source

pub fn readonly_compatible_features(&self) -> u64

apfs_readonly_compatible_features — read-only-compatible feature flags.

Source

pub fn incompatible_features(&self) -> u64

apfs_incompatible_features — incompatible feature flags (the case-insensitivity / normalization bits affect directory-name matching).

Source

pub fn root_tree_type(&self) -> u32

apfs_root_tree_type — the storage-flag + object-type word of the file-system root tree (the root tree is virtual, so its high bits carry the virtual storage flag).

Source

pub fn omap_oid(&self) -> u64

apfs_omap_oid — the block address of this volume’s object map (omap_phys_t, a physical object). The fs-tree’s virtual oids resolve through this omap.

Source

pub fn with_omap_oid(self, omap_oid: u64) -> Self

Return this volume superblock with its omap_oid replaced.

A snapshot’s frozen apfs_superblock_t carries apfs_omap_oid == 0: snapshots have no object map of their own and are read through the live volume’s omap, resolved at the snapshot’s xid (the omap B-tree retains historical (oid, xid) → paddr mappings that snapshots pin). A point-in-time view therefore keeps the frozen superblock’s root_tree_oid and xid but borrows the live volume’s omap. See crate::snapshot::mount_snapshot.

Source

pub fn root_tree_oid(&self) -> u64

apfs_root_tree_oid — the virtual oid of the file-system tree root (FSTREE). Resolve it through the volume omap (Self::omap_oid) at Self::xid to get the root node’s physical block address.

Source

pub fn extentref_tree_oid(&self) -> u64

apfs_extentref_tree_oid — the extent-reference tree oid.

Source

pub fn snap_meta_tree_oid(&self) -> u64

apfs_snap_meta_tree_oid — the snapshot-metadata tree oid.

Source

pub fn uuid(&self) -> [u8; 16]

apfs_vol_uuid — the volume UUID.

Source

pub fn fs_flags(&self) -> u64

apfs_fs_flags — volume flags (e.g. encryption state bits).

Source

pub fn name(&self) -> &str

The volume name (apfs_volname).

Trait Implementations§

Source§

impl Clone for ApfsVolume

Source§

fn clone(&self) -> ApfsVolume

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 ApfsVolume

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.