mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: allow downcasting to KVM / MSHV device fd
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
//
|
||||
|
||||
use crate::DeviceAttr;
|
||||
use std::any::Any;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -44,4 +45,6 @@ pub trait Device: Send + Sync + AsRawFd {
|
||||
fn set_device_attr(&self, attr: &DeviceAttr) -> Result<()>;
|
||||
/// Get device attribute.
|
||||
fn get_device_attr(&self, attr: &mut DeviceAttr) -> Result<()>;
|
||||
/// Provide a way to downcast to the device fd.
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user