mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Remove DiskBackend dispatch enum
All disk format backends now implement AsyncFullDiskFile directly. The DiskBackend enum that dispatched between Legacy and Next arms is no longer needed since the factory returns trait objects and vmm no longer constructs format types manually. Replace DiskBackend with Box<dyn AsyncFullDiskFile> in the Block struct and its constructor. Remove the DiskBackend::Next wrapping in device_manager and the fuzz target. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
6b6150ebfc
commit
835caf9413
@@ -20,7 +20,7 @@ use std::{io, result};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use block::async_io::{AsyncIo, AsyncIoError};
|
||||
use block::disk_file::DiskBackend;
|
||||
use block::disk_file::AsyncFullDiskFile;
|
||||
use block::error::BlockError;
|
||||
use block::fcntl::{LockError, LockGranularity, LockGranularityChoice, LockType, get_lock_state};
|
||||
use block::{
|
||||
@@ -713,7 +713,7 @@ impl EpollHelperHandler for BlockEpollHandler {
|
||||
pub struct Block {
|
||||
common: VirtioCommon,
|
||||
id: String,
|
||||
disk_image: DiskBackend,
|
||||
disk_image: Box<dyn AsyncFullDiskFile>,
|
||||
disk_path: PathBuf,
|
||||
disk_nsectors: Arc<AtomicU64>,
|
||||
config: VirtioBlockConfig,
|
||||
@@ -743,7 +743,7 @@ impl Block {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
id: String,
|
||||
mut disk_image: DiskBackend,
|
||||
disk_image: Box<dyn AsyncFullDiskFile>,
|
||||
disk_path: PathBuf,
|
||||
read_only: bool,
|
||||
access_platform_enabled: bool,
|
||||
|
||||
Reference in New Issue
Block a user