pub struct BlockIO(/* private fields */);
Expand description
The Block I/O protocol.
Implementations§
source§impl BlockIO
impl BlockIO
sourcepub const fn media(&self) -> &BlockIOMedia
pub const fn media(&self) -> &BlockIOMedia
Pointer for block IO media.
sourcepub fn read_blocks(&self, media_id: u32, lba: Lba, buffer: &mut [u8]) -> Result
pub fn read_blocks(&self, media_id: u32, lba: Lba, buffer: &mut [u8]) -> Result
Read the requested number of blocks from the device.
§Arguments
media_id
- The media ID that the read request is for.lba
- The starting logical block address to read from on the device.buffer
- The target buffer of the read operation
§Errors
uefi::Status::DEVICE_ERROR
The device reported an error while attempting to perform the read operation.uefi::Status::NO_MEDIA
There is no media in the device.uefi::Status::MEDIA_CHANGED
Themedia_id
is not for the current media.uefi::Status::BAD_BUFFER_SIZE
The buffer size parameter is not a multiple of the intrinsic block size of the device.uefi::Status::INVALID_PARAMETER
The read request contains LBAs that are not valid, or the buffer is not on proper alignment.
sourcepub fn write_blocks(&mut self, media_id: u32, lba: Lba, buffer: &[u8]) -> Result
pub fn write_blocks(&mut self, media_id: u32, lba: Lba, buffer: &[u8]) -> Result
Writes the requested number of blocks to the device.
§Arguments
media_id
The media ID that the write request is for.lba
The starting logical block address to be written.buffer
Buffer to be written
§Errors
uefi::Status::WRITE_PROTECTED
The device cannot be written to.uefi::Status::NO_MEDIA
There is no media in the device.uefi::Status::MEDIA_CHANGED
Themedia_id
is not for the current media.uefi::Status::DEVICE_ERROR
The device reported an error while attempting to perform the write operation.uefi::Status::BAD_BUFFER_SIZE
The buffer size parameter is not a multiple of the intrinsic block size of the device.uefi::Status::INVALID_PARAMETER
The write request contains LBAs that are not valid, or the buffer is not on proper alignment.
sourcepub fn flush_blocks(&mut self) -> Result
pub fn flush_blocks(&mut self) -> Result
Flushes all modified data to a physical block device.
§Errors
uefi::Status::DEVICE_ERROR
The device reported an error while attempting to write data.uefi::Status::NO_MEDIA
There is no media in the device.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockIO
impl RefUnwindSafe for BlockIO
impl !Send for BlockIO
impl !Sync for BlockIO
impl Unpin for BlockIO
impl UnwindSafe for BlockIO
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