misc: pci: streamline error Display::fmt()
The changes were mostly automatically applied using the Python script mentioned in the first commit of this series. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
parent
192b19c060
commit
a3692144f0
6 changed files with 25 additions and 25 deletions
|
|
@ -27,16 +27,16 @@ const NUM_DEVICE_IDS: usize = 32;
|
|||
#[derive(Error, Debug)]
|
||||
pub enum PciRootError {
|
||||
/// Could not allocate device address space for the device.
|
||||
#[error("Could not allocate device address space for the device: {0}")]
|
||||
#[error("Could not allocate device address space for the device")]
|
||||
AllocateDeviceAddrs(#[source] PciDeviceError),
|
||||
/// Could not allocate an IRQ number.
|
||||
#[error("Could not allocate an IRQ number")]
|
||||
AllocateIrq,
|
||||
/// Could not add a device to the port io bus.
|
||||
#[error("Could not add a device to the port io bus: {0}")]
|
||||
#[error("Could not add a device to the port io bus")]
|
||||
PioInsert(#[source] vm_device::BusError),
|
||||
/// Could not add a device to the mmio bus.
|
||||
#[error("Could not add a device to the mmio bus: {0}")]
|
||||
#[error("Could not add a device to the mmio bus")]
|
||||
MmioInsert(#[source] vm_device::BusError),
|
||||
/// Could not find an available device slot on the PCI bus.
|
||||
#[error("Could not find an available device slot on the PCI bus")]
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ use crate::PciBarConfiguration;
|
|||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
/// Setup of the device capabilities failed.
|
||||
#[error("Setup of the device capabilities failed: {0}")]
|
||||
#[error("Setup of the device capabilities failed")]
|
||||
CapabilitiesSetup(#[source] configuration::Error),
|
||||
/// Allocating space for an IO BAR failed.
|
||||
#[error("Allocating space for an IO BAR failed")]
|
||||
IoAllocationFailed(u64),
|
||||
/// Registering an IO BAR failed.
|
||||
#[error("Registering an IO BAR failed: {0}")]
|
||||
#[error("Registering an IO BAR failed")]
|
||||
IoRegistrationFailed(u64, #[source] configuration::Error),
|
||||
/// Expected resource not found.
|
||||
#[error("Expected resource not found")]
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ pub fn msi_num_enabled_vectors(msg_ctl: u16) -> usize {
|
|||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Failed enabling the interrupt route: {0}")]
|
||||
#[error("Failed enabling the interrupt route")]
|
||||
EnableInterruptRoute(#[source] io::Error),
|
||||
#[error("Failed updating the interrupt route: {0}")]
|
||||
#[error("Failed updating the interrupt route")]
|
||||
UpdateInterruptRoute(#[source] io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ pub const MSIX_CONFIG_ID: &str = "msix_config";
|
|||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
/// Failed enabling the interrupt route.
|
||||
#[error("Failed enabling the interrupt route: {0}")]
|
||||
#[error("Failed enabling the interrupt route")]
|
||||
EnableInterruptRoute(#[source] io::Error),
|
||||
/// Failed updating the interrupt route.
|
||||
#[error("Failed updating the interrupt route: {0}")]
|
||||
#[error("Failed updating the interrupt route")]
|
||||
UpdateInterruptRoute(#[source] io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,17 +47,17 @@ pub(crate) const VFIO_COMMON_ID: &str = "vfio_common";
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum VfioPciError {
|
||||
#[error("Failed to create user memory region: {0}")]
|
||||
#[error("Failed to create user memory region")]
|
||||
CreateUserMemoryRegion(#[source] HypervisorVmError),
|
||||
#[error("Failed to DMA map: {0} for device {1} (guest BDF: {2})")]
|
||||
DmaMap(#[source] vfio_ioctls::VfioError, PathBuf, PciBdf),
|
||||
#[error("Failed to DMA unmap: {0} for device {1} (guest BDF: {2})")]
|
||||
DmaUnmap(#[source] vfio_ioctls::VfioError, PathBuf, PciBdf),
|
||||
#[error("Failed to enable INTx: {0}")]
|
||||
#[error("Failed to enable INTx")]
|
||||
EnableIntx(#[source] VfioError),
|
||||
#[error("Failed to enable MSI: {0}")]
|
||||
#[error("Failed to enable MSI")]
|
||||
EnableMsi(#[source] VfioError),
|
||||
#[error("Failed to enable MSI-x: {0}")]
|
||||
#[error("Failed to enable MSI-x")]
|
||||
EnableMsix(#[source] VfioError),
|
||||
#[error("Failed to mmap the area")]
|
||||
MmapArea,
|
||||
|
|
@ -67,13 +67,13 @@ pub enum VfioPciError {
|
|||
RegionAlignment,
|
||||
#[error("Invalid region size")]
|
||||
RegionSize,
|
||||
#[error("Failed to retrieve MsiConfigState: {0}")]
|
||||
#[error("Failed to retrieve MsiConfigState")]
|
||||
RetrieveMsiConfigState(#[source] anyhow::Error),
|
||||
#[error("Failed to retrieve MsixConfigState: {0}")]
|
||||
#[error("Failed to retrieve MsixConfigState")]
|
||||
RetrieveMsixConfigState(#[source] anyhow::Error),
|
||||
#[error("Failed to retrieve PciConfigurationState: {0}")]
|
||||
#[error("Failed to retrieve PciConfigurationState")]
|
||||
RetrievePciConfigurationState(#[source] anyhow::Error),
|
||||
#[error("Failed to retrieve VfioCommonState: {0}")]
|
||||
#[error("Failed to retrieve VfioCommonState")]
|
||||
RetrieveVfioCommonState(#[source] anyhow::Error),
|
||||
}
|
||||
|
||||
|
|
@ -318,9 +318,9 @@ impl MmioRegionRange for Vec<MmioRegion> {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum VfioError {
|
||||
#[error("Kernel VFIO error: {0}")]
|
||||
#[error("Kernel VFIO error")]
|
||||
KernelVfio(#[source] vfio_ioctls::VfioError),
|
||||
#[error("VFIO user error: {0}")]
|
||||
#[error("VFIO user error")]
|
||||
VfioUser(#[source] vfio_user::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@ pub struct VfioUserPciDevice {
|
|||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum VfioUserPciDeviceError {
|
||||
#[error("Client error: {0}")]
|
||||
#[error("Client error")]
|
||||
Client(#[source] VfioUserError),
|
||||
#[error("Failed to map VFIO PCI region into guest: {0}")]
|
||||
#[error("Failed to map VFIO PCI region into guest")]
|
||||
MapRegionGuest(#[source] HypervisorVmError),
|
||||
#[error("Failed to DMA map: {0}")]
|
||||
#[error("Failed to DMA map")]
|
||||
DmaMap(#[source] VfioUserError),
|
||||
#[error("Failed to DMA unmap: {0}")]
|
||||
#[error("Failed to DMA unmap")]
|
||||
DmaUnmap(#[source] VfioUserError),
|
||||
#[error("Failed to initialize legacy interrupts: {0}")]
|
||||
#[error("Failed to initialize legacy interrupts")]
|
||||
InitializeLegacyInterrupts(#[source] VfioPciError),
|
||||
#[error("Failed to create VfioCommon: {0}")]
|
||||
#[error("Failed to create VfioCommon")]
|
||||
CreateVfioCommon(#[source] VfioPciError),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue