Skip to main content

AnomalyKind

Enum AnomalyKind 

Source
#[non_exhaustive]
pub enum AnomalyKind { SuperblockMagicInvalid { offset: u64, bytes: [u8; 4], }, BackupSuperblockDivergence { cg: u32, field: &'static str, primary: u64, backup: u64, offset: u64, }, CgMagicInvalid { cg: u32, found: u32, offset: u64, }, OrphanedInode { inode: u64, nlink: u16, }, ImpossibleGeometry { field: &'static str, value: u64, limit: u64, }, }
Expand description

Classification of a UFS structural-integrity anomaly (F-INTEGRITY). Each variant carries the evidence needed to reproduce the observation.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SuperblockMagicInvalid

The value at the superblock’s fs_magic offset matched neither UFS1 (0x00011954) nor UFS2 (0x19540119) in either byte order — consistent with corruption or a wiped/overwritten superblock. Carries the offending bytes and the byte offset they were read at (fail-loud with the value).

Fields

§offset: u64

Partition byte offset the primary superblock was sought at.

§bytes: [u8; 4]

The four raw bytes found at offset + fs_magic.

§

BackupSuperblockDivergence

A per-cylinder-group backup superblock whose decoded geometry differs from the primary — UFS writes a backup superblock in each cylinder group, so a divergence is consistent with a spliced or edited image.

Fields

§cg: u32

The cylinder group whose backup superblock diverged.

§field: &'static str

The geometry field that differs (e.g. fs_ipg).

§primary: u64

The primary superblock’s value.

§backup: u64

The backup superblock’s (diverging) value.

§offset: u64

Partition byte offset of the backup superblock.

§

CgMagicInvalid

A cylinder-group header whose cg_magic is not 0x00090255 — consistent with corruption or a tampered allocation map. Carries the value found.

Fields

§cg: u32

The cylinder-group index the bad header was found at.

§found: u32

The 32-bit value read at the cg_magic offset.

§offset: u64

Partition byte offset of the cylinder-group header.

§

OrphanedInode

An inode marked ALLOCATED in its cylinder group’s inode bitmap, with di_nlink > 0, that is reachable by NO directory entry from the root — an inode unlinked while still open, or a corruption lead.

Fields

§inode: u64

The absolute inode number.

§nlink: u16

The inode’s di_nlink (link count) — nonzero, yet unreferenced.

§

ImpossibleGeometry

A geometry field beyond what the image can hold — an allocation-bomb / corruption guard. Names the field, the value, and the sane bound.

Fields

§field: &'static str

The offending field name.

§value: u64

The value read from the structure.

§limit: u64

The sane upper bound derived from the image size / spec.

Implementations§

Source§

impl AnomalyKind

Source

pub fn severity(&self) -> Severity

Severity — the single source of truth for this kind.

Source

pub fn code(&self) -> &'static str

Stable machine-readable, scheme-prefixed code.

Source

pub fn note(&self) -> String

Human-readable, “consistent with” note.

Trait Implementations§

Source§

impl Clone for AnomalyKind

Source§

fn clone(&self) -> AnomalyKind

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 AnomalyKind

Source§

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

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

impl Eq for AnomalyKind

Source§

impl PartialEq for AnomalyKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AnomalyKind

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> Same for T

Source§

type Output = T

Should always be Self
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.