diff --git a/block/src/factory.rs b/block/src/factory.rs index ffe65f7d9..eeab50ef8 100644 --- a/block/src/factory.rs +++ b/block/src/factory.rs @@ -23,7 +23,7 @@ use crate::error::{BlockError, BlockErrorKind, BlockResult}; use crate::fixed_vhd_disk::FixedVhdDisk; use crate::qcow_disk::QcowDisk; use crate::raw_disk::{RawBackend, RawDisk}; -use crate::vhdx_sync::VhdxDiskSync; +use crate::vhdx_sync::VhdxDisk; use crate::{ ImageType, block_aio_is_supported, detect_image_type, open_disk_image, preallocate_disk, }; @@ -114,7 +114,7 @@ fn open_vhdx( ) -> BlockResult> { info!("Opening VHDX disk file with synchronous backend"); Ok(Box::new( - VhdxDiskSync::new(file).map_err(|e| e.with_path(options.path))?, + VhdxDisk::new(file).map_err(|e| e.with_path(options.path))?, )) } diff --git a/block/src/vhdx_sync.rs b/block/src/vhdx_sync.rs index bc1598329..5518ab82e 100644 --- a/block/src/vhdx_sync.rs +++ b/block/src/vhdx_sync.rs @@ -21,7 +21,7 @@ use crate::vhdx::{Vhdx, VhdxError}; use crate::{BlockBackend, Error, disk_file}; #[derive(Debug)] -pub struct VhdxDiskSync { +pub struct VhdxDisk { // FIXME: The Mutex serializes all VHDX I/O operations across queues, which // is necessary for correctness but eliminates any parallelism benefit from // multiqueue. Vhdx::clone() shares the underlying file description across @@ -33,9 +33,9 @@ pub struct VhdxDiskSync { vhdx_file: Arc>, } -impl VhdxDiskSync { +impl VhdxDisk { pub fn new(f: File) -> BlockResult { - Ok(VhdxDiskSync { + Ok(VhdxDisk { vhdx_file: Arc::new(Mutex::new(Vhdx::new(f).map_err(|e| { let kind = match &e { VhdxError::NotVhdx(_) @@ -51,13 +51,13 @@ impl VhdxDiskSync { } } -impl disk_file::DiskSize for VhdxDiskSync { +impl disk_file::DiskSize for VhdxDisk { fn logical_size(&self) -> BlockResult { Ok(self.vhdx_file.lock().unwrap().virtual_disk_size()) } } -impl disk_file::PhysicalSize for VhdxDiskSync { +impl disk_file::PhysicalSize for VhdxDisk { fn physical_size(&self) -> BlockResult { self.vhdx_file .lock() @@ -72,17 +72,17 @@ impl disk_file::PhysicalSize for VhdxDiskSync { } } -impl disk_file::DiskFd for VhdxDiskSync { +impl disk_file::DiskFd for VhdxDisk { fn fd(&self) -> BorrowedDiskFd<'_> { BorrowedDiskFd::new(self.vhdx_file.lock().unwrap().as_raw_fd()) } } -impl disk_file::Geometry for VhdxDiskSync {} +impl disk_file::Geometry for VhdxDisk {} -impl disk_file::SparseCapable for VhdxDiskSync {} +impl disk_file::SparseCapable for VhdxDisk {} -impl disk_file::Resizable for VhdxDiskSync { +impl disk_file::Resizable for VhdxDisk { fn resize(&mut self, _size: u64) -> BlockResult<()> { Err(BlockError::new( BlockErrorKind::UnsupportedFeature, @@ -92,11 +92,11 @@ impl disk_file::Resizable for VhdxDiskSync { } } -impl disk_file::DiskFile for VhdxDiskSync {} +impl disk_file::DiskFile for VhdxDisk {} -impl disk_file::AsyncDiskFile for VhdxDiskSync { +impl disk_file::AsyncDiskFile for VhdxDisk { fn try_clone(&self) -> BlockResult> { - Ok(Box::new(VhdxDiskSync { + Ok(Box::new(VhdxDisk { vhdx_file: Arc::clone(&self.vhdx_file), })) }