From 6279214dff9fcf7c78920a4bf6ba137c23f70b64 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 24 Apr 2026 17:26:46 +0200 Subject: [PATCH] block: raw: Rename RawFileSync to RawSync Apply the consistent naming convention. No functional change. Signed-off-by: Anatol Belski --- block/src/fixed_vhd_sync.rs | 6 +++--- block/src/raw_async_aio.rs | 2 +- block/src/raw_disk.rs | 4 ++-- block/src/raw_sync.rs | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/block/src/fixed_vhd_sync.rs b/block/src/fixed_vhd_sync.rs index e422fc812..4cf880076 100644 --- a/block/src/fixed_vhd_sync.rs +++ b/block/src/fixed_vhd_sync.rs @@ -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 { Ok(FixedVhdSync { - raw_file_sync: RawFileSync::new(fd), + raw_file_sync: RawSync::new(fd), size, }) } diff --git a/block/src/raw_async_aio.rs b/block/src/raw_async_aio.rs index e9c35e4dc..a1c9e1439 100644 --- a/block/src/raw_async_aio.rs +++ b/block/src/raw_async_aio.rs @@ -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 diff --git a/block/src/raw_disk.rs b/block/src/raw_disk.rs index 82dd3c530..a51b715f3 100644 --- a/block/src/raw_disk.rs +++ b/block/src/raw_disk.rs @@ -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> { 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(), diff --git a/block/src/raw_sync.rs b/block/src/raw_sync.rs index 4daa16ceb..02b2deea1 100644 --- a/block/src/raw_sync.rs +++ b/block/src/raw_sync.rs @@ -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, @@ -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); } }