block: vhdx: Switch VhdxDiskSync::new to BlockResult

Wrap VhdxError via BlockError::new(Io, e).with_op(Open). Update VMM
CreateFixedVhdxDiskSync error variant from VhdxError to BlockError.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-03-25 15:19:19 +01:00
committed by Bo Chen
parent 019aa52830
commit b8b32f5927
2 changed files with 8 additions and 5 deletions

View File

@@ -12,7 +12,8 @@ use vmm_sys_util::eventfd::EventFd;
use crate::async_io::{
AsyncIo, AsyncIoError, AsyncIoResult, BorrowedDiskFd, DiskFile, DiskFileError, DiskFileResult,
};
use crate::vhdx::{Result as VhdxResult, Vhdx};
use crate::error::{BlockError, BlockErrorKind, BlockResult, ErrorOp};
use crate::vhdx::Vhdx;
use crate::{AsyncAdaptor, BlockBackend, Error};
pub struct VhdxDiskSync {
@@ -28,9 +29,11 @@ pub struct VhdxDiskSync {
}
impl VhdxDiskSync {
pub fn new(f: File) -> VhdxResult<Self> {
pub fn new(f: File) -> BlockResult<Self> {
Ok(VhdxDiskSync {
vhdx_file: Arc::new(Mutex::new(Vhdx::new(f)?)),
vhdx_file: Arc::new(Mutex::new(Vhdx::new(f).map_err(|e| {
BlockError::new(BlockErrorKind::Io, e).with_op(ErrorOp::Open)
})?)),
})
}
}