misc: Unify error message punctuation

Considering error messages will be mostly nested, ensuring no
punctuation at the end will make the error log more readable.

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2022-10-20 11:45:16 -07:00
committed by Sebastien Boeuf
parent 7d71319210
commit 2af2cc539f
9 changed files with 55 additions and 55 deletions

View File

@@ -51,23 +51,23 @@ pub const SECTOR_SIZE: u64 = 0x01 << SECTOR_SHIFT;
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum Error { pub enum Error {
#[error("Guest gave us bad memory addresses.")] #[error("Guest gave us bad memory addresses")]
GuestMemory(GuestMemoryError), GuestMemory(GuestMemoryError),
#[error("Guest gave us offsets that would have overflowed a usize.")] #[error("Guest gave us offsets that would have overflowed a usize")]
CheckedOffset(GuestAddress, usize), CheckedOffset(GuestAddress, usize),
#[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 gave us a read only descriptor that protocol says to write to.")] #[error("Guest gave us a read only descriptor that protocol says to write to")]
UnexpectedReadOnlyDescriptor, UnexpectedReadOnlyDescriptor,
#[error("Guest gave us too few descriptors in a descriptor chain.")] #[error("Guest gave us too few descriptors in a descriptor chain")]
DescriptorChainTooShort, DescriptorChainTooShort,
#[error("Guest gave us a descriptor that was too short to use.")] #[error("Guest gave us a descriptor that was too short to use")]
DescriptorLengthTooSmall, DescriptorLengthTooSmall,
#[error("Getting a block's metadata fails for any reason.")] #[error("Getting a block's metadata fails for any reason")]
GetFileMetadata, GetFileMetadata,
#[error("The requested operation would cause a seek beyond disk end.")] #[error("The requested operation would cause a seek beyond disk end")]
InvalidOffset, InvalidOffset,
#[error("The requested operation does not support multiple descriptors.")] #[error("The requested operation does not support multiple descriptors")]
TooManyDescriptors, TooManyDescriptors,
} }

View File

