From 577d4ebfcc8952144853e2e0713c1b13a4b84762 Mon Sep 17 00:00:00 2001 From: Liu Jiang Date: Sat, 5 Jun 2021 15:59:03 +0800 Subject: [PATCH] Add access method VcpuFd::vcpu_file() Add access method VcpuFd::vcpu_file() and also export new_vmfd(). Signed-off-by: Liu Jiang --- src/ioctls/vcpu.rs | 5 +++++ src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ioctls/vcpu.rs b/src/ioctls/vcpu.rs index b0cee562..440ce853 100644 --- a/src/ioctls/vcpu.rs +++ b/src/ioctls/vcpu.rs @@ -1394,6 +1394,11 @@ impl VcpuFd { Ok(()) } } + + /// Get reference to the underlying vcpu file object. + pub fn vcpu_file(&self) -> &File { + &self.vcpu + } } /// Helper function to create a new `VcpuFd`. diff --git a/src/lib.rs b/src/lib.rs index 10c3cbae..af40fa66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -222,7 +222,7 @@ pub use cap::Cap; pub use ioctls::device::DeviceFd; pub use ioctls::system::Kvm; pub use ioctls::vcpu::{VcpuExit, VcpuFd}; -pub use ioctls::vm::{IoEventAddress, NoDatamatch, VmFd}; +pub use ioctls::vm::{new_vmfd, IoEventAddress, NoDatamatch, VmFd}; // The following example is used to verify that our public // structures are exported properly. /// # Example