pub struct DiskIo2(/* private fields */);
Expand description
The disk I/O 2 protocol.
This protocol provides an extension to the disk I/O protocol to enable non-blocking / asynchronous byte-oriented disk operation.
Implementations§
source§impl DiskIo2
impl DiskIo2
sourcepub fn cancel(&mut self) -> Result
pub fn cancel(&mut self) -> Result
Terminates outstanding asynchronous requests to the device.
§Errors:
uefi::status::DEVICE_ERROR
The device reported an error while performing the cancel operation.
sourcepub unsafe fn read_disk_raw(
&self,
media_id: u32,
offset: u64,
token: Option<NonNull<DiskIo2Token>>,
len: usize,
buffer: *mut u8
) -> Result
pub unsafe fn read_disk_raw( &self, media_id: u32, offset: u64, token: Option<NonNull<DiskIo2Token>>, len: usize, buffer: *mut u8 ) -> Result
Reads bytes from the disk device.
§Arguments:
media_id
- ID of the medium to be read from.offset
- Starting byte offset on the logical block I/O device to read from.token
- Transaction token for asynchronous read.len
- Buffer size.buffer
- Buffer to read into.
§Safety
Because of the asynchronous nature of the disk transaction, manual lifetime tracking is required.
§Errors:
uefi::status::INVALID_PARAMETER
The read request contains device addresses that are not valid for the device.uefi::status::OUT_OF_RESOURCES
The request could not be completed due to a lack of resources.uefi::status::MEDIA_CHANGED
media_id
is not for the current medium.uefi::status::NO_MEDIA
There is no medium in the device.uefi::status::DEVICE_ERROR
The device reported an error while performing the read operation.
sourcepub unsafe fn write_disk_raw(
&mut self,
media_id: u32,
offset: u64,
token: Option<NonNull<DiskIo2Token>>,
len: usize,
buffer: *const u8
) -> Result
pub unsafe fn write_disk_raw( &mut self, media_id: u32, offset: u64, token: Option<NonNull<DiskIo2Token>>, len: usize, buffer: *const u8 ) -> Result
Writes bytes to the disk device.
§Arguments:
media_id
- ID of the medium to write to.offset
- Starting byte offset on the logical block I/O device to write to.token
- Transaction token for asynchronous write.len
- Buffer size.buffer
- Buffer to write from.
§Safety
Because of the asynchronous nature of the disk transaction, manual lifetime tracking is required.
§Errors:
uefi::status::INVALID_PARAMETER
The write request contains device addresses that are not valid for the device.uefi::status::OUT_OF_RESOURCES
The request could not be completed due to a lack of resources.uefi::status::MEDIA_CHANGED
media_id
is not for the current medium.uefi::status::NO_MEDIA
There is no medium in the device.uefi::status::DEVICE_ERROR
The device reported an error while performing the write operation.uefi::status::WRITE_PROTECTED
The device cannot be written to.
sourcepub fn flush_disk(&mut self, token: Option<NonNull<DiskIo2Token>>) -> Result
pub fn flush_disk(&mut self, token: Option<NonNull<DiskIo2Token>>) -> Result
Flushes all modified data to the physical device.
§Arguments:
token
- Transaction token for the asynchronous flush.
§Errors:
uefi::status::OUT_OF_RESOURCES
The request could not be completed due to a lack of resources.uefi::status::MEDIA_CHANGED
The medium in the device has changed since the last access.uefi::status::NO_MEDIA
There is no medium in the device.uefi::status::DEVICE_ERROR
The device reported an error while performing the flush operation.uefi::status::WRITE_PROTECTED
The device cannot be written to.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiskIo2
impl RefUnwindSafe for DiskIo2
impl Send for DiskIo2
impl Sync for DiskIo2
impl Unpin for DiskIo2
impl UnwindSafe for DiskIo2
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