@@ -12,9 +12,9 @@ use thiserror::Error;
pub enum Error { pub enum Error {
#[error("Failed to convert an hexadecimal string into an integer: {0}")] #[error("Failed to convert an hexadecimal string into an integer: {0}")]
ConvertHexStringToInt(std::num::ParseIntError), ConvertHexStringToInt(std::num::ParseIntError),
#[error("Error related to the multiqueue support (no support TAP side).")] #[error("Error related to the multiqueue support (no support TAP side)")]
MultiQueueNoTapSupport, MultiQueueNoTapSupport,
#[error("Error related to the multiqueue support (no support device side).")] #[error("Error related to the multiqueue support (no support device side)")]
MultiQueueNoDeviceSupport, MultiQueueNoDeviceSupport,
#[error("Failed to read the TAP flags from sysfs: {0}")] #[error("Failed to read the TAP flags from sysfs: {0}")]
ReadSysfsTunFlags(io::Error), ReadSysfsTunFlags(io::Error),

View File

@@ -288,7 +288,7 @@ pub struct NetCounters {
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum NetQueuePairError { pub enum NetQueuePairError {
#[error("No memory configured.")] #[error("No memory configured")]
NoMemoryConfigured, NoMemoryConfigured,
#[error("Error registering listener: {0}")] #[error("Error registering listener: {0}")]
RegisterListener(io::Error), RegisterListener(io::Error),
@@ -302,9 +302,9 @@ pub enum NetQueuePairError {
GuestMemory(vm_memory::GuestMemoryError), GuestMemory(vm_memory::GuestMemoryError),
#[error("Returned an error while iterating through the queue: {0}")] #[error("Returned an error while iterating through the queue: {0}")]
QueueIteratorFailed(virtio_queue::Error), QueueIteratorFailed(virtio_queue::Error),
#[error("Descriptor chain is too short.")] #[error("Descriptor chain is too short")]
DescriptorChainTooShort, DescriptorChainTooShort,
#[error("Descriptor chain does not contain valid descriptors.")] #[error("Descriptor chain does not contain valid descriptors")]
DescriptorChainInvalid, DescriptorChainInvalid,
#[error("Failed to determine if queue needed notification: {0}")] #[error("Failed to determine if queue needed notification: {0}")]
QueueNeedsNotification(virtio_queue::Error), QueueNeedsNotification(virtio_queue::Error),

View File

@@ -26,13 +26,13 @@ pub enum Error {
ConfigureTap(IoError), ConfigureTap(IoError),
#[error("Unable to retrieve features: {0}")] #[error("Unable to retrieve features: {0}")]
GetFeatures(IoError), GetFeatures(IoError),
#[error("Missing multiqueue support in the kernel.")] #[error("Missing multiqueue support in the kernel")]
MultiQueueKernelSupport, MultiQueueKernelSupport,
#[error("ioctl failed: {0}")] #[error("ioctl failed: {0}")]
IoctlError(IoError), IoctlError(IoError),
#[error("Failed to create a socket: {0}")] #[error("Failed to create a socket: {0}")]
NetUtil(NetUtilError), NetUtil(NetUtilError),
#[error("Invalid interface name.")] #[error("Invalid interface name")]
InvalidIfname, InvalidIfname,
#[error("Error parsing MAC data: {0}")] #[error("Error parsing MAC data: {0}")]
MacParsing(IoError), MacParsing(IoError),

View File

@@ -62,9 +62,9 @@ const VIRTIO_BALLOON_F_REPORTING: u64 = 5;
pub enum Error { pub enum Error {
#[error("Guest gave us bad memory addresses.: {0}")] #[error("Guest gave us bad memory addresses.: {0}")]
GuestMemory(GuestMemoryError), GuestMemory(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.: {0}")]
FallocateFail(std::io::Error), FallocateFail(std::io::Error),

View File

@@ -284,39 +284,39 @@ 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: {0}")]
GuestMemory(GuestMemoryError), GuestMemory(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 gave us a read only descriptor that protocol says to write to.")] #[error("Guest gave us a read only descriptor that protocol says to write to")]
UnexpectedReadOnlyDescriptor, UnexpectedReadOnlyDescriptor,
#[error("Guest gave us too few descriptors in a descriptor chain.")] #[error("Guest gave us too few descriptors in a descriptor chain")]
DescriptorChainTooShort, DescriptorChainTooShort,
#[error("Guest gave us a buffer that was too short to use.")] #[error("Guest gave us a buffer that was too short to use")]
BufferLengthTooSmall, BufferLengthTooSmall,
#[error("Guest sent us invalid request.")] #[error("Guest sent us invalid request")]
InvalidRequest, InvalidRequest,
#[error("Guest sent us invalid ATTACH request.")] #[error("Guest sent us invalid ATTACH request")]
InvalidAttachRequest, InvalidAttachRequest,
#[error("Guest sent us invalid DETACH request.")] #[error("Guest sent us invalid DETACH request")]
InvalidDetachRequest, InvalidDetachRequest,
#[error("Guest sent us invalid MAP request.")] #[error("Guest sent us invalid MAP request")]
InvalidMapRequest, InvalidMapRequest,
#[error("Invalid to map because the domain is in bypass mode.")] #[error("Invalid to map because the domain is in bypass mode")]
InvalidMapRequestBypassDomain, InvalidMapRequestBypassDomain,
#[error("Invalid to map because the domain is missing.")] #[error("Invalid to map because the domain is missing")]
InvalidMapRequestMissingDomain, InvalidMapRequestMissingDomain,
#[error("Guest sent us invalid UNMAP request.")] #[error("Guest sent us invalid UNMAP request")]
InvalidUnmapRequest, InvalidUnmapRequest,
#[error("Invalid to unmap because the domain is in bypass mode.")] #[error("Invalid to unmap because the domain is in bypass mode")]
InvalidUnmapRequestBypassDomain, InvalidUnmapRequestBypassDomain,
#[error("Invalid to unmap because the domain is missing.")] #[error("Invalid to unmap because the domain is missing")]
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: {0}")]
ExternalMapping(io::Error), ExternalMapping(io::Error),
#[error("Failed to performing external unmapping: {0}.")] #[error("Failed to performing external unmapping: {0}")]
ExternalUnmapping(io::Error), ExternalUnmapping(io::Error),
#[error("Failed adding used index: {0}")] #[error("Failed adding used index: {0}")]
QueueAddUsed(virtio_queue::Error), QueueAddUsed(virtio_queue::Error),

View File

@@ -80,7 +80,7 @@ const VIRTIO_F_NOTIFICATION_DATA: u32 = 38;
#[derive(Error, Debug)] #[derive(Error, Debug)]
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: {0}")]
CloneExitEventFd(std::io::Error), CloneExitEventFd(std::io::Error),
@@ -112,7 +112,7 @@ pub enum Error {
VhostUserUpdateMemory(vhost_user::Error), VhostUserUpdateMemory(vhost_user::Error),
#[error("Failed to add memory region vhost-user: {0}")] #[error("Failed to add memory region vhost-user: {0}")]
VhostUserAddMemoryRegion(vhost_user::Error), VhostUserAddMemoryRegion(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: {0}")]
NetQueuePair(::net_util::NetQueuePairError), NetQueuePair(::net_util::NetQueuePairError),

View File

@@ -105,15 +105,15 @@ const VIRTIO_MEM_F_ACPI_PXM: u8 = 0;
pub enum Error { pub enum Error {
#[error("Guest gave us bad memory addresses: {0}")] #[error("Guest gave us bad memory addresses: {0}")]
GuestMemory(GuestMemoryError), GuestMemory(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 gave us a read only descriptor that protocol says to write to.")] #[error("Guest gave us a read only descriptor that protocol says to write to")]
UnexpectedReadOnlyDescriptor, UnexpectedReadOnlyDescriptor,
#[error("Guest gave us too few descriptors in a descriptor chain.")] #[error("Guest gave us too few descriptors in a descriptor chain")]
DescriptorChainTooShort, DescriptorChainTooShort,
#[error("Guest gave us a buffer that was too short to use.")] #[error("Guest gave us a buffer that was too short to use")]
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: {0}")]
EventFdWriteFail(std::io::Error), EventFdWriteFail(std::io::Error),
@@ -133,9 +133,9 @@ pub enum Error {
DmaMap(std::io::Error), DmaMap(std::io::Error),
#[error("Failed DMA unmapping: {0}")] #[error("Failed DMA unmapping: {0}")]
DmaUnmap(std::io::Error), DmaUnmap(std::io::Error),
#[error("Invalid DMA mapping handler.")] #[error("Invalid DMA mapping handler")]
InvalidDmaMappingHandler, InvalidDmaMappingHandler,
#[error("Not activated by the guest.")] #[error("Not activated by the guest")]
NotActivatedByGuest, NotActivatedByGuest,
#[error("Unknown request type: {0}")] #[error("Unknown request type: {0}")]
UnkownRequestType(u16), UnkownRequestType(u16),

View File

@@ -43,9 +43,9 @@ pub use self::vu_common_ctrl::VhostUserConfig;
pub enum Error { pub enum Error {
#[error("Failed accepting connection: {0}")] #[error("Failed accepting connection: {0}")]
AcceptConnection(io::Error), AcceptConnection(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: {0}")]
BindSocket(io::Error), BindSocket(io::Error),
@@ -53,7 +53,7 @@ pub enum Error {
CreateKillEventFd(io::Error), CreateKillEventFd(io::Error),
#[error("Cloning kill eventfd failed: {0}")] #[error("Cloning kill eventfd failed: {0}")]
CloneKillEventFd(io::Error), CloneKillEventFd(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: {0}")]
FailedSignalingUsedQueue(io::Error), FailedSignalingUsedQueue(io::Error),
@@ -65,7 +65,7 @@ pub enum Error {
VhostUserCreateMaster(VhostError), VhostUserCreateMaster(VhostError),
#[error("Failed to open vhost device: {0}")] #[error("Failed to open vhost device: {0}")]
VhostUserOpen(VhostError), VhostUserOpen(VhostError),
#[error("Connection to socket failed.")] #[error("Connection to socket failed")]
VhostUserConnect, VhostUserConnect,
#[error("Get features failed: {0}")] #[error("Get features failed: {0}")]
VhostUserGetFeatures(VhostError), VhostUserGetFeatures(VhostError),
@@ -75,7 +75,7 @@ pub enum Error {
VhostUserGetProtocolFeatures(VhostError), VhostUserGetProtocolFeatures(VhostError),
#[error("Get vring base failed: {0}")] #[error("Get vring base failed: {0}")]
VhostUserGetVringBase(VhostError), VhostUserGetVringBase(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: {0}")]
VhostUserSetOwner(VhostError), VhostUserSetOwner(VhostError),
@@ -121,17 +121,17 @@ pub enum Error {
VhostUserSetInflight(VhostError), VhostUserSetInflight(VhostError),
#[error("Failed setting the log base: {0}")] #[error("Failed setting the log base: {0}")]
VhostUserSetLogBase(VhostError), VhostUserSetLogBase(VhostError),
#[error("Invalid used address.")] #[error("Invalid used address")]
UsedAddress, UsedAddress,
#[error("Invalid features provided from vhost-user backe.")] #[error("Invalid features provided from vhost-user backe")]
InvalidFeatures, InvalidFeatures,
#[error("Missing file descriptor for the region.")] #[error("Missing file descriptor for the region")]
MissingRegionFd, MissingRegionFd,
#[error("Missing IrqFd.")] #[error("Missing IrqFd")]
MissingIrqFd, MissingIrqFd,
#[error("Failed getting the available index: {0}")] #[error("Failed getting the available index: {0}")]
GetAvailableIndex(QueueError), GetAvailableIndex(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: {0}")]
MemfdCreate(io::Error), MemfdCreate(io::Error),
@@ -141,7 +141,7 @@ pub enum Error {
SetSeals(io::Error), SetSeals(io::Error),
#[error("Failed creating new mmap region: {0}")] #[error("Failed creating new mmap region: {0}")]
NewMmapRegion(MmapRegionError), NewMmapRegion(MmapRegionError),
#[error("Could not find the shm log region.")] #[error("Could not find the shm log region")]
MissingShmLogRegion, MissingShmLogRegion,
} }
type Result<T> = std::result::Result<T, Error>; type Result<T> = std::result::Result<T, Error>;