From 6b14d27f305ab4ba7aef6be082d90e14a8983d17 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Tue, 24 Mar 2026 17:36:03 -0700 Subject: [PATCH] block: Implement Resizable trait for RawFileDiskSync Add disk_file::Resizable trait implementation for RawFileDiskSync. Calls file.set_len(size) and wraps the I/O error in BlockError on failure. Signed-off-by: Muminul Islam --- block/src/raw_sync.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/src/raw_sync.rs b/block/src/raw_sync.rs index 5a6a65b36..59d842deb 100644 --- a/block/src/raw_sync.rs +++ b/block/src/raw_sync.rs @@ -102,6 +102,14 @@ impl disk_file::SparseCapable for RawFileDiskSync { } } +impl disk_file::Resizable for RawFileDiskSync { + fn resize(&mut self, size: u64) -> BlockResult<()> { + self.file + .set_len(size) + .map_err(|e| BlockError::new(BlockErrorKind::Io, DiskFileError::ResizeError(e))) + } +} + pub struct RawFileSync { fd: RawFd, eventfd: EventFd,