Skip to main content

BiosDisk

Trait BiosDisk 

Source
pub trait BiosDisk {
    // Required methods
    fn sectors(&self) -> u64;
    fn read_sector(&mut self, sector: u64, out: &mut [u8; 512]) -> bool;

    // Provided method
    fn write_sector(&mut self, sector: u64, data: &[u8; 512]) -> bool { ... }
}
Expand description

Synthetic block-device access used by INT 13h.

Sector numbers are linear block addresses. A read-only medium (the default) keeps INT 13h AH=03/AH=43h reporting write-protected; a backend that can persist writes overrides BiosDisk::write_sector.

Required Methods§

Source

fn sectors(&self) -> u64

Number of 512-byte sectors available.

Source

fn read_sector(&mut self, sector: u64, out: &mut [u8; 512]) -> bool

Reads one sector into out. Returns false on a backend error.

Provided Methods§

Source

fn write_sector(&mut self, sector: u64, data: &[u8; 512]) -> bool

Writes one sector from data.

The default implementation reports a read-only medium.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§