mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: vhdx: Rename VhdxDiskSync to VhdxDisk
Align with the <Format>Disk wrapper naming convention. VHDx has a single on disk format so no variant suffix is needed. The async backend will be added to VhdxDisk. No functional change. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
45fd51652f
commit
82e1c08e1f
@@ -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<Box<dyn AsyncFullDiskFile>> {
|
||||
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))?,
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Mutex<Vhdx>>,
|
||||
}
|
||||
|
||||
impl VhdxDiskSync {
|
||||
impl VhdxDisk {
|
||||
pub fn new(f: File) -> BlockResult<Self> {
|
||||
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<u64> {
|
||||
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<u64> {
|
||||
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<Box<dyn disk_file::AsyncDiskFile>> {
|
||||
Ok(Box::new(VhdxDiskSync {
|
||||
Ok(Box::new(VhdxDisk {
|
||||
vhdx_file: Arc::clone(&self.vhdx_file),
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user