From c0db1f61ac82ed7f16e5bdf11f3cca2b860e4497 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 24 Mar 2026 17:11:02 +0100 Subject: [PATCH] block: vhd: impl AsyncDiskFile for FixedVhdDiskAsync Delegate try_clone() to FixedVhd::clone() and new_async_io() to FixedVhdAsync, preserving DiskFileError::NewAsyncIo. Signed-off-by: Anatol Belski --- block/src/fixed_vhd_async.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/block/src/fixed_vhd_async.rs b/block/src/fixed_vhd_async.rs index 8f6b37db1..9b768f80c 100644 --- a/block/src/fixed_vhd_async.rs +++ b/block/src/fixed_vhd_async.rs @@ -90,6 +90,26 @@ impl disk_file::Resizable for FixedVhdDiskAsync { impl disk_file::DiskFile for FixedVhdDiskAsync {} +impl disk_file::AsyncDiskFile for FixedVhdDiskAsync { + fn try_clone(&self) -> BlockResult> { + Ok(Box::new(FixedVhdDiskAsync(self.0.clone()))) + } + + fn new_async_io(&self, ring_depth: u32) -> BlockResult> { + Ok(Box::new( + FixedVhdAsync::new( + self.0.as_raw_fd(), + ring_depth, + self.0.logical_size().unwrap(), + ) + .map_err(|e| { + BlockError::new(BlockErrorKind::Io, DiskFileError::NewAsyncIo(e)) + .with_op(ErrorOp::Open) + })?, + )) + } +} + pub struct FixedVhdAsync { raw_file_async: RawFileAsync, size: u64,