mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Implement Geometry trait for RawFileDiskAio
Add disk_file::Geometry trait implementation for RawFileDiskAio. Probes disk topology from the file, falling back to defaults on failure. Takes &self instead of &mut self and uses unwrap_or_else for cleaner error handling. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
@@ -92,6 +92,15 @@ impl disk_file::DiskFd for RawFileDiskAio {
|
||||
}
|
||||
}
|
||||
|
||||
impl disk_file::Geometry for RawFileDiskAio {
|
||||
fn topology(&self) -> DiskTopology {
|
||||
DiskTopology::probe(&self.file).unwrap_or_else(|_| {
|
||||
warn!("Unable to get device topology. Using default topology");
|
||||
DiskTopology::default()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RawFileAsyncAio {
|
||||
fd: RawFd,
|
||||
ctx: aio::IoContext,
|
||||
|
||||
Reference in New Issue
Block a user