mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: raw: Rename RawFileAsyncAio to RawAio
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
ac3c53cebb
commit
45fd51652f
@@ -18,20 +18,20 @@ use crate::error::{BlockError, BlockErrorKind, BlockResult};
|
||||
use crate::sparse::{punch_hole, write_zeroes};
|
||||
use crate::{SECTOR_SIZE, is_block_device};
|
||||
|
||||
pub struct RawFileAsyncAio {
|
||||
pub struct RawAio {
|
||||
fd: RawFd,
|
||||
data_io: AioDataIo,
|
||||
alignment: u64,
|
||||
is_block_device: bool,
|
||||
}
|
||||
|
||||
impl RawFileAsyncAio {
|
||||
impl RawAio {
|
||||
pub fn new(fd: RawFd, queue_depth: u32) -> BlockResult<Self> {
|
||||
let data_io =
|
||||
AioDataIo::new(queue_depth).map_err(|e| BlockError::new(BlockErrorKind::Io, e))?;
|
||||
let is_block_device = is_block_device(fd);
|
||||
|
||||
Ok(RawFileAsyncAio {
|
||||
Ok(RawAio {
|
||||
fd,
|
||||
data_io,
|
||||
alignment: SECTOR_SIZE,
|
||||
@@ -40,7 +40,7 @@ impl RawFileAsyncAio {
|
||||
}
|
||||
}
|
||||
|
||||
impl AsyncIo for RawFileAsyncAio {
|
||||
impl AsyncIo for RawAio {
|
||||
fn notifier(&self) -> &EventFd {
|
||||
self.data_io.notifier()
|
||||
}
|
||||
@@ -113,7 +113,7 @@ mod unit_tests {
|
||||
fn test_punch_hole() {
|
||||
let temp_file = TempFile::new().unwrap();
|
||||
let mut file = temp_file.into_file();
|
||||
let mut async_io = RawFileAsyncAio::new(file.as_raw_fd(), 128).unwrap();
|
||||
let mut async_io = RawAio::new(file.as_raw_fd(), 128).unwrap();
|
||||
raw_async_io_tests::test_punch_hole(&mut async_io, &mut file);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ mod unit_tests {
|
||||
fn test_write_zeroes() {
|
||||
let temp_file = TempFile::new().unwrap();
|
||||
let mut file = temp_file.into_file();
|
||||
let mut async_io = RawFileAsyncAio::new(file.as_raw_fd(), 128).unwrap();
|
||||
let mut async_io = RawAio::new(file.as_raw_fd(), 128).unwrap();
|
||||
raw_async_io_tests::test_write_zeroes(&mut async_io, &mut file);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ mod unit_tests {
|
||||
fn test_punch_hole_multiple_operations() {
|
||||
let temp_file = TempFile::new().unwrap();
|
||||
let mut file = temp_file.into_file();
|
||||
let mut async_io = RawFileAsyncAio::new(file.as_raw_fd(), 128).unwrap();
|
||||
let mut async_io = RawAio::new(file.as_raw_fd(), 128).unwrap();
|
||||
raw_async_io_tests::test_punch_hole_multiple_operations(&mut async_io, &mut file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::async_io::{AsyncIo, BorrowedDiskFd, DiskFileError};
|
||||
use crate::error::{BlockError, BlockErrorKind, BlockResult};
|
||||
#[cfg(feature = "io_uring")]
|
||||
use crate::raw_async::RawAsync;
|
||||
use crate::raw_async_aio::RawFileAsyncAio;
|
||||
use crate::raw_async_aio::RawAio;
|
||||
use crate::raw_sync::RawSync;
|
||||
use crate::{DiskTopology, disk_file, probe_sparse_support, query_device_size};
|
||||
|
||||
@@ -132,10 +132,7 @@ impl disk_file::AsyncDiskFile for RawDisk {
|
||||
RawBackend::Sync => Ok(Box::new(RawSync::new(self.file.as_raw_fd()))),
|
||||
#[cfg(feature = "io_uring")]
|
||||
RawBackend::IoUring => Ok(Box::new(RawAsync::new(self.file.as_raw_fd(), ring_depth)?)),
|
||||
RawBackend::Aio => Ok(Box::new(RawFileAsyncAio::new(
|
||||
self.file.as_raw_fd(),
|
||||
ring_depth,
|
||||
)?)),
|
||||
RawBackend::Aio => Ok(Box::new(RawAio::new(self.file.as_raw_fd(), ring_depth)?)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user