[][src]Struct mbrman::CHS

pub struct CHS {
    pub cylinder: u16,
    pub head: u8,
    pub sector: u8,
}

A CHS address (cylinder/head/sector)

Fields

cylinder: u16

Cylinder

head: u8

Head

sector: u8

Sector

Methods

impl CHS[src]

pub fn new(cylinder: u16, head: u8, sector: u8) -> CHS[src]

Creates a new CHS address based on input parameters.

Remark

The values entered in input are not checked.

pub fn empty() -> CHS[src]

Creates an empty CHS addressing (0/0/0).

Remark

This is what you need on recent hardware because CHS is never used.

pub fn from_lba_exact(
    lba: u32,
    cylinders: u16,
    heads: u8,
    sectors: u8
) -> Result<CHS>
[src]

Creates a CHS address calculated from the number of cylinders, heads and sectors per track of the hard disk.

Remarks

  • You probably don't need to do this at all! This is only useful if you intend to use partitions that use the CHS addressing. Check the column "Access" of this table on Wikipedia.
  • On old systems, partitions must be aligned on cylinders.

pub fn from_lba_aligned(
    lba: u32,
    cylinders: u16,
    heads: u8,
    sectors: u8
) -> Result<CHS>
[src]

Creates a CHS address, aligned to the nearest cylinder. The cylinder chosen will always be the exact cylinder (if the LBA is exactly at the beginning of a cylinder); or the next cylinder. But it will never choose the previous cylinder.

pub fn to_lba(self, heads: u8, sectors: u8) -> u32[src]

Convert a CHS address to LBA

pub fn is_empty(self) -> bool[src]

Check if the CHS address is empty

Remark

This function does not check if the CHS address is withing range of possible values for a provided hard disk.

pub fn is_valid(self, cylinders: u16, heads: u8, sectors: u8) -> bool[src]

Check if the CHS address is valid and within range of the possible values for the hard disk geometry provided in argument.

Trait Implementations

impl Clone for CHS[src]

impl Copy for CHS[src]

impl Debug for CHS[src]

impl<'de> Deserialize<'de> for CHS[src]

impl PartialEq<CHS> for CHS[src]

impl Serialize for CHS[src]

impl StructuralPartialEq for CHS[src]

Auto Trait Implementations

impl RefUnwindSafe for CHS

impl Send for CHS

impl Sync for CHS

impl Unpin for CHS

impl UnwindSafe for CHS

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.