From 9973d28849018e8d98e1971a7a8bebaf66c8e9af Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Fri, 20 Dec 2024 05:17:03 +0000 Subject: [PATCH] block: drop unused function create_disk_file Signed-off-by: Wei Liu --- block/src/lib.rs | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/block/src/lib.rs b/block/src/lib.rs index 8f70805cc..d7b6f5952 100644 --- a/block/src/lib.rs +++ b/block/src/lib.rs @@ -59,9 +59,7 @@ use vmm_sys_util::eventfd::EventFd; use vmm_sys_util::{aio, ioctl_io_nr, ioctl_ioc_nr}; use crate::async_io::{AsyncIo, AsyncIoError, AsyncIoResult}; -use crate::fixed_vhd::FixedVhd; -use crate::qcow::{QcowFile, RawFile}; -use crate::vhdx::{Vhdx, VhdxError}; +use crate::vhdx::VhdxError; const SECTOR_SHIFT: u8 = 9; pub const SECTOR_SIZE: u64 = 0x01 << SECTOR_SHIFT; @@ -793,25 +791,6 @@ pub trait BlockBackend: Read + Write + Seek + Send + Debug { fn size(&self) -> Result; } -/// Inspect the image file type and create an appropriate disk file to match it. -pub fn create_disk_file(mut file: File, direct_io: bool) -> Result, Error> { - let image_type = detect_image_type(&mut file).map_err(Error::DetectImageType)?; - - Ok(match image_type { - ImageType::Qcow2 => { - Box::new(QcowFile::from(RawFile::new(file, direct_io)).map_err(Error::QcowError)?) - as Box - } - ImageType::FixedVhd => { - Box::new(FixedVhd::new(file).map_err(Error::FixedVhdError)?) as Box - } - ImageType::Vhdx => { - Box::new(Vhdx::new(file).map_err(Error::VhdxError)?) as Box - } - ImageType::Raw => Box::new(RawFile::new(file, direct_io)) as Box, - }) -} - #[derive(Debug)] pub struct DiskTopology { pub logical_block_size: u64,