Skip to main content

MftRecordHeader

Struct MftRecordHeader 

Source
pub struct MftRecordHeader {
Show 13 fields pub signature: [u8; 4], pub usa_offset: u16, pub usa_count: u16, pub lsn: u64, pub sequence_number: u16, pub hard_link_count: u16, pub first_attribute_offset: u16, pub flags: u16, pub used_size: u32, pub allocated_size: u32, pub base_record: u64, pub next_attr_id: u16, pub record_number: u32,
}
Expand description

Parsed MFT file-record-segment header.

Fields§

§signature: [u8; 4]

Record signature: FILE (normal) or BAAD (chkdsk marked it corrupt).

§usa_offset: u16

Byte offset of the Update Sequence Array within the record.

§usa_count: u16

Number of u16 entries in the USA (1 USN + one original per sector).

§lsn: u64

$LogFile sequence number of the last change to this record.

§sequence_number: u16

Reuse counter — incremented each time this record number is reallocated.

§hard_link_count: u16

Number of hard links ($FILE_NAME attributes) to this record.

§first_attribute_offset: u16

Byte offset of the first attribute.

§flags: u16

Record flags (see is_in_use / is_directory).

§used_size: u32

Bytes of the record actually used.

§allocated_size: u32

Bytes allocated to the record (the record size).

§base_record: u64

File reference to the base record (0 when this is the base record).

§next_attr_id: u16

Id to assign to the next attribute added.

§record_number: u32

This record’s own number (Windows XP and later).

Implementations§

Source§

impl MftRecordHeader

Source

pub fn is_in_use(&self) -> bool

true if the record is currently allocated (in use).

Source

pub fn is_directory(&self) -> bool

true if the record describes a directory.

Source

pub fn is_base_record(&self) -> bool

true if this is a base record (not an extension/child record).

Source

pub fn is_corrupt(&self) -> bool

true if chkdsk marked this record corrupt (BAAD signature).

Source

pub fn parse(buf: &[u8]) -> Result<MftRecordHeader>

Parse a record header from the start of a record buffer.

Does not apply the fixup (the header fields all precede the first sector boundary). Validates the FILE/BAAD signature.

§Errors

NtfsError::TooShort if buf is smaller than the header, or NtfsError::BadRecordSignature for an unrecognised signature.

Trait Implementations§

Source§

impl Clone for MftRecordHeader

Source§

fn clone(&self) -> MftRecordHeader

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 MftRecordHeader

Source§

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

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

impl Eq for MftRecordHeader

Source§

impl PartialEq for MftRecordHeader

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for MftRecordHeader

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.