hypervisor, vmm: use new vfio-ioctls

Use the new vfio-ioctls APIs. Drop Cloud Hypervisor's Device trait
since it is no longer needed.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2022-07-21 13:15:15 +00:00
committed by Liu Wei
parent 5e2c70b87f
commit a96a5d7816
10 changed files with 36 additions and 128 deletions

View File

@@ -9,9 +9,6 @@
// Copyright 2020, ARM Limited
//
use crate::DeviceAttr;
use std::any::Any;
use std::os::unix::io::AsRawFd;
use thiserror::Error;
#[derive(Error, Debug)]
@@ -29,22 +26,3 @@ pub enum HypervisorDeviceError {
#[error("Failed to get device attribute: {0}")]
GetDeviceAttribute(#[source] anyhow::Error),
}
///
/// Result type for returning from a function
///
pub type Result<T> = std::result::Result<T, HypervisorDeviceError>;
///
/// Trait to represent a device
///
/// This crate provides a hypervisor-agnostic interfaces for device
///
pub trait Device: Send + Sync + AsRawFd {
/// Set device attribute.
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;
}