mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: raw: Rename RawFileSync to RawSync
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
8835656f21
commit
6279214dff
@@ -9,17 +9,17 @@ use std::os::unix::io::RawFd;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
use crate::async_io::{AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation, AsyncIoResult};
|
||||
use crate::raw_sync::RawFileSync;
|
||||
use crate::raw_sync::RawSync;
|
||||
|
||||
pub struct FixedVhdSync {
|
||||
raw_file_sync: RawFileSync,
|
||||
raw_file_sync: RawSync,
|
||||
size: u64,
|
||||
}
|
||||
|
||||
impl FixedVhdSync {
|
||||
pub fn new(fd: RawFd, size: u64) -> std::io::Result<Self> {
|
||||
Ok(FixedVhdSync {
|
||||
raw_file_sync: RawFileSync::new(fd),
|
||||
raw_file_sync: RawSync::new(fd),
|
||||
size,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ impl AsyncIo for RawFileAsyncAio {
|
||||
fn punch_hole(&mut self, offset: u64, length: u64, user_data: u64) -> AsyncIoResult<()> {
|
||||
// Linux AIO has no IOCB command for fallocate, so perform the
|
||||
// operation synchronously and signal completion via the completion
|
||||
// list, matching the pattern used by the sync backend (RawFileSync).
|
||||
// list, matching the pattern used by the sync backend (RawSync).
|
||||
punch_hole(self.fd, self.is_block_device, offset, length)
|
||||
.map_err(AsyncIoError::PunchHole)?;
|
||||
self.data_io
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::error::{BlockError, BlockErrorKind, BlockResult};
|
||||
#[cfg(feature = "io_uring")]
|
||||
use crate::raw_async::RawFileAsync;
|
||||
use crate::raw_async_aio::RawFileAsyncAio;
|
||||
use crate::raw_sync::RawFileSync;
|
||||
use crate::raw_sync::RawSync;
|
||||
use crate::{DiskTopology, disk_file, probe_sparse_support, query_device_size};
|
||||
|
||||
/// Selects which async I/O backend a `RawDisk` uses.
|
||||
@@ -129,7 +129,7 @@ impl disk_file::AsyncDiskFile for RawDisk {
|
||||
|
||||
fn create_async_io(&self, ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>> {
|
||||
match self.backend {
|
||||
RawBackend::Sync => Ok(Box::new(RawFileSync::new(self.file.as_raw_fd()))),
|
||||
RawBackend::Sync => Ok(Box::new(RawSync::new(self.file.as_raw_fd()))),
|
||||
#[cfg(feature = "io_uring")]
|
||||
RawBackend::IoUring => Ok(Box::new(RawFileAsync::new(
|
||||
self.file.as_raw_fd(),
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::async_io::{AsyncIo, AsyncIoCompletion, AsyncIoError, AsyncIoOperation
|
||||
use crate::sparse::{punch_hole, write_zeroes};
|
||||
use crate::{SECTOR_SIZE, is_block_device};
|
||||
|
||||
pub struct RawFileSync {
|
||||
pub struct RawSync {
|
||||
fd: RawFd,
|
||||
eventfd: EventFd,
|
||||
completion_list: VecDeque<AsyncIoCompletion>,
|
||||
@@ -21,10 +21,10 @@ pub struct RawFileSync {
|
||||
is_block_device: bool,
|
||||
}
|
||||
|
||||
impl RawFileSync {
|
||||
impl RawSync {
|
||||
pub fn new(fd: RawFd) -> Self {
|
||||
let is_block_device = is_block_device(fd);
|
||||
RawFileSync {
|
||||
RawSync {
|
||||
fd,
|
||||
eventfd: EventFd::new(libc::EFD_NONBLOCK).expect("Failed creating EventFd for RawFile"),
|
||||
completion_list: VecDeque::new(),
|
||||
@@ -34,7 +34,7 @@ impl RawFileSync {
|
||||
}
|
||||
}
|
||||
|
||||
impl AsyncIo for RawFileSync {
|
||||
impl AsyncIo for RawSync {
|
||||
fn notifier(&self) -> &EventFd {
|
||||
&self.eventfd
|
||||
}
|
||||
@@ -141,7 +141,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 = RawFileSync::new(file.as_raw_fd());
|
||||
let mut async_io = RawSync::new(file.as_raw_fd());
|
||||
raw_async_io_tests::test_punch_hole(&mut async_io, &mut file);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,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 = RawFileSync::new(file.as_raw_fd());
|
||||
let mut async_io = RawSync::new(file.as_raw_fd());
|
||||
raw_async_io_tests::test_write_zeroes(&mut async_io, &mut file);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,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 = RawFileSync::new(file.as_raw_fd());
|
||||
let mut async_io = RawSync::new(file.as_raw_fd());
|
||||
raw_async_io_tests::test_punch_hole_multiple_operations(&mut async_io, &mut file);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user