From 2df731b8d3817de0aab0732cdfccdb9e532b1f96 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 12 Mar 2026 20:14:57 +0100 Subject: [PATCH] block: disk_file: Add PhysicalSize trait Host allocation size for file-backed disk images. Reports actual bytes occupied on the host filesystem. Not every format supports this, e.g. network or memory backed disks. Signed-off-by: Anatol Belski --- block/src/disk_file.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/src/disk_file.rs b/block/src/disk_file.rs index 3f7edfabf..1dbaf1945 100644 --- a/block/src/disk_file.rs +++ b/block/src/disk_file.rs @@ -42,3 +42,9 @@ pub trait DiskSize: Send + Debug { /// Virtual size of the disk image in bytes (reported capacity). fn logical_size(&self) -> BlockResult; } + +/// Host allocation size of a file-backed disk image. +pub trait PhysicalSize: Send + Debug { + /// Actual bytes occupied on the host filesystem. + fn physical_size(&self) -> BlockResult; +}