mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Implement PhysicalSize trait for RawFileDiskAio
Add disk_file::PhysicalSize trait implementation for RawFileDiskAio. Returns the physical size from query_device_size wrapped in BlockError on failure, consistent with the DiskSize impl. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
@@ -78,6 +78,14 @@ impl disk_file::DiskSize for RawFileDiskAio {
|
||||
}
|
||||
}
|
||||
|
||||
impl disk_file::PhysicalSize for RawFileDiskAio {
|
||||
fn physical_size(&self) -> BlockResult<u64> {
|
||||
query_device_size(&self.file)
|
||||
.map(|(_, physical_size)| physical_size)
|
||||
.map_err(|e| BlockError::new(BlockErrorKind::Io, DiskFileError::Size(e)))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RawFileAsyncAio {
|
||||
fd: RawFd,
|
||||
ctx: aio::IoContext,
|
||||
|
||||
Reference in New Issue
Block a user