#[non_exhaustive]pub struct ReaderCylinderGroup {
pub cgx: u32,
pub ndblk: u32,
pub niblk: i32,
pub initediblk: u32,
pub iusedoff: u32,
pub freeoff: u32,
pub clusteroff: u32,
}Expand description
Parsed cylinder-group header — the per-group allocation map.
Carries the subset of struct cg P1 needs; #[non_exhaustive] so later
phases add fields without a breaking change. The bitmaps themselves are not
copied here — Self::inosused_off / Self::blksfree_off give the byte
offsets into the header buffer where they live.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cgx: u32cg_cgx — this cylinder group’s index.
ndblk: u32cg_ndblk — number of data blocks in this cylinder group.
niblk: i32cg_niblk — number of inode blocks in this cylinder group.
initediblk: u32cg_initediblk — number of initialized inodes in this cg (UFS2).
iusedoff: u32cg_iusedoff — byte offset (from the header start) of the used-inode
bitmap (cg_inosused).
freeoff: u32cg_freeoff — byte offset (from the header start) of the free-block
bitmap (cg_blksfree).
clusteroff: u32cg_clusteroff — byte offset of the free-cluster bitmap.
Implementations§
Source§impl CylinderGroup
impl CylinderGroup
Sourcepub fn parse(data: &[u8], endian: Endian) -> Result<CylinderGroup, UfsError>
pub fn parse(data: &[u8], endian: Endian) -> Result<CylinderGroup, UfsError>
Parse a cylinder-group header from the start of data (i.e. data
begins at the struct cg header), using the byte order resolved from the
superblock.
§Errors
UfsError::Truncatedifdatais shorter than the header fields.UfsError::BadCgMagicifcg_magic(offset 4) is not0x00090255in the given byte order — the offending value is carried.
Sourcepub fn inosused_off(&self) -> usize
pub fn inosused_off(&self) -> usize
Byte offset (from the header start) of the used-inode bitmap.
Sourcepub fn blksfree_off(&self) -> usize
pub fn blksfree_off(&self) -> usize
Byte offset (from the header start) of the free-block bitmap.
Trait Implementations§
Source§impl Clone for CylinderGroup
impl Clone for CylinderGroup
Source§fn clone(&self) -> CylinderGroup
fn clone(&self) -> CylinderGroup
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more