mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: disk_file: Add DiskSize trait
Reported capacity of a disk image. Every format, be it file backed, network, memory, exposes a logical size. Single method logical_size() returning the virtual size in bytes. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
a15bfcfee6
commit
85e4e5027c
@@ -32,3 +32,13 @@
|
||||
//!
|
||||
//! Readonly accessors take `&self`. Only [`Resizable::resize`] requires
|
||||
//! `&mut self`. Errors are returned as [`BlockResult`].
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
use crate::BlockResult;
|
||||
|
||||
/// Reported capacity of a disk image.
|
||||
pub trait DiskSize: Send + Debug {
|
||||
/// Virtual size of the disk image in bytes (reported capacity).
|
||||
fn logical_size(&self) -> BlockResult<u64>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user