mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: disk_file: Add Geometry trait
Sector and cluster geometry of a disk image. Returns DiskTopology with a default implementation providing 512B logical and physical block sizes. Formats that probe the underlying device override this. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
2fa877e087
commit
b98a5cc58d
@@ -35,8 +35,8 @@
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
use crate::BlockResult;
|
||||
use crate::async_io::BorrowedDiskFd;
|
||||
use crate::{BlockResult, DiskTopology};
|
||||
|
||||
/// Reported capacity of a disk image.
|
||||
pub trait DiskSize: Send + Debug {
|
||||
@@ -55,3 +55,13 @@ pub trait DiskFd: Send + Debug {
|
||||
/// Borrows the underlying file descriptor.
|
||||
fn fd(&self) -> BorrowedDiskFd<'_>;
|
||||
}
|
||||
|
||||
/// Sector and cluster geometry of a disk image.
|
||||
///
|
||||
/// Default returns `DiskTopology::default()` (512B logical/physical).
|
||||
pub trait Geometry: Send + Debug {
|
||||
/// Returns the disk topology.
|
||||
fn topology(&self) -> DiskTopology {
|
||||
DiskTopology::default()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user