pub struct Chs {
pub cylinder: u16,
pub head: u8,
pub sector: u8,
}Expand description
Decoded CHS (Cylinder-Head-Sector) address.
Fields§
§cylinder: u16§head: u8§sector: u8Implementations§
Source§impl Chs
impl Chs
Sourcepub fn from_bytes(b: [u8; 3]) -> Self
pub fn from_bytes(b: [u8; 3]) -> Self
Decode a 3-byte MBR CHS field.
Byte layout (packed):
byte 0 = head
byte 1 = [cyl_hi(7:6) | sector(5:0)]
byte 2 = cyl_lo(7:0)Sourcepub fn to_lba(
self,
heads_per_cylinder: u8,
sectors_per_track: u8,
) -> Option<u32>
pub fn to_lba( self, heads_per_cylinder: u8, sectors_per_track: u8, ) -> Option<u32>
Convert to an approximate LBA (≤1023 cylinders, ≤255 heads, ≤63 sectors).
Returns None when CHS indicates “not used” (all zeros or all ones).
Sourcepub fn is_unused(self) -> bool
pub fn is_unused(self) -> bool
true when the CHS field is the all-zero “unused” convention.
LBA-only tooling routinely zeroes the CHS fields; this is never an inconsistency.
Sourcepub fn is_overflow_marker(self) -> bool
pub fn is_overflow_marker(self) -> bool
true when the CHS field is the maximum/overflow marker written when a
partition’s start or end exceeds the CHS-addressable range.
The canonical encoding is FE FF FF (head 254, sector 63, cylinder
1023); some tools write FF FF FF (head 255). Both are accepted.
Trait Implementations§
impl Copy for Chs
impl Eq for Chs
impl StructuralPartialEq for Chs
Auto Trait Implementations§
impl Freeze for Chs
impl RefUnwindSafe for Chs
impl Send for Chs
impl Sync for Chs
impl Unpin for Chs
impl UnsafeUnpin for Chs
impl UnwindSafe for Chs
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