Skip to main content

Dnode

Struct Dnode 

Source
pub struct Dnode {
Show 16 fields pub dn_type: u8, pub dn_indblkshift: u8, pub dn_nlevels: u8, pub dn_nblkptr: u8, pub dn_bonustype: u8, pub dn_checksum: u8, pub dn_compress: u8, pub dn_flags: u8, pub dn_datablkszsec: u16, pub dn_bonuslen: u16, pub dn_extra_slots: u8, pub dn_maxblkid: u64, pub dn_used: u64, pub endian: Endian, pub blkptrs: Vec<Blkptr>, pub bonus: Vec<u8>,
}
Expand description

A parsed dnode_phys_t.

Fields§

§dn_type: u8

dn_type — DMU object type (raw; map via DmuType::from_raw).

§dn_indblkshift: u8

dn_indblkshift — log2 of the indirect block size in bytes.

§dn_nlevels: u8

dn_nlevels — indirection depth (1 = dn_blkptr point at data blocks).

§dn_nblkptr: u8

dn_nblkptr — number of block pointers in dn_blkptr[].

§dn_bonustype: u8

dn_bonustype — type of data in the bonus buffer.

§dn_checksum: u8

dn_checksum — ZIO checksum type for this object’s blocks.

§dn_compress: u8

dn_compress — ZIO compression type for this object’s blocks.

§dn_flags: u8

dn_flags — DNODE_FLAG_*.

§dn_datablkszsec: u16

dn_datablkszsec — data block size in 512-byte sectors.

§dn_bonuslen: u16

dn_bonuslen — length of the bonus buffer in bytes.

§dn_extra_slots: u8

dn_extra_slots — subsequent 512-byte slots this dnode consumes.

§dn_maxblkid: u64

dn_maxblkid — largest allocated block id (object spans blocks 0..=max).

§dn_used: u64

dn_used — disk space used, in bytes or sectors (see DNODE_FLAG_USED_BYTES).

§endian: Endian

The on-disk byte order this dnode (and its block tree) is written in.

§blkptrs: Vec<Blkptr>

The decoded top-level block pointers (dn_blkptr[0..dn_nblkptr], capped at the physical maximum that fits the dnode’s slots).

§bonus: Vec<u8>

The bonus buffer bytes (dn_bonus[0..dn_bonuslen]), if present.

Implementations§

Source§

impl Dnode

Source

pub fn data_block_size(&self) -> usize

Data block size in bytes (dn_datablkszsec << 9).

Source

pub fn indirect_block_size(&self) -> usize

Indirect block size in bytes (1 << dn_indblkshift), the number of L(n) block pointers per indirect block being indirect_block_size / 128.

Source

pub fn blkptr(&self, i: usize) -> Option<&Blkptr>

A top-level block pointer by index, if present.

Source

pub fn parse(raw: &[u8], endian: Endian) -> Option<Self>

Parse a dnode_phys_t from raw (at least 512 bytes), in endian order.

Returns None only if raw is shorter than the 64-byte core; a dnode with dn_type == DMU_OT_NONE still parses (it is a valid empty slot).

Trait Implementations§

Source§

impl Clone for Dnode

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 Debug for Dnode

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Dnode

§

impl Freeze for Dnode

§

impl Move for Dnode

§

impl RefUnwindSafe for Dnode

§

impl Send for Dnode

§

impl Sync for Dnode

§

impl Unpin for Dnode

§

impl UnsafeUnpin for Dnode

§

impl UnwindSafe for Dnode

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

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.