Struct ext2::inode::InodeBlock
source · #[repr(C)]pub(crate) struct InodeBlock(pub [u8; 60]);
Expand description
Represents 60-byte region for block in Inode. This region is used for various ways depending on the file type. For regular files and directories, it’s used for storing 32-bit indices of blocks.
This is a wrapper of [u8; 60]
to implement Default
manually.
Tuple Fields§
§0: [u8; 60]
Implementations§
source§impl InodeBlock
impl InodeBlock
pub const NUM_DIRECT_BLOCKS: usize = 12usize
const INDIRECT_BLOCK_TABLE_ID: usize = 12usize
const DOUBLE_INDIRECT_BLOCK_TABLE_ID: usize = 13usize
sourcepub fn set_block_id(&mut self, index: usize, block_id: &BlockId) -> Result<()>
pub fn set_block_id(&mut self, index: usize, block_id: &BlockId) -> Result<()>
Set a block id at the given index.
sourcepub fn set_direct_blocks_from(
&mut self,
start_idx: usize,
block_ids: &[BlockId]
) -> Result<()>
pub fn set_direct_blocks_from( &mut self, start_idx: usize, block_ids: &[BlockId] ) -> Result<()>
Set an array of direct block IDs.
sourcepub fn set_direct_blocks(&mut self, block_ids: &[BlockId]) -> Result<()>
pub fn set_direct_blocks(&mut self, block_ids: &[BlockId]) -> Result<()>
Set an array of direct block IDs.
sourcepub fn set_indirect_block_table(&mut self, block_id: &BlockId) -> Result<()>
pub fn set_indirect_block_table(&mut self, block_id: &BlockId) -> Result<()>
Set a block id to be used as the indirect block table.
sourcepub fn set_double_indirect_block_table(
&mut self,
block_id: &BlockId
) -> Result<()>
pub fn set_double_indirect_block_table( &mut self, block_id: &BlockId ) -> Result<()>
Set a block id to be used as the double indirect block table.
sourcepub const fn max_inline_symlink_len() -> usize
pub const fn max_inline_symlink_len() -> usize
Returns the max length of symbolic links that can be stored in the inode data.
This length contains the trailing \0
.
sourcepub fn set_inline_symlink(&mut self, symlink: &str) -> Result<()>
pub fn set_inline_symlink(&mut self, symlink: &str) -> Result<()>
Stores a given string as an inlined symbolic link data.
Trait Implementations§
source§impl AsBytes for InodeBlock
impl AsBytes for InodeBlock
§fn as_bytes_mut(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
fn as_bytes_mut(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
Gets the bytes of this value mutably. Read more
§fn write_to_prefix(&self, bytes: &mut [u8]) -> Option<()>
fn write_to_prefix(&self, bytes: &mut [u8]) -> Option<()>
source§impl Clone for InodeBlock
impl Clone for InodeBlock
source§fn clone(&self) -> InodeBlock
fn clone(&self) -> InodeBlock
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for InodeBlock
impl Debug for InodeBlock
source§impl Default for InodeBlock
impl Default for InodeBlock
source§impl FromBytes for InodeBlock
impl FromBytes for InodeBlock
§fn slice_from_prefix(bytes: &[u8], count: usize) -> Option<(&[Self], &[u8])>where
Self: Sized,
fn slice_from_prefix(bytes: &[u8], count: usize) -> Option<(&[Self], &[u8])>where
Self: Sized,
Interprets the prefix of the given
bytes
as a &[Self]
with length
equal to count
without copying. Read more§fn slice_from_suffix(bytes: &[u8], count: usize) -> Option<(&[u8], &[Self])>where
Self: Sized,
fn slice_from_suffix(bytes: &[u8], count: usize) -> Option<(&[u8], &[Self])>where
Self: Sized,
Interprets the suffix of the given
bytes
as a &[Self]
with length
equal to count
without copying. Read more§fn mut_slice_from_prefix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [Self], &mut [u8])>where
Self: Sized + AsBytes,
fn mut_slice_from_prefix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [Self], &mut [u8])>where
Self: Sized + AsBytes,
Interprets the prefix of the given
bytes
as a &mut [Self]
with length
equal to count
without copying. Read more§fn mut_slice_from_suffix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [u8], &mut [Self])>where
Self: Sized + AsBytes,
fn mut_slice_from_suffix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [u8], &mut [Self])>where
Self: Sized + AsBytes,
Interprets the suffix of the given
bytes
as a &mut [Self]
with length
equal to count
without copying. Read more§fn read_from_prefix(bytes: &[u8]) -> Option<Self>where
Self: Sized,
fn read_from_prefix(bytes: &[u8]) -> Option<Self>where
Self: Sized,
source§impl FromZeroes for InodeBlock
impl FromZeroes for InodeBlock
impl Copy for InodeBlock
Auto Trait Implementations§
impl RefUnwindSafe for InodeBlock
impl Send for InodeBlock
impl Sync for InodeBlock
impl Unpin for InodeBlock
impl UnwindSafe for InodeBlock
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more