Skip to main content

FileSizing

Struct FileSizing 

Source
pub struct FileSizing {
    pub logical: u64,
    pub allocated: u64,
    pub unique: Option<u64>,
    pub sharing: Sharing,
    pub inode: InodeId,
    pub nlink: u64,
    pub clone_id: Option<u64>,
    pub clone_refcount: Option<u32>,
}
Expand description

What one file costs, and what dies with it.

Fields§

§logical: u64

Logical length (st_size / ATTR_FILE_DATALENGTH).

§allocated: u64

Allocated bytes, counting shared blocks in full. On platforms without allocation metadata the fallback uses logical length as an estimate.

§unique: Option<u64>

Bytes private to this inode. Unlinking one of several hardlinks does not free them; callers must also account for nlink. None when unsupported.

§sharing: Sharing§inode: InodeId§nlink: u64§clone_id: Option<u64>

Identifies the clone group this file’s blocks belong to, when the platform reports one. IDs are scoped to inode.dev and to the observation; they are not durable content identities.

§clone_refcount: Option<u32>

Live inodes in this file’s clone group, itself included, when the platform reports it (APFS ATTR_CMNEXT_CLONE_REFCNT). At most one means no other file shares these blocks: whatever is not private is held by filesystem snapshots, and is freed once those snapshots go.

Implementations§

Source§

impl FileSizing

Source

pub fn shared(&self) -> Option<u64>

Blocks shared with other inodes, when known.

Source

pub fn snapshot_held(&self) -> Option<u64>

Shared bytes that no other live file holds, only snapshots. None when the platform does not report the clone group’s size, or when the group’s size cannot tell a snapshot from a live file.

APFS counts only the files still in an unmodified clone group. A clone that is written to leaves the group and gets a new clone id, while it keeps sharing every block it did not rewrite. Partly rewriting a clone therefore leaves both files partly shared with a refcount of 1 each. A store blob is never written after it is stored, so a blob that is partly shared was partly rewritten through a live clone, and its shared bytes stay unknown. Appending to a clone leaves the blob fully shared with a refcount of 1, which reads the same as a snapshot and is counted as one (kunobi-ninja/kache#1195).

Source

pub fn frees_nothing(&self) -> bool

True when deleting this file alone reclaims nothing.

Trait Implementations§

Source§

impl Clone for FileSizing

Source§

fn clone(&self) -> Self

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 Copy for FileSizing

Source§

impl Debug for FileSizing

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.