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

@@ -205,6 +205,13 @@ impl BlockBackend for Vhdx {
fn logical_size(&self) -> std::result::Result<u64, crate::Error> {
Ok(self.virtual_disk_size())
}
fn physical_size(&self) -> std::result::Result<u64, crate::Error> {
self.file
.metadata()
.map(|m| m.len())
.map_err(crate::Error::GetFileMetadata)
}
}
impl Clone for Vhdx {