mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Rename AsyncDiskFile::new_async_io to create_async_io
The new_ prefix in Rust conventionally denotes constructors that return Self (e.g. Vec::new(), File::new()). AsyncDiskFile::new_async_io does not return Self. It is a factory method that constructs and returns a Box<dyn AsyncIo> worker bound to the disk file descriptor and metadata. The create_ prefix communicates this: the caller receives a freshly constructed object of a different type. This rename touches every format backend in block plus two external callers in virtio-devices and performance-metrics. Every change is a mechanical s/new_async_io/create_async_io/ substitution. No functional change. Ref: #7877 (task 3.2.8) Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
5a14d0e2e0
commit
21cd13df01
@@ -24,7 +24,7 @@
|
||||
//! / \
|
||||
//! FullDiskFile: AsyncDiskFile:
|
||||
//! DiskFile + PhysicalSize + DiskFile + Unpin
|
||||
//! DiskFd + SparseCapable + try_clone, new_async_io
|
||||
//! DiskFd + SparseCapable + try_clone, create_async_io
|
||||
//! Resizable
|
||||
//! \ /
|
||||
//! AsyncFullDiskFile: FullDiskFile + AsyncDiskFile
|
||||
@@ -139,7 +139,7 @@ pub trait AsyncDiskFile: DiskFile + Unpin {
|
||||
/// Callers typically pass the virtio queue size. Must be greater
|
||||
/// than zero. Backends that do not use an async ring (e.g. sync
|
||||
/// fallback implementations) may ignore this value.
|
||||
fn new_async_io(&self, ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>>;
|
||||
fn create_async_io(&self, ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>>;
|
||||
}
|
||||
|
||||
/// Full capability async disk file trait.
|
||||
@@ -215,12 +215,12 @@ impl DiskBackend {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_async_io(&self, ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>> {
|
||||
pub fn create_async_io(&self, ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>> {
|
||||
match self {
|
||||
Self::Legacy(d) => d
|
||||
.new_async_io(ring_depth)
|
||||
.create_async_io(ring_depth)
|
||||
.map_err(|e| BlockError::new(BlockErrorKind::Io, io::Error::other(e))),
|
||||
Self::Next(d) => d.new_async_io(ring_depth),
|
||||
Self::Next(d) => d.create_async_io(ring_depth),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user