mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: virtio-devices: 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:
committed by
Rob Bradford
parent
3541cebbf1
commit
8e2973fe7c
@@ -64,27 +64,27 @@ const VIRTIO_BALLOON_F_REPORTING: u64 = 5;
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Guest gave us bad memory addresses.: {0}")]
|
#[error("Guest gave us bad memory addresses.")]
|
||||||
GuestMemory(#[source] GuestMemoryError),
|
GuestMemory(#[source] GuestMemoryError),
|
||||||
#[error("Guest gave us a write only descriptor that protocol says to read from")]
|
#[error("Guest gave us a write only descriptor that protocol says to read from")]
|
||||||
UnexpectedWriteOnlyDescriptor,
|
UnexpectedWriteOnlyDescriptor,
|
||||||
#[error("Guest sent us invalid request")]
|
#[error("Guest sent us invalid request")]
|
||||||
InvalidRequest,
|
InvalidRequest,
|
||||||
#[error("Fallocate fail.: {0}")]
|
#[error("Fallocate fail.")]
|
||||||
FallocateFail(#[source] std::io::Error),
|
FallocateFail(#[source] std::io::Error),
|
||||||
#[error("Madvise fail.: {0}")]
|
#[error("Madvise fail.")]
|
||||||
MadviseFail(#[source] std::io::Error),
|
MadviseFail(#[source] std::io::Error),
|
||||||
#[error("Failed to EventFd write.: {0}")]
|
#[error("Failed to EventFd write.")]
|
||||||
EventFdWriteFail(#[source] std::io::Error),
|
EventFdWriteFail(#[source] std::io::Error),
|
||||||
#[error("Invalid queue index: {0}")]
|
#[error("Invalid queue index: {0}")]
|
||||||
InvalidQueueIndex(usize),
|
InvalidQueueIndex(usize),
|
||||||
#[error("Fail tp signal: {0}")]
|
#[error("Fail tp signal")]
|
||||||
FailedSignal(#[source] io::Error),
|
FailedSignal(#[source] io::Error),
|
||||||
#[error("Descriptor chain is too short")]
|
#[error("Descriptor chain is too short")]
|
||||||
DescriptorChainTooShort,
|
DescriptorChainTooShort,
|
||||||
#[error("Failed adding used index: {0}")]
|
#[error("Failed adding used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
#[error("Failed creating an iterator over the queue: {0}")]
|
#[error("Failed creating an iterator over the queue")]
|
||||||
QueueIterator(#[source] virtio_queue::Error),
|
QueueIterator(#[source] virtio_queue::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,25 +61,25 @@ pub const MINIMUM_BLOCK_QUEUE_SIZE: u16 = 2;
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Failed to parse the request: {0}")]
|
#[error("Failed to parse the request")]
|
||||||
RequestParsing(#[source] block::Error),
|
RequestParsing(#[source] block::Error),
|
||||||
#[error("Failed to execute the request: {0}")]
|
#[error("Failed to execute the request")]
|
||||||
RequestExecuting(#[source] block::ExecuteError),
|
RequestExecuting(#[source] block::ExecuteError),
|
||||||
#[error("Failed to complete the request: {0}")]
|
#[error("Failed to complete the request")]
|
||||||
RequestCompleting(#[source] block::Error),
|
RequestCompleting(#[source] block::Error),
|
||||||
#[error("Missing the expected entry in the list of requests")]
|
#[error("Missing the expected entry in the list of requests")]
|
||||||
MissingEntryRequestList,
|
MissingEntryRequestList,
|
||||||
#[error("The asynchronous request returned with failure")]
|
#[error("The asynchronous request returned with failure")]
|
||||||
AsyncRequestFailure,
|
AsyncRequestFailure,
|
||||||
#[error("Failed synchronizing the file: {0}")]
|
#[error("Failed synchronizing the file")]
|
||||||
Fsync(#[source] AsyncIoError),
|
Fsync(#[source] AsyncIoError),
|
||||||
#[error("Failed adding used index: {0}")]
|
#[error("Failed adding used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
#[error("Failed creating an iterator over the queue: {0}")]
|
#[error("Failed creating an iterator over the queue")]
|
||||||
QueueIterator(#[source] virtio_queue::Error),
|
QueueIterator(#[source] virtio_queue::Error),
|
||||||
#[error("Failed to update request status: {0}")]
|
#[error("Failed to update request status")]
|
||||||
RequestStatus(#[source] GuestMemoryError),
|
RequestStatus(#[source] GuestMemoryError),
|
||||||
#[error("Failed to enable notification: {0}")]
|
#[error("Failed to enable notification")]
|
||||||
QueueEnableNotification(#[source] virtio_queue::Error),
|
QueueEnableNotification(#[source] virtio_queue::Error),
|
||||||
#[error("Failed to get {lock_type:?} lock for disk image {path}: {error}")]
|
#[error("Failed to get {lock_type:?} lock for disk image {path}: {error}")]
|
||||||
LockDiskImage {
|
LockDiskImage {
|
||||||
|
|||||||
@@ -51,15 +51,15 @@ const VIRTIO_CONSOLE_F_SIZE: u64 = 0;
|
|||||||
enum Error {
|
enum Error {
|
||||||
#[error("Descriptor chain too short")]
|
#[error("Descriptor chain too short")]
|
||||||
DescriptorChainTooShort,
|
DescriptorChainTooShort,
|
||||||
#[error("Failed to read from guest memory: {0}")]
|
#[error("Failed to read from guest memory")]
|
||||||
GuestMemoryRead(#[source] vm_memory::guest_memory::Error),
|
GuestMemoryRead(#[source] vm_memory::guest_memory::Error),
|
||||||
#[error("Failed to write to guest memory: {0}")]
|
#[error("Failed to write to guest memory")]
|
||||||
GuestMemoryWrite(#[source] vm_memory::guest_memory::Error),
|
GuestMemoryWrite(#[source] vm_memory::guest_memory::Error),
|
||||||
#[error("Failed to write_all output: {0}")]
|
#[error("Failed to write_all output")]
|
||||||
OutputWriteAll(#[source] io::Error),
|
OutputWriteAll(#[source] io::Error),
|
||||||
#[error("Failed to flush output: {0}")]
|
#[error("Failed to flush output")]
|
||||||
OutputFlush(#[source] io::Error),
|
OutputFlush(#[source] io::Error),
|
||||||
#[error("Failed to add used index: {0}")]
|
#[error("Failed to add used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,19 +24,19 @@ pub struct EpollHelper {
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum EpollHelperError {
|
pub enum EpollHelperError {
|
||||||
#[error("Failed to create Fd: {0}")]
|
#[error("Failed to create Fd")]
|
||||||
CreateFd(#[source] std::io::Error),
|
CreateFd(#[source] std::io::Error),
|
||||||
#[error("Failed to epoll_ctl: {0}")]
|
#[error("Failed to epoll_ctl")]
|
||||||
Ctl(#[source] std::io::Error),
|
Ctl(#[source] std::io::Error),
|
||||||
#[error("IO error: {0}")]
|
#[error("IO error")]
|
||||||
IoError(#[source] std::io::Error),
|
IoError(#[source] std::io::Error),
|
||||||
#[error("Failed to epoll_wait: {0}")]
|
#[error("Failed to epoll_wait")]
|
||||||
Wait(#[source] std::io::Error),
|
Wait(#[source] std::io::Error),
|
||||||
#[error("Failed to get virtio-queue index: {0}")]
|
#[error("Failed to get virtio-queue index")]
|
||||||
QueueRingIndex(#[source] virtio_queue::Error),
|
QueueRingIndex(#[source] virtio_queue::Error),
|
||||||
#[error("Failed to handle virtio device events: {0}")]
|
#[error("Failed to handle virtio device events")]
|
||||||
HandleEvent(#[source] anyhow::Error),
|
HandleEvent(#[source] anyhow::Error),
|
||||||
#[error("Failed to handle timeout: {0}")]
|
#[error("Failed to handle timeout")]
|
||||||
HandleTimeout(#[source] anyhow::Error),
|
HandleTimeout(#[source] anyhow::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ unsafe impl ByteValued for VirtioIommuFault {}
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
enum Error {
|
enum Error {
|
||||||
#[error("Guest gave us bad memory addresses: {0}")]
|
#[error("Guest gave us bad memory addresses")]
|
||||||
GuestMemory(#[source] GuestMemoryError),
|
GuestMemory(#[source] GuestMemoryError),
|
||||||
#[error("Guest gave us a write only descriptor that protocol says to read from")]
|
#[error("Guest gave us a write only descriptor that protocol says to read from")]
|
||||||
UnexpectedWriteOnlyDescriptor,
|
UnexpectedWriteOnlyDescriptor,
|
||||||
@@ -322,11 +322,11 @@ enum Error {
|
|||||||
InvalidUnmapRequestMissingDomain,
|
InvalidUnmapRequestMissingDomain,
|
||||||
#[error("Guest sent us invalid PROBE request")]
|
#[error("Guest sent us invalid PROBE request")]
|
||||||
InvalidProbeRequest,
|
InvalidProbeRequest,
|
||||||
#[error("Failed to performing external mapping: {0}")]
|
#[error("Failed to performing external mapping")]
|
||||||
ExternalMapping(#[source] io::Error),
|
ExternalMapping(#[source] io::Error),
|
||||||
#[error("Failed to performing external unmapping: {0}")]
|
#[error("Failed to performing external unmapping")]
|
||||||
ExternalUnmapping(#[source] io::Error),
|
ExternalUnmapping(#[source] io::Error),
|
||||||
#[error("Failed adding used index: {0}")]
|
#[error("Failed adding used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,19 +87,19 @@ const VIRTIO_F_NOTIFICATION_DATA: u32 = 38;
|
|||||||
pub enum ActivateError {
|
pub enum ActivateError {
|
||||||
#[error("Failed to activate virtio device")]
|
#[error("Failed to activate virtio device")]
|
||||||
BadActivate,
|
BadActivate,
|
||||||
#[error("Failed to clone exit event fd: {0}")]
|
#[error("Failed to clone exit event fd")]
|
||||||
CloneExitEventFd(#[source] std::io::Error),
|
CloneExitEventFd(#[source] std::io::Error),
|
||||||
#[error("Failed to spawn thread: {0}")]
|
#[error("Failed to spawn thread")]
|
||||||
ThreadSpawn(#[source] std::io::Error),
|
ThreadSpawn(#[source] std::io::Error),
|
||||||
#[error("Failed to setup vhost-user-fs daemon: {0}")]
|
#[error("Failed to setup vhost-user-fs daemon")]
|
||||||
VhostUserFsSetup(#[source] vhost_user::Error),
|
VhostUserFsSetup(#[source] vhost_user::Error),
|
||||||
#[error("Failed to setup vhost-user daemon: {0}")]
|
#[error("Failed to setup vhost-user daemon")]
|
||||||
VhostUserSetup(#[source] vhost_user::Error),
|
VhostUserSetup(#[source] vhost_user::Error),
|
||||||
#[error("Failed to create seccomp filter: {0}")]
|
#[error("Failed to create seccomp filter")]
|
||||||
CreateSeccompFilter(#[source] seccompiler::Error),
|
CreateSeccompFilter(#[source] seccompiler::Error),
|
||||||
#[error("Failed to create rate limiter: {0}")]
|
#[error("Failed to create rate limiter")]
|
||||||
CreateRateLimiter(#[source] std::io::Error),
|
CreateRateLimiter(#[source] std::io::Error),
|
||||||
#[error("Failed to activate the vDPA device: {0}")]
|
#[error("Failed to activate the vDPA device")]
|
||||||
ActivateVdpa(#[source] vdpa::Error),
|
ActivateVdpa(#[source] vdpa::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,21 +109,21 @@ pub type DeviceEventT = u16;
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Failed to single used queue: {0}")]
|
#[error("Failed to single used queue")]
|
||||||
FailedSignalingUsedQueue(#[source] io::Error),
|
FailedSignalingUsedQueue(#[source] io::Error),
|
||||||
#[error("I/O Error: {0}")]
|
#[error("I/O Error")]
|
||||||
IoError(#[source] io::Error),
|
IoError(#[source] io::Error),
|
||||||
#[error("Failed to update memory vhost-user: {0}")]
|
#[error("Failed to update memory vhost-user")]
|
||||||
VhostUserUpdateMemory(#[source] vhost_user::Error),
|
VhostUserUpdateMemory(#[source] vhost_user::Error),
|
||||||
#[error("Failed to add memory region vhost-user: {0}")]
|
#[error("Failed to add memory region vhost-user")]
|
||||||
VhostUserAddMemoryRegion(#[source] vhost_user::Error),
|
VhostUserAddMemoryRegion(#[source] vhost_user::Error),
|
||||||
#[error("Failed to set shared memory region")]
|
#[error("Failed to set shared memory region")]
|
||||||
SetShmRegionsNotSupported,
|
SetShmRegionsNotSupported,
|
||||||
#[error("Failed to process net queue: {0}")]
|
#[error("Failed to process net queue")]
|
||||||
NetQueuePair(#[source] ::net_util::NetQueuePairError),
|
NetQueuePair(#[source] ::net_util::NetQueuePairError),
|
||||||
#[error("Failed to : {0}")]
|
#[error("Failed to ")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
#[error("Failed to : {0}")]
|
#[error("Failed to ")]
|
||||||
QueueIterator(#[source] virtio_queue::Error),
|
QueueIterator(#[source] virtio_queue::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ const VIRTIO_MEM_F_ACPI_PXM: u8 = 0;
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Guest gave us bad memory addresses: {0}")]
|
#[error("Guest gave us bad memory addresses")]
|
||||||
GuestMemory(#[source] GuestMemoryError),
|
GuestMemory(#[source] GuestMemoryError),
|
||||||
#[error("Guest gave us a write only descriptor that protocol says to read from")]
|
#[error("Guest gave us a write only descriptor that protocol says to read from")]
|
||||||
UnexpectedWriteOnlyDescriptor,
|
UnexpectedWriteOnlyDescriptor,
|
||||||
@@ -113,23 +113,23 @@ pub enum Error {
|
|||||||
BufferLengthTooSmall,
|
BufferLengthTooSmall,
|
||||||
#[error("Guest sent us invalid request")]
|
#[error("Guest sent us invalid request")]
|
||||||
InvalidRequest,
|
InvalidRequest,
|
||||||
#[error("Failed to EventFd write: {0}")]
|
#[error("Failed to EventFd write")]
|
||||||
EventFdWriteFail(#[source] std::io::Error),
|
EventFdWriteFail(#[source] std::io::Error),
|
||||||
#[error("Failed to EventFd try_clone: {0}")]
|
#[error("Failed to EventFd try_clone")]
|
||||||
EventFdTryCloneFail(#[source] std::io::Error),
|
EventFdTryCloneFail(#[source] std::io::Error),
|
||||||
#[error("Failed to MpscRecv: {0}")]
|
#[error("Failed to MpscRecv")]
|
||||||
MpscRecvFail(#[source] mpsc::RecvError),
|
MpscRecvFail(#[source] mpsc::RecvError),
|
||||||
#[error("Resize invalid argument: {0}")]
|
#[error("Resize invalid argument")]
|
||||||
ResizeError(#[source] anyhow::Error),
|
ResizeError(#[source] anyhow::Error),
|
||||||
#[error("Fail to resize trigger: {0}")]
|
#[error("Fail to resize trigger")]
|
||||||
ResizeTriggerFail(#[source] DeviceError),
|
ResizeTriggerFail(#[source] DeviceError),
|
||||||
#[error("Invalid configuration: {0}")]
|
#[error("Invalid configuration")]
|
||||||
ValidateError(#[source] anyhow::Error),
|
ValidateError(#[source] anyhow::Error),
|
||||||
#[error("Failed discarding memory range: {0}")]
|
#[error("Failed discarding memory range")]
|
||||||
DiscardMemoryRange(#[source] std::io::Error),
|
DiscardMemoryRange(#[source] std::io::Error),
|
||||||
#[error("Failed DMA mapping: {0}")]
|
#[error("Failed DMA mapping")]
|
||||||
DmaMap(#[source] std::io::Error),
|
DmaMap(#[source] std::io::Error),
|
||||||
#[error("Failed DMA unmapping: {0}")]
|
#[error("Failed DMA unmapping")]
|
||||||
DmaUnmap(#[source] std::io::Error),
|
DmaUnmap(#[source] std::io::Error),
|
||||||
#[error("Invalid DMA mapping handler")]
|
#[error("Invalid DMA mapping handler")]
|
||||||
InvalidDmaMappingHandler,
|
InvalidDmaMappingHandler,
|
||||||
@@ -137,7 +137,7 @@ pub enum Error {
|
|||||||
NotActivatedByGuest,
|
NotActivatedByGuest,
|
||||||
#[error("Unknown request type: {0}")]
|
#[error("Unknown request type: {0}")]
|
||||||
UnknownRequestType(u16),
|
UnknownRequestType(u16),
|
||||||
#[error("Failed adding used index: {0}")]
|
#[error("Failed adding used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,11 +153,11 @@ pub const TX_RATE_LIMITER_EVENT: u16 = EPOLL_HELPER_EVENT_LAST + 6;
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Failed to open taps: {0}")]
|
#[error("Failed to open taps")]
|
||||||
OpenTap(#[source] OpenTapError),
|
OpenTap(#[source] OpenTapError),
|
||||||
#[error("Using existing tap: {0}")]
|
#[error("Using existing tap")]
|
||||||
TapError(#[source] TapError),
|
TapError(#[source] TapError),
|
||||||
#[error("Error calling dup() on tap fd: {0}")]
|
#[error("Error calling dup() on tap fd")]
|
||||||
DuplicateTapFd(#[source] std::io::Error),
|
DuplicateTapFd(#[source] std::io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ unsafe impl ByteValued for VirtioPmemResp {}
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
enum Error {
|
enum Error {
|
||||||
#[error("Bad guest memory addresses: {0}")]
|
#[error("Bad guest memory addresses")]
|
||||||
GuestMemory(#[source] GuestMemoryError),
|
GuestMemory(#[source] GuestMemoryError),
|
||||||
#[error("Unexpected write-only descriptor")]
|
#[error("Unexpected write-only descriptor")]
|
||||||
UnexpectedWriteOnlyDescriptor,
|
UnexpectedWriteOnlyDescriptor,
|
||||||
@@ -87,7 +87,7 @@ enum Error {
|
|||||||
BufferLengthTooSmall,
|
BufferLengthTooSmall,
|
||||||
#[error("Invalid request")]
|
#[error("Invalid request")]
|
||||||
InvalidRequest,
|
InvalidRequest,
|
||||||
#[error("Failed adding used index: {0}")]
|
#[error("Failed adding used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ enum Error {
|
|||||||
DescriptorChainTooShort,
|
DescriptorChainTooShort,
|
||||||
#[error("Invalid descriptor")]
|
#[error("Invalid descriptor")]
|
||||||
InvalidDescriptor,
|
InvalidDescriptor,
|
||||||
#[error("Failed to write to guest memory: {0}")]
|
#[error("Failed to write to guest memory")]
|
||||||
GuestMemoryWrite(#[source] vm_memory::guest_memory::Error),
|
GuestMemoryWrite(#[source] vm_memory::guest_memory::Error),
|
||||||
#[error("Failed adding used index: {0}")]
|
#[error("Failed adding used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ impl VirtioPciDeviceActivator {
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum VirtioPciDeviceError {
|
pub enum VirtioPciDeviceError {
|
||||||
#[error("Failed creating VirtioPciDevice: {0}")]
|
#[error("Failed creating VirtioPciDevice")]
|
||||||
CreateVirtioPciDevice(#[source] anyhow::Error),
|
CreateVirtioPciDevice(#[source] anyhow::Error),
|
||||||
}
|
}
|
||||||
pub type Result<T> = std::result::Result<T, VirtioPciDeviceError>;
|
pub type Result<T> = std::result::Result<T, VirtioPciDeviceError>;
|
||||||
|
|||||||
@@ -31,59 +31,59 @@ use crate::{
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Failed to create vhost-vdpa: {0}")]
|
#[error("Failed to create vhost-vdpa")]
|
||||||
CreateVhostVdpa(#[source] vhost::Error),
|
CreateVhostVdpa(#[source] vhost::Error),
|
||||||
#[error("Failed to map DMA range: {0}")]
|
#[error("Failed to map DMA range")]
|
||||||
DmaMap(#[source] vhost::Error),
|
DmaMap(#[source] vhost::Error),
|
||||||
#[error("Failed to unmap DMA range: {0}")]
|
#[error("Failed to unmap DMA range")]
|
||||||
DmaUnmap(#[source] vhost::Error),
|
DmaUnmap(#[source] vhost::Error),
|
||||||
#[error("Failed to get address range")]
|
#[error("Failed to get address range")]
|
||||||
GetAddressRange,
|
GetAddressRange,
|
||||||
#[error("Failed to get the available index from the virtio queue: {0}")]
|
#[error("Failed to get the available index from the virtio queue")]
|
||||||
GetAvailableIndex(#[source] virtio_queue::Error),
|
GetAvailableIndex(#[source] virtio_queue::Error),
|
||||||
#[error("Get virtio configuration size: {0}")]
|
#[error("Get virtio configuration size")]
|
||||||
GetConfigSize(#[source] vhost::Error),
|
GetConfigSize(#[source] vhost::Error),
|
||||||
#[error("Get virtio device identifier: {0}")]
|
#[error("Get virtio device identifier")]
|
||||||
GetDeviceId(#[source] vhost::Error),
|
GetDeviceId(#[source] vhost::Error),
|
||||||
#[error("Failed to get backend specific features: {0}")]
|
#[error("Failed to get backend specific features")]
|
||||||
GetBackendFeatures(#[source] vhost::Error),
|
GetBackendFeatures(#[source] vhost::Error),
|
||||||
#[error("Failed to get virtio features: {0}")]
|
#[error("Failed to get virtio features")]
|
||||||
GetFeatures(#[source] vhost::Error),
|
GetFeatures(#[source] vhost::Error),
|
||||||
#[error("Failed to get the IOVA range: {0}")]
|
#[error("Failed to get the IOVA range")]
|
||||||
GetIovaRange(#[source] vhost::Error),
|
GetIovaRange(#[source] vhost::Error),
|
||||||
#[error("Failed to get queue size: {0}")]
|
#[error("Failed to get queue size")]
|
||||||
GetVringNum(#[source] vhost::Error),
|
GetVringNum(#[source] vhost::Error),
|
||||||
#[error("Invalid IOVA range: {0}-{1}")]
|
#[error("Invalid IOVA range: {0}-{1}")]
|
||||||
InvalidIovaRange(u64, u64),
|
InvalidIovaRange(u64, u64),
|
||||||
#[error("Missing VIRTIO_F_ACCESS_PLATFORM feature")]
|
#[error("Missing VIRTIO_F_ACCESS_PLATFORM feature")]
|
||||||
MissingAccessPlatformVirtioFeature,
|
MissingAccessPlatformVirtioFeature,
|
||||||
#[error("Failed to reset owner: {0}")]
|
#[error("Failed to reset owner")]
|
||||||
ResetOwner(#[source] vhost::Error),
|
ResetOwner(#[source] vhost::Error),
|
||||||
#[error("Failed to set backend specific features: {0}")]
|
#[error("Failed to set backend specific features")]
|
||||||
SetBackendFeatures(#[source] vhost::Error),
|
SetBackendFeatures(#[source] vhost::Error),
|
||||||
#[error("Failed to set backend configuration: {0}")]
|
#[error("Failed to set backend configuration")]
|
||||||
SetConfig(#[source] vhost::Error),
|
SetConfig(#[source] vhost::Error),
|
||||||
#[error("Failed to set eventfd notifying about a configuration change: {0}")]
|
#[error("Failed to set eventfd notifying about a configuration change")]
|
||||||
SetConfigCall(#[source] vhost::Error),
|
SetConfigCall(#[source] vhost::Error),
|
||||||
#[error("Failed to set virtio features: {0}")]
|
#[error("Failed to set virtio features")]
|
||||||
SetFeatures(#[source] vhost::Error),
|
SetFeatures(#[source] vhost::Error),
|
||||||
#[error("Failed to set memory table: {0}")]
|
#[error("Failed to set memory table")]
|
||||||
SetMemTable(#[source] vhost::Error),
|
SetMemTable(#[source] vhost::Error),
|
||||||
#[error("Failed to set owner: {0}")]
|
#[error("Failed to set owner")]
|
||||||
SetOwner(#[source] vhost::Error),
|
SetOwner(#[source] vhost::Error),
|
||||||
#[error("Failed to set virtio status: {0}")]
|
#[error("Failed to set virtio status")]
|
||||||
SetStatus(#[source] vhost::Error),
|
SetStatus(#[source] vhost::Error),
|
||||||
#[error("Failed to set vring address: {0}")]
|
#[error("Failed to set vring address")]
|
||||||
SetVringAddr(#[source] vhost::Error),
|
SetVringAddr(#[source] vhost::Error),
|
||||||
#[error("Failed to set vring base: {0}")]
|
#[error("Failed to set vring base")]
|
||||||
SetVringBase(#[source] vhost::Error),
|
SetVringBase(#[source] vhost::Error),
|
||||||
#[error("Failed to set vring eventfd when buffer are used: {0}")]
|
#[error("Failed to set vring eventfd when buffer are used")]
|
||||||
SetVringCall(#[source] vhost::Error),
|
SetVringCall(#[source] vhost::Error),
|
||||||
#[error("Failed to enable/disable vring: {0}")]
|
#[error("Failed to enable/disable vring")]
|
||||||
SetVringEnable(#[source] vhost::Error),
|
SetVringEnable(#[source] vhost::Error),
|
||||||
#[error("Failed to set vring eventfd when new descriptors are available: {0}")]
|
#[error("Failed to set vring eventfd when new descriptors are available")]
|
||||||
SetVringKick(#[source] vhost::Error),
|
SetVringKick(#[source] vhost::Error),
|
||||||
#[error("Failed to set vring size: {0}")]
|
#[error("Failed to set vring size")]
|
||||||
SetVringNum(#[source] vhost::Error),
|
SetVringNum(#[source] vhost::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,85 +42,85 @@ pub use self::vu_common_ctrl::VhostUserConfig;
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Failed accepting connection: {0}")]
|
#[error("Failed accepting connection")]
|
||||||
AcceptConnection(#[source] io::Error),
|
AcceptConnection(#[source] io::Error),
|
||||||
#[error("Invalid available address")]
|
#[error("Invalid available address")]
|
||||||
AvailAddress,
|
AvailAddress,
|
||||||
#[error("Queue number is not correct")]
|
#[error("Queue number is not correct")]
|
||||||
BadQueueNum,
|
BadQueueNum,
|
||||||
#[error("Failed binding vhost-user socket: {0}")]
|
#[error("Failed binding vhost-user socket")]
|
||||||
BindSocket(#[source] io::Error),
|
BindSocket(#[source] io::Error),
|
||||||
#[error("Creating kill eventfd failed: {0}")]
|
#[error("Creating kill eventfd failed")]
|
||||||
CreateKillEventFd(#[source] io::Error),
|
CreateKillEventFd(#[source] io::Error),
|
||||||
#[error("Cloning kill eventfd failed: {0}")]
|
#[error("Cloning kill eventfd failed")]
|
||||||
CloneKillEventFd(#[source] io::Error),
|
CloneKillEventFd(#[source] io::Error),
|
||||||
#[error("Invalid descriptor table address")]
|
#[error("Invalid descriptor table address")]
|
||||||
DescriptorTableAddress,
|
DescriptorTableAddress,
|
||||||
#[error("Signal used queue failed: {0}")]
|
#[error("Signal used queue failed")]
|
||||||
FailedSignalingUsedQueue(#[source] io::Error),
|
FailedSignalingUsedQueue(#[source] io::Error),
|
||||||
#[error("Failed to read vhost eventfd: {0}")]
|
#[error("Failed to read vhost eventfd")]
|
||||||
MemoryRegions(#[source] MmapError),
|
MemoryRegions(#[source] MmapError),
|
||||||
#[error("Failed removing socket path: {0}")]
|
#[error("Failed removing socket path")]
|
||||||
RemoveSocketPath(#[source] io::Error),
|
RemoveSocketPath(#[source] io::Error),
|
||||||
#[error("Failed to create frontend: {0}")]
|
#[error("Failed to create frontend")]
|
||||||
VhostUserCreateFrontend(#[source] VhostError),
|
VhostUserCreateFrontend(#[source] VhostError),
|
||||||
#[error("Failed to open vhost device: {0}")]
|
#[error("Failed to open vhost device")]
|
||||||
VhostUserOpen(#[source] VhostError),
|
VhostUserOpen(#[source] VhostError),
|
||||||
#[error("Connection to socket failed")]
|
#[error("Connection to socket failed")]
|
||||||
VhostUserConnect,
|
VhostUserConnect,
|
||||||
#[error("Get features failed: {0}")]
|
#[error("Get features failed")]
|
||||||
VhostUserGetFeatures(#[source] VhostError),
|
VhostUserGetFeatures(#[source] VhostError),
|
||||||
#[error("Get queue max number failed: {0}")]
|
#[error("Get queue max number failed")]
|
||||||
VhostUserGetQueueMaxNum(#[source] VhostError),
|
VhostUserGetQueueMaxNum(#[source] VhostError),
|
||||||
#[error("Get protocol features failed: {0}")]
|
#[error("Get protocol features failed")]
|
||||||
VhostUserGetProtocolFeatures(#[source] VhostError),
|
VhostUserGetProtocolFeatures(#[source] VhostError),
|
||||||
#[error("Get vring base failed: {0}")]
|
#[error("Get vring base failed")]
|
||||||
VhostUserGetVringBase(#[source] VhostError),
|
VhostUserGetVringBase(#[source] VhostError),
|
||||||
#[error("Vhost-user Backend not support vhost-user protocol")]
|
#[error("Vhost-user Backend not support vhost-user protocol")]
|
||||||
VhostUserProtocolNotSupport,
|
VhostUserProtocolNotSupport,
|
||||||
#[error("Set owner failed: {0}")]
|
#[error("Set owner failed")]
|
||||||
VhostUserSetOwner(#[source] VhostError),
|
VhostUserSetOwner(#[source] VhostError),
|
||||||
#[error("Reset owner failed: {0}")]
|
#[error("Reset owner failed")]
|
||||||
VhostUserResetOwner(#[source] VhostError),
|
VhostUserResetOwner(#[source] VhostError),
|
||||||
#[error("Set features failed: {0}")]
|
#[error("Set features failed")]
|
||||||
VhostUserSetFeatures(#[source] VhostError),
|
VhostUserSetFeatures(#[source] VhostError),
|
||||||
#[error("Set protocol features failed: {0}")]
|
#[error("Set protocol features failed")]
|
||||||
VhostUserSetProtocolFeatures(#[source] VhostError),
|
VhostUserSetProtocolFeatures(#[source] VhostError),
|
||||||
#[error("Set mem table failed: {0}")]
|
#[error("Set mem table failed")]
|
||||||
VhostUserSetMemTable(#[source] VhostError),
|
VhostUserSetMemTable(#[source] VhostError),
|
||||||
#[error("Set vring num failed: {0}")]
|
#[error("Set vring num failed")]
|
||||||
VhostUserSetVringNum(#[source] VhostError),
|
VhostUserSetVringNum(#[source] VhostError),
|
||||||
#[error("Set vring addr failed: {0}")]
|
#[error("Set vring addr failed")]
|
||||||
VhostUserSetVringAddr(#[source] VhostError),
|
VhostUserSetVringAddr(#[source] VhostError),
|
||||||
#[error("Set vring base failed: {0}")]
|
#[error("Set vring base failed")]
|
||||||
VhostUserSetVringBase(#[source] VhostError),
|
VhostUserSetVringBase(#[source] VhostError),
|
||||||
#[error("Set vring call failed: {0}")]
|
#[error("Set vring call failed")]
|
||||||
VhostUserSetVringCall(#[source] VhostError),
|
VhostUserSetVringCall(#[source] VhostError),
|
||||||
#[error("Set vring kick failed: {0}")]
|
#[error("Set vring kick failed")]
|
||||||
VhostUserSetVringKick(#[source] VhostError),
|
VhostUserSetVringKick(#[source] VhostError),
|
||||||
#[error("Set vring enable failed: {0}")]
|
#[error("Set vring enable failed")]
|
||||||
VhostUserSetVringEnable(#[source] VhostError),
|
VhostUserSetVringEnable(#[source] VhostError),
|
||||||
#[error("Failed to create vhost eventfd: {0}")]
|
#[error("Failed to create vhost eventfd")]
|
||||||
VhostIrqCreate(#[source] io::Error),
|
VhostIrqCreate(#[source] io::Error),
|
||||||
#[error("Failed to read vhost eventfd: {0}")]
|
#[error("Failed to read vhost eventfd")]
|
||||||
VhostIrqRead(#[source] io::Error),
|
VhostIrqRead(#[source] io::Error),
|
||||||
#[error("Failed to read vhost eventfd: {0}")]
|
#[error("Failed to read vhost eventfd")]
|
||||||
VhostUserMemoryRegion(#[source] MmapError),
|
VhostUserMemoryRegion(#[source] MmapError),
|
||||||
#[error("Failed to create the frontend request handler from backend: {0}")]
|
#[error("Failed to create the frontend request handler from backend")]
|
||||||
FrontendReqHandlerCreation(#[source] vhost::vhost_user::Error),
|
FrontendReqHandlerCreation(#[source] vhost::vhost_user::Error),
|
||||||
#[error("Set backend request fd failed: {0}")]
|
#[error("Set backend request fd failed")]
|
||||||
VhostUserSetBackendRequestFd(#[source] vhost::Error),
|
VhostUserSetBackendRequestFd(#[source] vhost::Error),
|
||||||
#[error("Add memory region failed: {0}")]
|
#[error("Add memory region failed")]
|
||||||
VhostUserAddMemReg(#[source] VhostError),
|
VhostUserAddMemReg(#[source] VhostError),
|
||||||
#[error("Failed getting the configuration: {0}")]
|
#[error("Failed getting the configuration")]
|
||||||
VhostUserGetConfig(#[source] VhostError),
|
VhostUserGetConfig(#[source] VhostError),
|
||||||
#[error("Failed setting the configuration: {0}")]
|
#[error("Failed setting the configuration")]
|
||||||
VhostUserSetConfig(#[source] VhostError),
|
VhostUserSetConfig(#[source] VhostError),
|
||||||
#[error("Failed getting inflight shm log: {0}")]
|
#[error("Failed getting inflight shm log")]
|
||||||
VhostUserGetInflight(#[source] VhostError),
|
VhostUserGetInflight(#[source] VhostError),
|
||||||
#[error("Failed setting inflight shm log: {0}")]
|
#[error("Failed setting inflight shm log")]
|
||||||
VhostUserSetInflight(#[source] VhostError),
|
VhostUserSetInflight(#[source] VhostError),
|
||||||
#[error("Failed setting the log base: {0}")]
|
#[error("Failed setting the log base")]
|
||||||
VhostUserSetLogBase(#[source] VhostError),
|
VhostUserSetLogBase(#[source] VhostError),
|
||||||
#[error("Invalid used address")]
|
#[error("Invalid used address")]
|
||||||
UsedAddress,
|
UsedAddress,
|
||||||
@@ -130,17 +130,17 @@ pub enum Error {
|
|||||||
MissingRegionFd,
|
MissingRegionFd,
|
||||||
#[error("Missing IrqFd")]
|
#[error("Missing IrqFd")]
|
||||||
MissingIrqFd,
|
MissingIrqFd,
|
||||||
#[error("Failed getting the available index: {0}")]
|
#[error("Failed getting the available index")]
|
||||||
GetAvailableIndex(#[source] QueueError),
|
GetAvailableIndex(#[source] QueueError),
|
||||||
#[error("Migration is not supported by this vhost-user device")]
|
#[error("Migration is not supported by this vhost-user device")]
|
||||||
MigrationNotSupported,
|
MigrationNotSupported,
|
||||||
#[error("Failed creating memfd: {0}")]
|
#[error("Failed creating memfd")]
|
||||||
MemfdCreate(#[source] io::Error),
|
MemfdCreate(#[source] io::Error),
|
||||||
#[error("Failed truncating the file size to the expected size: {0}")]
|
#[error("Failed truncating the file size to the expected size")]
|
||||||
SetFileSize(#[source] io::Error),
|
SetFileSize(#[source] io::Error),
|
||||||
#[error("Failed to set the seals on the file: {0}")]
|
#[error("Failed to set the seals on the file")]
|
||||||
SetSeals(#[source] io::Error),
|
SetSeals(#[source] io::Error),
|
||||||
#[error("Failed creating new mmap region: {0}")]
|
#[error("Failed creating new mmap region")]
|
||||||
NewMmapRegion(#[source] MmapRegionError),
|
NewMmapRegion(#[source] MmapRegionError),
|
||||||
#[error("Could not find the shm log region")]
|
#[error("Could not find the shm log region")]
|
||||||
MissingShmLogRegion,
|
MissingShmLogRegion,
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ pub enum Error {
|
|||||||
#[error("TX buffer full")]
|
#[error("TX buffer full")]
|
||||||
TxBufFull,
|
TxBufFull,
|
||||||
/// An I/O error occurred, when attempting to flush the connection TX buffer.
|
/// An I/O error occurred, when attempting to flush the connection TX buffer.
|
||||||
#[error("Error flushing TX buffer: {0}")]
|
#[error("Error flushing TX buffer")]
|
||||||
TxBufFlush(#[source] std::io::Error),
|
TxBufFlush(#[source] std::io::Error),
|
||||||
/// An I/O error occurred, when attempting to write data to the host-side stream.
|
/// An I/O error occurred, when attempting to write data to the host-side stream.
|
||||||
#[error("Error writing to host side stream: {0}")]
|
#[error("Error writing to host side stream")]
|
||||||
StreamWrite(#[source] std::io::Error),
|
StreamWrite(#[source] std::io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,34 +31,34 @@ mod defs {
|
|||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Error converting from UTF-8
|
/// Error converting from UTF-8
|
||||||
#[error("Error converting from UTF-8: {0}")]
|
#[error("Error converting from UTF-8")]
|
||||||
ConvertFromUtf8(#[source] std::str::Utf8Error),
|
ConvertFromUtf8(#[source] std::str::Utf8Error),
|
||||||
/// Error registering a new epoll-listening FD.
|
/// Error registering a new epoll-listening FD.
|
||||||
#[error("Error registering a new epoll-listening FD: {0}")]
|
#[error("Error registering a new epoll-listening FD")]
|
||||||
EpollAdd(#[source] std::io::Error),
|
EpollAdd(#[source] std::io::Error),
|
||||||
/// Error creating an epoll FD.
|
/// Error creating an epoll FD.
|
||||||
#[error("Error creating an epoll FD: {0}")]
|
#[error("Error creating an epoll FD")]
|
||||||
EpollFdCreate(#[source] std::io::Error),
|
EpollFdCreate(#[source] std::io::Error),
|
||||||
/// The host made an invalid vsock port connection request.
|
/// The host made an invalid vsock port connection request.
|
||||||
#[error("The host made an invalid vsock port connection request")]
|
#[error("The host made an invalid vsock port connection request")]
|
||||||
InvalidPortRequest,
|
InvalidPortRequest,
|
||||||
/// Error parsing integer.
|
/// Error parsing integer.
|
||||||
#[error("Error parsing integer: {0}")]
|
#[error("Error parsing integer")]
|
||||||
ParseInteger(#[source] std::num::ParseIntError),
|
ParseInteger(#[source] std::num::ParseIntError),
|
||||||
/// Error reading stream port.
|
/// Error reading stream port.
|
||||||
#[error("Error reading stream port: {0}")]
|
#[error("Error reading stream port")]
|
||||||
ReadStreamPort(#[source] Box<Error>),
|
ReadStreamPort(#[source] Box<Error>),
|
||||||
/// Error accepting a new connection from the host-side Unix socket.
|
/// Error accepting a new connection from the host-side Unix socket.
|
||||||
#[error("Error accepting a new connection from the host-side Unix socket: {0}")]
|
#[error("Error accepting a new connection from the host-side Unix socket")]
|
||||||
UnixAccept(#[source] std::io::Error),
|
UnixAccept(#[source] std::io::Error),
|
||||||
/// Error binding to the host-side Unix socket.
|
/// Error binding to the host-side Unix socket.
|
||||||
#[error("Error binding to the host-side Unix socket: {0}")]
|
#[error("Error binding to the host-side Unix socket")]
|
||||||
UnixBind(#[source] std::io::Error),
|
UnixBind(#[source] std::io::Error),
|
||||||
/// Error connecting to a host-side Unix socket.
|
/// Error connecting to a host-side Unix socket.
|
||||||
#[error("Error connecting to a host-side Unix socket: {0}")]
|
#[error("Error connecting to a host-side Unix socket")]
|
||||||
UnixConnect(#[source] std::io::Error),
|
UnixConnect(#[source] std::io::Error),
|
||||||
/// Error reading from host-side Unix socket.
|
/// Error reading from host-side Unix socket.
|
||||||
#[error("Error reading from host-side Unix socket: {0}")]
|
#[error("Error reading from host-side Unix socket")]
|
||||||
UnixRead(#[source] std::io::Error),
|
UnixRead(#[source] std::io::Error),
|
||||||
/// Muxer connection limit reached.
|
/// Muxer connection limit reached.
|
||||||
#[error("Muxer connection limit reached")]
|
#[error("Muxer connection limit reached")]
|
||||||
|
|||||||
@@ -48,15 +48,15 @@ const WATCHDOG_TIMEOUT: u64 = WATCHDOG_TIMER_INTERVAL as u64 + 5;
|
|||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
enum Error {
|
enum Error {
|
||||||
#[error("Error programming timer fd: {0}")]
|
#[error("Error programming timer fd")]
|
||||||
TimerfdSetup(#[source] io::Error),
|
TimerfdSetup(#[source] io::Error),
|
||||||
#[error("Descriptor chain too short")]
|
#[error("Descriptor chain too short")]
|
||||||
DescriptorChainTooShort,
|
DescriptorChainTooShort,
|
||||||
#[error("Failed adding used index: {0}")]
|
#[error("Failed adding used index")]
|
||||||
QueueAddUsed(#[source] virtio_queue::Error),
|
QueueAddUsed(#[source] virtio_queue::Error),
|
||||||
#[error("Invalid descriptor")]
|
#[error("Invalid descriptor")]
|
||||||
InvalidDescriptor,
|
InvalidDescriptor,
|
||||||
#[error("Failed to write to guest memory: {0}")]
|
#[error("Failed to write to guest memory")]
|
||||||
GuestMemoryWrite(#[source] vm_memory::guest_memory::Error),
|
GuestMemoryWrite(#[source] vm_memory::guest_memory::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user