diff --git a/block/src/async_io.rs b/block/src/io/async_io.rs similarity index 99% rename from block/src/async_io.rs rename to block/src/io/async_io.rs index 64e7a742d..ffd0621f5 100644 --- a/block/src/async_io.rs +++ b/block/src/io/async_io.rs @@ -61,7 +61,7 @@ pub struct BorrowedDiskFd<'fd> { } impl BorrowedDiskFd<'_> { - pub(super) fn new(raw_fd: RawFd) -> Self { + pub(crate) fn new(raw_fd: RawFd) -> Self { Self { raw_fd, _lifetime: PhantomData, diff --git a/block/src/async_io/aio_data_io.rs b/block/src/io/async_io/aio_data_io.rs similarity index 100% rename from block/src/async_io/aio_data_io.rs rename to block/src/io/async_io/aio_data_io.rs diff --git a/block/src/async_io/common.rs b/block/src/io/async_io/common.rs similarity index 100% rename from block/src/async_io/common.rs rename to block/src/io/async_io/common.rs diff --git a/block/src/async_io/completion.rs b/block/src/io/async_io/completion.rs similarity index 100% rename from block/src/async_io/completion.rs rename to block/src/io/async_io/completion.rs diff --git a/block/src/async_io/guest_memory_target.rs b/block/src/io/async_io/guest_memory_target.rs similarity index 100% rename from block/src/async_io/guest_memory_target.rs rename to block/src/io/async_io/guest_memory_target.rs diff --git a/block/src/async_io/operation.rs b/block/src/io/async_io/operation.rs similarity index 100% rename from block/src/async_io/operation.rs rename to block/src/io/async_io/operation.rs diff --git a/block/src/async_io/owned_io_buffer.rs b/block/src/io/async_io/owned_io_buffer.rs similarity index 100% rename from block/src/async_io/owned_io_buffer.rs rename to block/src/io/async_io/owned_io_buffer.rs diff --git a/block/src/async_io/uring_data_io.rs b/block/src/io/async_io/uring_data_io.rs similarity index 100% rename from block/src/async_io/uring_data_io.rs rename to block/src/io/async_io/uring_data_io.rs diff --git a/block/src/fcntl.rs b/block/src/io/fcntl.rs similarity index 100% rename from block/src/fcntl.rs rename to block/src/io/fcntl.rs diff --git a/block/src/io/mod.rs b/block/src/io/mod.rs new file mode 100644 index 000000000..4406ecc4d --- /dev/null +++ b/block/src/io/mod.rs @@ -0,0 +1,12 @@ +// Copyright 2026 The Cloud Hypervisor Authors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +//! Shared I/O infrastructure for all disk format backends. +//! +//! Contains the async I/O trait, request handling, and file locking +//! helpers. + +pub mod async_io; +pub mod fcntl; +pub mod request; diff --git a/block/src/request.rs b/block/src/io/request.rs similarity index 100% rename from block/src/request.rs rename to block/src/io/request.rs diff --git a/block/src/lib.rs b/block/src/lib.rs index 972e3e559..0c2170511 100644 --- a/block/src/lib.rs +++ b/block/src/lib.rs @@ -8,11 +8,12 @@ // // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause -pub mod async_io; pub mod disk_file; pub mod error; pub mod factory; -pub mod fcntl; +#[path = "io/mod.rs"] +mod io_impl; +pub use io_impl::{async_io, fcntl, request}; pub mod fixed_vhd; #[cfg(feature = "io_uring")] /// Enabled with the `"io_uring"` feature @@ -32,7 +33,6 @@ pub(crate) mod raw_async_aio; mod raw_async_io_tests; pub mod raw_disk; pub(crate) mod raw_sync; -mod request; mod sparse; pub use sparse::{BLKDISCARD, BLKZEROOUT}; pub mod vhd;