2024-01-30 18:02:32 -08:00
|
|
|
use std::io;
|
|
|
|
|
2024-04-29 10:02:20 -07:00
|
|
|
use crate::pci::PciBdf;
|
|
|
|
|
2024-01-30 18:02:32 -08:00
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
|
|
pub enum Error {
|
2024-03-07 04:14:25 -08:00
|
|
|
#[error("io issue encountered: {0}")]
|
2024-01-30 18:02:32 -08:00
|
|
|
Io(#[from] io::Error),
|
2024-03-07 04:14:25 -08:00
|
|
|
#[error("xenstore issue encountered: {0}")]
|
2024-01-30 18:02:32 -08:00
|
|
|
XenStore(#[from] xenstore::error::Error),
|
2024-03-07 04:14:25 -08:00
|
|
|
#[error("xencall issue encountered: {0}")]
|
2024-01-30 18:09:26 -08:00
|
|
|
XenCall(#[from] xencall::error::Error),
|
2024-01-30 18:02:32 -08:00
|
|
|
#[error("domain does not have a tty")]
|
|
|
|
TtyNotFound,
|
|
|
|
#[error("introducing the domain failed")]
|
|
|
|
IntroduceDomainFailed,
|
|
|
|
#[error("string conversion of a path failed")]
|
|
|
|
PathStringConversion,
|
|
|
|
#[error("parent of path not found")]
|
|
|
|
PathParentNotFound,
|
|
|
|
#[error("domain does not exist")]
|
|
|
|
DomainNonExistent,
|
2024-03-21 21:31:10 +00:00
|
|
|
#[error("memory setup failed: {0}")]
|
|
|
|
MemorySetupFailed(&'static str),
|
2024-01-30 18:02:32 -08:00
|
|
|
#[error("populate physmap failed: wanted={0}, received={1}, input_extents={2}")]
|
|
|
|
PopulatePhysmapFailed(usize, usize, usize),
|
|
|
|
#[error("unknown elf compression method")]
|
|
|
|
ElfCompressionUnknown,
|
|
|
|
#[error("expected elf image format not found")]
|
|
|
|
ElfInvalidImage,
|
|
|
|
#[error("provided elf image does not contain xen support")]
|
|
|
|
ElfXenSupportMissing,
|
2024-04-29 10:02:20 -07:00
|
|
|
#[error("regex error: {0}")]
|
|
|
|
RegexError(#[from] regex::Error),
|
|
|
|
#[error("error: {0}")]
|
|
|
|
GenericError(String),
|
|
|
|
#[error("failed to parse int: {0}")]
|
|
|
|
ParseIntError(#[from] std::num::ParseIntError),
|
|
|
|
#[error("invalid pci bdf string")]
|
|
|
|
InvalidPciBdfString,
|
|
|
|
#[error("pci device {0} is not assignable")]
|
|
|
|
PciDeviceNotAssignable(PciBdf),
|
2024-06-21 01:10:45 -07:00
|
|
|
#[error("xen platform error: {0}")]
|
|
|
|
XenPlatform(#[from] xenplatform::error::Error),
|
2024-01-30 17:42:55 -08:00
|
|
|
}
|
|
|
|
|
2024-01-30 18:02:32 -08:00
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|