Skip to main content

Inode

Struct Inode 

Source
pub struct Inode {
Show 33 fields pub mode: u16, pub uid: u16, pub size_lo: u32, pub atime: u32, pub ctime: u32, pub mtime: u32, pub dtime: u32, pub gid: u16, pub links_count: u16, pub blocks_lo: u32, pub flags: u32, pub version: u32, pub block: [u8; 60], pub generation: u32, pub xattr_block_lo: u32, pub size_hi: u32, pub obsolete_fragment_addr: u32, pub blocks_hi: u16, pub xattr_block_hi: u16, pub uid_hi: u16, pub gid_hi: u16, pub checksum_lo: u16, pub reserved: u16, pub extra_isize: u16, pub checksum_hi: u16, pub ctime_extra: u32, pub mtime_extra: u32, pub atime_extra: u32, pub crtime: u32, pub crtime_extra: u32, pub version_hi: u32, pub projid: u32, pub inline_xattrs: [u8; 96],
}

Fields§

§mode: u16§uid: u16§size_lo: u32§atime: u32§ctime: u32§mtime: u32§dtime: u32§gid: u16§links_count: u16§blocks_lo: u32§flags: u32§version: u32§block: [u8; 60]

60-byte block field: extent tree root or inline symlink data.

§generation: u32§xattr_block_lo: u32§size_hi: u32§obsolete_fragment_addr: u32§blocks_hi: u16§xattr_block_hi: u16§uid_hi: u16§gid_hi: u16§checksum_lo: u16§reserved: u16§extra_isize: u16§checksum_hi: u16§ctime_extra: u32§mtime_extra: u32§atime_extra: u32§crtime: u32§crtime_extra: u32§version_hi: u32§projid: u32§inline_xattrs: [u8; 96]

Inline extended attribute space (fills out to 256 bytes).

Implementations§

Source§

impl Inode

Source

pub const SIZE: usize

Total on-disk size (base 160 + 96 bytes inline xattrs = 256).

Source

pub fn read_from(buf: &[u8]) -> Self

Source

pub fn write_to(&self, buf: &mut [u8])

Source

pub fn root_inode() -> Self

Create the root directory inode (inode 2).

Sets S_IFDIR | 0o755, two links (. and ..), HUGE_FILE flag, and timestamps to the current wall-clock time.

Source

pub fn is_dir(&self) -> bool

True if this inode represents a directory.

Source

pub fn is_reg(&self) -> bool

True if this inode represents a regular file.

True if this inode represents a symbolic link.

Source

pub fn file_size(&self) -> u64

Combine size_lo and size_hi into a 64-bit file size.

Source

pub fn set_file_size(&mut self, size: u64)

Set the 64-bit file size, splitting into size_lo / size_hi.

Source

pub fn uid_full(&self) -> u32

Full 32-bit UID (lo + hi).

Source

pub fn gid_full(&self) -> u32

Full 32-bit GID (lo + hi).

Source

pub fn set_uid(&mut self, uid: u32)

Set the full 32-bit UID, splitting into lo / hi.

Source

pub fn set_gid(&mut self, gid: u32)

Set the full 32-bit GID, splitting into lo / hi.

Trait Implementations§

Source§

impl Clone for Inode

Source§

fn clone(&self) -> Inode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Inode

Source§

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

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

impl Default for Inode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Inode

§

impl RefUnwindSafe for Inode

§

impl Send for Inode

§

impl Sync for Inode

§

impl Unpin for Inode

§

impl UnsafeUnpin for Inode

§

impl UnwindSafe for Inode

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.