mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: disk_file: Add DiskFile supertrait
Bundles DiskSize and Geometry as the universal disk capabilities every format must implement. Adds Sync so that Arc<dyn DiskFile> can be shared across threads for concurrent readonly access. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
da1b104493
commit
5d50d64671
@@ -90,3 +90,10 @@ pub trait Resizable: Send + Debug {
|
||||
/// Resizes the disk image to the given size in bytes, if the backend supports it.
|
||||
fn resize(&mut self, size: u64) -> BlockResult<()>;
|
||||
}
|
||||
|
||||
/// Supertrait bundling universal disk capabilities.
|
||||
///
|
||||
/// Every disk format implements `DiskSize` and `Geometry`.
|
||||
/// `Sync` is required so that `Arc<dyn DiskFile>` can be shared
|
||||
/// across threads for concurrent readonly access.
|
||||
pub trait DiskFile: DiskSize + Geometry + Sync {}
|
||||
|
||||
Reference in New Issue
Block a user