mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: qcow_async: impl DiskFd for QcowDiskAsync
Returns a borrowed file descriptor for the underlying data file. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
403b75656c
commit
91d6356db4
@@ -8,8 +8,10 @@
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
use std::os::fd::{AsFd, AsRawFd};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use crate::async_io::BorrowedDiskFd;
|
||||||
use crate::disk_file;
|
use crate::disk_file;
|
||||||
use crate::error::{BlockErrorKind, BlockResult, ErrorOp};
|
use crate::error::{BlockErrorKind, BlockResult, ErrorOp};
|
||||||
use crate::qcow::backing::shared_backing_from;
|
use crate::qcow::backing::shared_backing_from;
|
||||||
@@ -81,3 +83,9 @@ impl disk_file::PhysicalSize for QcowDiskAsync {
|
|||||||
Ok(self.data_raw_file.physical_size()?)
|
Ok(self.data_raw_file.physical_size()?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl disk_file::DiskFd for QcowDiskAsync {
|
||||||
|
fn fd(&self) -> BorrowedDiskFd<'_> {
|
||||||
|
BorrowedDiskFd::new(self.data_raw_file.as_fd().as_raw_fd())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user