block: add DiskFile::physical_size()

This is a pre-requisite for the bug fix in the following commit.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-12-12 09:07:44 +01:00
committed by Rob Bradford
parent 53092359b4
commit 603b5e862c
14 changed files with 90 additions and 2 deletions

View File

@@ -58,10 +58,12 @@ impl AsRawFd for BorrowedDiskFd<'_> {
pub trait DiskFile: Send {
/// Returns the logical disk size a guest will see.
///
/// For raw formats, this is equal to the physical size. For file formats
/// For raw formats, this is equal to [`Self::physical_size`]. For file formats
/// that wrap disk images in a container (e.g. QCOW2), this refers to the
/// effective size that the guest will see.
fn logical_size(&mut self) -> DiskFileResult<u64>;
/// Returns the physical size of the underlying file.
fn physical_size(&mut self) -> DiskFileResult<u64>;
fn new_async_io(&self, ring_depth: u32) -> DiskFileResult<Box<dyn AsyncIo>>;
fn topology(&mut self) -> DiskTopology {
DiskTopology::default()