misc: net_util: 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:
Philipp Schuster
2025-05-21 12:32:04 +02:00
committed by Rob Bradford
parent 72c8178335
commit 67896333e3
4 changed files with 24 additions and 24 deletions

View File

@@ -40,7 +40,7 @@ pub use tap::{Error as TapError, Tap};
#[derive(Error, Debug)]
pub enum Error {
#[error("Failed to create a socket: {0}")]
#[error("Failed to create a socket")]
CreateSocket(#[source] IoError),
}

View File

@@ -12,27 +12,27 @@ use super::{vnet_hdr_len, MacAddr, Tap, TapError};
#[derive(Error, Debug)]
pub enum Error {
#[error("Failed to convert an hexadecimal string into an integer: {0}")]
#[error("Failed to convert an hexadecimal string into an integer")]
ConvertHexStringToInt(#[source] std::num::ParseIntError),
#[error("Error related to the multiqueue support (no support TAP side)")]
MultiQueueNoTapSupport,
#[error("Error related to the multiqueue support (no support device side)")]
MultiQueueNoDeviceSupport,
#[error("Failed to read the TAP flags from sysfs: {0}")]
#[error("Failed to read the TAP flags from sysfs")]
ReadSysfsTunFlags(#[source] io::Error),
#[error("Open tap device failed: {0}")]
#[error("Open tap device failed")]
TapOpen(#[source] TapError),
#[error("Setting tap IP and/or netmask failed: {0}")]
#[error("Setting tap IP and/or netmask failed")]
TapSetIpNetmask(#[source] TapError),
#[error("Setting MAC address failed: {0}")]
#[error("Setting MAC address failed")]
TapSetMac(#[source] TapError),
#[error("Getting MAC address failed: {0}")]
#[error("Getting MAC address failed")]
TapGetMac(#[source] TapError),
#[error("Setting vnet header size failed: {0}")]
#[error("Setting vnet header size failed")]
TapSetVnetHdrSize(#[source] TapError),
#[error("Setting MTU failed: {0}")]
#[error("Setting MTU failed")]
TapSetMtu(#[source] TapError),
#[error("Enabling tap interface failed: {0}")]
#[error("Enabling tap interface failed")]
TapEnable(#[source] TapError),
}

View File

@@ -353,27 +353,27 @@ pub struct NetCounters {
pub enum NetQueuePairError {
#[error("No memory configured")]
NoMemoryConfigured,
#[error("Error registering listener: {0}")]
#[error("Error registering listener")]
RegisterListener(#[source] io::Error),
#[error("Error unregistering listener: {0}")]
#[error("Error unregistering listener")]
UnregisterListener(#[source] io::Error),
#[error("Error writing to the TAP device: {0}")]
#[error("Error writing to the TAP device")]
WriteTap(#[source] io::Error),
#[error("Error reading from the TAP device: {0}")]
#[error("Error reading from the TAP device")]
ReadTap(#[source] io::Error),
#[error("Error related to guest memory: {0}")]
#[error("Error related to guest memory")]
GuestMemory(#[source] vm_memory::GuestMemoryError),
#[error("Returned an error while iterating through the queue: {0}")]
#[error("Returned an error while iterating through the queue")]
QueueIteratorFailed(#[source] virtio_queue::Error),
#[error("Descriptor chain is too short")]
DescriptorChainTooShort,
#[error("Descriptor chain does not contain valid descriptors")]
DescriptorChainInvalid,
#[error("Failed to determine if queue needed notification: {0}")]
#[error("Failed to determine if queue needed notification")]
QueueNeedsNotification(#[source] virtio_queue::Error),
#[error("Failed to enable notification on the queue: {0}")]
#[error("Failed to enable notification on the queue")]
QueueEnableNotification(#[source] virtio_queue::Error),
#[error("Failed to add used index to the queue: {0}")]
#[error("Failed to add used index to the queue")]
QueueAddUsed(#[source] virtio_queue::Error),
#[error("Descriptor with invalid virtio-net header")]
DescriptorInvalidHeader,

View File

@@ -22,21 +22,21 @@ use crate::mac::MAC_ADDR_LEN;
#[derive(Error, Debug)]
pub enum Error {
#[error("Couldn't open /dev/net/tun: {0}")]
#[error("Couldn't open /dev/net/tun")]
OpenTun(#[source] IoError),
#[error("Unable to configure tap interface: {0}")]
#[error("Unable to configure tap interface")]
ConfigureTap(#[source] IoError),
#[error("Unable to retrieve features: {0}")]
#[error("Unable to retrieve features")]
GetFeatures(#[source] IoError),
#[error("Missing multiqueue support in the kernel")]
MultiQueueKernelSupport,
#[error("ioctl ({0}) failed: {1}")]
IoctlError(c_ulong, #[source] IoError),
#[error("Failed to create a socket: {0}")]
#[error("Failed to create a socket")]
NetUtil(#[source] NetUtilError),
#[error("Invalid interface name")]
InvalidIfname,
#[error("Error parsing MAC data: {0}")]
#[error("Error parsing MAC data")]
MacParsing(#[source] IoError),
#[error("Invalid netmask")]
InvalidNetmask,