block: disk_file: Add Resizable trait

Live disk resize support. Single method resize() taking
&mut self and the new size in bytes. Implementations may
return an error if the backend does not support resizing.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-03-12 20:25:01 +01:00
committed by Rob Bradford
parent a0a5718b42
commit da1b104493

View File

@@ -81,3 +81,12 @@ pub trait SparseCapable: Send + Debug {
false
}
}
/// Live disk resize support.
///
/// Implementations may return an error if the backend does not
/// support resizing (e.g. fixed size formats).
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<()>;
}