Struct ata::AtaDrive

source ·
pub struct AtaDrive { /* private fields */ }
Expand description

A single ATA drive, either a master or a slave, which sits on one of two buses within a larger IDE controller.

Implementations§

source§

impl AtaDrive

source

pub fn read_pio( &mut self, buffer: &mut [u8], offset_in_sectors: usize ) -> Result<usize, &'static str>

Reads data from this drive starting at the given offset_in_sectors into the provided buffer. The length of the given buffer determines the number of bytes to be written.

As content is read from the drive at sector granularity, the buffer length must be a multiple of the sector size (512 bytes), and the offset is specified in number of sectors (not number of bytes) from the beginning of the drive.

Returns the number of sectors (not bytes) that were successfully written to the drive.

Note

This is slow, as it uses blocking port I/O instead of DMA.

source

pub fn write_pio( &mut self, buffer: &[u8], offset_in_sectors: usize ) -> Result<usize, &'static str>

Writes data from the provided buffer to this drive, starting at the given offset_in_sectors into the drive. The length of the given buffer determines the number of bytes to be written.

As content is written to the drive at sector granularity, the buffer length must be a multiple of the sector size (512 bytes), and the offset is specified in number of sectors (not number of bytes) from the beginning of the drive.

Returns the number of sectors (not bytes) that were successfully written to the drive.

Note

This is slow, as it uses blocking port I/O instead of DMA.

source

pub fn is_master(&self) -> bool

Returns true if this drive is the master, or false if it is the slave on the IDE controller bus.

Trait Implementations§

source§

impl BlockIo for AtaDrive

source§

fn block_size(&self) -> usize

Returns the size in bytes of a single block (i.e., sector), the minimum granularity of I/O transfers.
source§

impl BlockReader for AtaDrive

source§

fn read_blocks( &mut self, buffer: &mut [u8], block_offset: usize ) -> Result<usize, IoError>

Reads blocks of data from this reader into the given buffer. Read more
source§

impl BlockWriter for AtaDrive

source§

fn write_blocks( &mut self, buffer: &[u8], block_offset: usize ) -> Result<usize, IoError>

Writes blocks of data from the given buffer to this writer. Read more
source§

fn flush(&mut self) -> Result<(), IoError>

Flushes this entire writer’s output stream, ensuring all contents in intermediate buffers are fully written out.
source§

impl Debug for AtaDrive

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl KnownLength for AtaDrive

source§

fn len(&self) -> usize

Returns the length (size in bytes) of this I/O stream or device.
source§

impl StorageDevice for AtaDrive

source§

fn size_in_blocks(&self) -> usize

Returns the total size of this device, given in number of blocks (sectors).

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.