mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Remove legacy async I/O API
Drop the borrowed iovec AsyncIo entry points now that all callers use owned operations. Rename the transitional owned batch and completion methods to the final trait names and remove the borrowed submission helpers from the queue wrappers. This removes a bunch of known safety foot-guns so future-us don't accidentally use them. Assisted-by: Codex:GPT-5.5 Signed-off-by: Dylan Reid <dgreid@fb.com>
This commit is contained in:
@@ -191,36 +191,6 @@ impl AsyncIo for VhdxSync {
|
||||
&self.eventfd
|
||||
}
|
||||
|
||||
fn read_vectored(
|
||||
&mut self,
|
||||
offset: libc::off_t,
|
||||
iovecs: &[libc::iovec],
|
||||
user_data: u64,
|
||||
) -> AsyncIoResult<()> {
|
||||
// SAFETY: the legacy caller is responsible for keeping the borrowed
|
||||
// iovecs and writable buffers valid until completion. This is unsound, but only temporary.
|
||||
let result = unsafe { self.read_iovecs(offset, iovecs)? };
|
||||
self.completion_list
|
||||
.push_back(AsyncIoCompletion::new(user_data, result as i32, None));
|
||||
self.eventfd.write(1).unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_vectored(
|
||||
&mut self,
|
||||
offset: libc::off_t,
|
||||
iovecs: &[libc::iovec],
|
||||
user_data: u64,
|
||||
) -> AsyncIoResult<()> {
|
||||
// SAFETY: the legacy caller is responsible for keeping the borrowed
|
||||
// iovecs and readable buffers valid until completion. This is unsound, but only temporary.
|
||||
let result = unsafe { self.write_iovecs(offset, iovecs)? };
|
||||
self.completion_list
|
||||
.push_back(AsyncIoCompletion::new(user_data, result as i32, None));
|
||||
self.eventfd.write(1).unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn submit_data_operation(&mut self, op: AsyncIoOperation) -> AsyncIoResult<()> {
|
||||
let offset = op.offset();
|
||||
let is_read = op.is_read();
|
||||
@@ -259,7 +229,7 @@ impl AsyncIo for VhdxSync {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn next_completion(&mut self) -> Option<AsyncIoCompletion> {
|
||||
fn next_completed_request(&mut self) -> Option<AsyncIoCompletion> {
|
||||
self.completion_list.pop_front()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user