mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Error for PciDeviceError and PciRootError
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP <philipp.schuster@sap.com>
This commit is contained in:
committed by
Rob Bradford
parent
b2993fb2fa
commit
a007b750ff
@@ -10,7 +10,9 @@
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::btree_map::BTreeMap;
|
||||
use std::sync::{Arc, Barrier, Mutex, RwLock, Weak};
|
||||
use std::{convert, error, fmt, io, result};
|
||||
use std::{convert, io, result};
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
/// Trait for devices that respond to reads or writes in an arbitrary address space.
|
||||
///
|
||||
@@ -51,26 +53,21 @@ impl<B: BusDevice> BusDeviceSync for Mutex<B> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
/// The insertion failed because the new device overlapped with an old device.
|
||||
#[error("The insertion failed because the new device overlapped with an old device")]
|
||||
Overlap,
|
||||
/// Failed to operate on zero sized range.
|
||||
#[error("Failed to operate on zero sized range")]
|
||||
ZeroSizedRange,
|
||||
/// Failed to find address range.
|
||||
#[error("Failed to find address range")]
|
||||
MissingAddressRange,
|
||||
}
|
||||
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "bus_error: {self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {}
|
||||
|
||||
impl convert::From<Error> for io::Error {
|
||||
fn from(e: Error) -> Self {
|
||||
io::Error::other(e)
|
||||
|
||||
Reference in New Issue
Block a user