pub struct UefiBlockIo {
protocol: *mut BlockIoProtocol,
block_size: BlockSize,
num_blocks: u64,
}Expand description
Wrapper around UEFI BlockIoProtocol implementing gpt_disk_io::BlockIo
Fields§
§protocol: *mut BlockIoProtocol§block_size: BlockSize§num_blocks: u64Implementations§
Source§impl UefiBlockIo
impl UefiBlockIo
Sourcepub unsafe fn new(protocol: *mut BlockIoProtocol) -> Self
pub unsafe fn new(protocol: *mut BlockIoProtocol) -> Self
Sourcepub fn protocol(&self) -> *mut BlockIoProtocol
pub fn protocol(&self) -> *mut BlockIoProtocol
Get the underlying protocol pointer
Sourcepub fn block_size_bytes(&self) -> u32
pub fn block_size_bytes(&self) -> u32
Get block size as u32
Sourcepub fn total_blocks(&self) -> u64
pub fn total_blocks(&self) -> u64
Get total number of blocks
Trait Implementations§
Source§impl BlockIo for UefiBlockIo
impl BlockIo for UefiBlockIo
Source§type Error = UefiBlockIoError
type Error = UefiBlockIoError
IO error type.
Source§fn block_size(&self) -> BlockSize
fn block_size(&self) -> BlockSize
Get the [
BlockSize]. The return value is not allowed to
change.Source§fn num_blocks(&mut self) -> Result<u64, Self::Error>
fn num_blocks(&mut self) -> Result<u64, Self::Error>
Get the number of logical blocks in the disk. Read more
Source§fn read_blocks(
&mut self,
start_lba: Lba,
buffer: &mut [u8],
) -> Result<(), Self::Error>
fn read_blocks( &mut self, start_lba: Lba, buffer: &mut [u8], ) -> Result<(), Self::Error>
Read contiguous blocks from the disk. The
dst buffer size must
be a multiple of block_size. Implementations are permitted
to panic if this precondition is not met, e.g. by calling
[BlockSize::assert_valid_block_buffer].Source§fn write_blocks(
&mut self,
start_lba: Lba,
buffer: &[u8],
) -> Result<(), Self::Error>
fn write_blocks( &mut self, start_lba: Lba, buffer: &[u8], ) -> Result<(), Self::Error>
Write contiguous block to the disk. The
src buffer size must
be a multiple of block_size. Implementations are permitted
to panic if this precondition is not met, e.g. by calling
[BlockSize::assert_valid_block_buffer]. Read moreAuto Trait Implementations§
impl Freeze for UefiBlockIo
impl RefUnwindSafe for UefiBlockIo
impl !Send for UefiBlockIo
impl !Sync for UefiBlockIo
impl Unpin for UefiBlockIo
impl UnwindSafe for UefiBlockIo
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