pub struct Superblock {
pub magic: [u8; 4],
pub version: u32,
pub root_inode: InodeId,
pub next_inode: InodeId,
pub next_block: BlockId,
pub total_inodes: u64,
pub total_blocks: u64,
pub block_size: u32,
pub created_us: u64,
pub mounted_us: u64,
pub label: String,
}Expand description
Superblock - filesystem metadata
Fields§
§magic: [u8; 4]Magic number for identification
version: u32Filesystem version
root_inode: InodeIdRoot inode number
next_inode: InodeIdNext free inode number
next_block: BlockIdNext free block number
total_inodes: u64Total inodes allocated
total_blocks: u64Total blocks used
block_size: u32Block size in bytes
created_us: u64Creation time
mounted_us: u64Last mount time
label: StringFilesystem label
Implementations§
Source§impl Superblock
impl Superblock
pub const MAGIC: [u8; 4]
pub const VERSION: u32 = 1
pub const DEFAULT_BLOCK_SIZE: u32 = 4096
pub fn new(label: impl Into<String>) -> Self
Sourcepub fn alloc_inode(&mut self) -> InodeId
pub fn alloc_inode(&mut self) -> InodeId
Allocate a new inode number
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, String>
pub fn from_bytes(data: &[u8]) -> Result<Self, String>
Deserialize from bytes
Trait Implementations§
Source§impl Clone for Superblock
impl Clone for Superblock
Source§fn clone(&self) -> Superblock
fn clone(&self) -> Superblock
Returns a duplicate 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 Superblock
impl Debug for Superblock
Source§impl<'de> Deserialize<'de> for Superblock
impl<'de> Deserialize<'de> for Superblock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Superblock
impl RefUnwindSafe for Superblock
impl Send for Superblock
impl Sync for Superblock
impl Unpin for Superblock
impl UnwindSafe for Superblock
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more