mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: raw: Rename RawFileAsync to RawAsync
Apply the consistent <Format><Backend> naming convention. No functional change. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
6279214dff
commit
ac3c53cebb
@@ -10,16 +10,16 @@ use vmm_sys_util::eventfd::EventFd;
|
|||||||
|
|
||||||
use crate::async_io::{AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult};
|
use crate::async_io::{AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult};
|
||||||
use crate::error::BlockResult;
|
use crate::error::BlockResult;
|
||||||
use crate::raw_async::RawFileAsync;
|
use crate::raw_async::RawAsync;
|
||||||
|
|
||||||
pub struct FixedVhdAsync {
|
pub struct FixedVhdAsync {
|
||||||
raw_file_async: RawFileAsync,
|
raw_file_async: RawAsync,
|
||||||
size: u64,
|
size: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FixedVhdAsync {
|
impl FixedVhdAsync {
|
||||||
pub fn new(fd: RawFd, ring_depth: u32, size: u64) -> BlockResult<Self> {
|
pub fn new(fd: RawFd, ring_depth: u32, size: u64) -> BlockResult<Self> {
|
||||||
let raw_file_async = RawFileAsync::new(fd, ring_depth)?;
|
let raw_file_async = RawAsync::new(fd, ring_depth)?;
|
||||||
|
|
||||||
Ok(FixedVhdAsync {
|
Ok(FixedVhdAsync {
|
||||||
raw_file_async,
|
raw_file_async,
|
||||||
|
|||||||
@@ -16,20 +16,20 @@ use crate::error::{BlockError, BlockErrorKind, BlockResult};
|
|||||||
use crate::sparse::{blkdiscard, blkzeroout};
|
use crate::sparse::{blkdiscard, blkzeroout};
|
||||||
use crate::{SECTOR_SIZE, is_block_device};
|
use crate::{SECTOR_SIZE, is_block_device};
|
||||||
|
|
||||||
pub struct RawFileAsync {
|
pub struct RawAsync {
|
||||||
fd: RawFd,
|
fd: RawFd,
|
||||||
data_io: UringDataIo,
|
data_io: UringDataIo,
|
||||||
alignment: u64,
|
alignment: u64,
|
||||||
is_block_device: bool,
|
is_block_device: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RawFileAsync {
|
impl RawAsync {
|
||||||
pub fn new(fd: RawFd, ring_depth: u32) -> BlockResult<Self> {
|
pub fn new(fd: RawFd, ring_depth: u32) -> BlockResult<Self> {
|
||||||
let data_io =
|
let data_io =
|
||||||
UringDataIo::new(ring_depth).map_err(|e| BlockError::new(BlockErrorKind::Io, e))?;
|
UringDataIo::new(ring_depth).map_err(|e| BlockError::new(BlockErrorKind::Io, e))?;
|
||||||
let is_block_device = is_block_device(fd);
|
let is_block_device = is_block_device(fd);
|
||||||
|
|
||||||
Ok(RawFileAsync {
|
Ok(RawAsync {
|
||||||
fd,
|
fd,
|
||||||
data_io,
|
data_io,
|
||||||
alignment: SECTOR_SIZE,
|
alignment: SECTOR_SIZE,
|
||||||
@@ -38,7 +38,7 @@ impl RawFileAsync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsyncIo for RawFileAsync {
|
impl AsyncIo for RawAsync {
|
||||||
fn notifier(&self) -> &EventFd {
|
fn notifier(&self) -> &EventFd {
|
||||||
self.data_io.notifier()
|
self.data_io.notifier()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use log::warn;
|
|||||||
use crate::async_io::{AsyncIo, BorrowedDiskFd, DiskFileError};
|
use crate::async_io::{AsyncIo, BorrowedDiskFd, DiskFileError};
|
||||||
use crate::error::{BlockError, BlockErrorKind, BlockResult};
|
use crate::error::{BlockError, BlockErrorKind, BlockResult};
|
||||||
#[cfg(feature = "io_uring")]
|
#[cfg(feature = "io_uring")]
|
||||||
use crate::raw_async::RawFileAsync;
|
use crate::raw_async::RawAsync;
|
||||||
use crate::raw_async_aio::RawFileAsyncAio;
|
use crate::raw_async_aio::RawFileAsyncAio;
|
||||||
use crate::raw_sync::RawSync;
|
use crate::raw_sync::RawSync;
|
||||||
use crate::{DiskTopology, disk_file, probe_sparse_support, query_device_size};
|
use crate::{DiskTopology, disk_file, probe_sparse_support, query_device_size};
|
||||||
@@ -131,10 +131,7 @@ impl disk_file::AsyncDiskFile for RawDisk {
|
|||||||
match self.backend {
|
match self.backend {
|
||||||
RawBackend::Sync => Ok(Box::new(RawSync::new(self.file.as_raw_fd()))),
|
RawBackend::Sync => Ok(Box::new(RawSync::new(self.file.as_raw_fd()))),
|
||||||
#[cfg(feature = "io_uring")]
|
#[cfg(feature = "io_uring")]
|
||||||
RawBackend::IoUring => Ok(Box::new(RawFileAsync::new(
|
RawBackend::IoUring => Ok(Box::new(RawAsync::new(self.file.as_raw_fd(), ring_depth)?)),
|
||||||
self.file.as_raw_fd(),
|
|
||||||
ring_depth,
|
|
||||||
)?)),
|
|
||||||
RawBackend::Aio => Ok(Box::new(RawFileAsyncAio::new(
|
RawBackend::Aio => Ok(Box::new(RawFileAsyncAio::new(
|
||||||
self.file.as_raw_fd(),
|
self.file.as_raw_fd(),
|
||||||
ring_depth,
|
ring_depth,
|
||||||
|
|||||||
Reference in New Issue
Block a user