block: enable to get a raw FD of each block device's DiskFile

This is a prerequisite for the next steps.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-05-09 14:11:01 +02:00
committed by Rob Bradford
parent a23d4b7cf2
commit a647d7863c
12 changed files with 67 additions and 0 deletions
+6
View File
@@ -5,6 +5,7 @@
use std::collections::VecDeque;
use std::fs::File;
use std::io::{Seek, SeekFrom};
use std::os::fd::{AsRawFd, RawFd};
use std::sync::{Arc, Mutex, MutexGuard};
use vmm_sys_util::eventfd::EventFd;
@@ -35,6 +36,11 @@ impl DiskFile for QcowDiskSync {
fn new_async_io(&self, _ring_depth: u32) -> DiskFileResult<Box<dyn AsyncIo>> {
Ok(Box::new(QcowSync::new(self.qcow_file.clone())) as Box<dyn AsyncIo>)
}
fn fd(&mut self) -> RawFd {
let lock = self.qcow_file.lock().unwrap();
lock.as_raw_fd()
}
}
pub struct QcowSync {