mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Remove redundant BlockBackend trait
BlockBackend predated the disk_file trait family and only carried logical_size and physical_size, which the disk backends expose through the disk_file traits DiskSize and PhysicalSize. It added no polymorphism while its Read, Write and Seek supertraits forced an unused cursor. Dropping the trait removes the dead code it was keeping alive. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -19,7 +19,6 @@ use self::bat::{BatEntry, VhdxBatError};
|
||||
use self::header::{RegionInfo, RegionTableEntry, VhdxHeader, VhdxHeaderError};
|
||||
use self::io::VhdxIoError;
|
||||
use self::metadata::{DiskSpec, VhdxMetadataError};
|
||||
use crate::BlockBackend;
|
||||
use crate::aligned_file::AlignedFile;
|
||||
|
||||
mod bat;
|
||||
@@ -207,12 +206,8 @@ impl Seek for Vhdx {
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockBackend for Vhdx {
|
||||
fn logical_size(&self) -> result::Result<u64, crate::Error> {
|
||||
Ok(self.virtual_disk_size())
|
||||
}
|
||||
|
||||
fn physical_size(&self) -> result::Result<u64, crate::Error> {
|
||||
impl Vhdx {
|
||||
pub(crate) fn physical_size(&self) -> result::Result<u64, crate::Error> {
|
||||
self.aligned
|
||||
.file()
|
||||
.metadata()
|
||||
|
||||
@@ -22,7 +22,7 @@ pub use internal::{Vhdx, VhdxError};
|
||||
use self::worker::sync::VhdxSync;
|
||||
use crate::async_io::{AsyncIo, BorrowedDiskFd, DiskFileError};
|
||||
use crate::error::{BlockError, BlockErrorKind, BlockResult, ErrorOp};
|
||||
use crate::{BlockBackend, Error, disk_file};
|
||||
use crate::{Error, disk_file};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VhdxDisk {
|
||||
|
||||
Reference in New Issue
Block a user