From cc2f878094255b7a1dabd077be66dc722edee371 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 24 Mar 2026 15:11:10 +0100 Subject: [PATCH] block: vhd: impl AsyncDiskFile for FixedVhdDiskSync Delegate try_clone() to FixedVhd::clone() and new_async_io() to FixedVhdSync, preserving DiskFileError::NewAsyncIo. Signed-off-by: Anatol Belski --- block/src/fixed_vhd_sync.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/block/src/fixed_vhd_sync.rs b/block/src/fixed_vhd_sync.rs index 92250fc8e..b28ce3868 100644 --- a/block/src/fixed_vhd_sync.rs +++ b/block/src/fixed_vhd_sync.rs @@ -92,6 +92,21 @@ impl disk_file::Resizable for FixedVhdDiskSync { impl disk_file::DiskFile for FixedVhdDiskSync {} +impl disk_file::AsyncDiskFile for FixedVhdDiskSync { + fn try_clone(&self) -> BlockResult> { + Ok(Box::new(FixedVhdDiskSync(self.0.clone()))) + } + + fn new_async_io(&self, _ring_depth: u32) -> BlockResult> { + Ok(Box::new( + FixedVhdSync::new(self.0.as_raw_fd(), self.0.logical_size().unwrap()).map_err(|e| { + BlockError::new(BlockErrorKind::Io, DiskFileError::NewAsyncIo(e)) + .with_op(ErrorOp::Open) + })?, + )) + } +} + pub struct FixedVhdSync { raw_file_sync: RawFileSync, size: u64,