misc: block: 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
06a868cb85
commit
aebbd1aecd
7 changed files with 52 additions and 52 deletions
|
|
@ -13,10 +13,10 @@ use crate::DiskTopology;
|
|||
#[derive(Error, Debug)]
|
||||
pub enum DiskFileError {
|
||||
/// Failed getting disk file size.
|
||||
#[error("Failed getting disk file size: {0}")]
|
||||
#[error("Failed getting disk file size")]
|
||||
Size(#[source] std::io::Error),
|
||||
/// Failed creating a new AsyncIo.
|
||||
#[error("Failed creating a new AsyncIo: {0}")]
|
||||
#[error("Failed creating a new AsyncIo")]
|
||||
NewAsyncIo(#[source] std::io::Error),
|
||||
}
|
||||
|
||||
|
|
@ -71,13 +71,13 @@ pub trait DiskFile: Send {
|
|||
#[derive(Error, Debug)]
|
||||
pub enum AsyncIoError {
|
||||
/// Failed vectored reading from file.
|
||||
#[error("Failed vectored reading from file: {0}")]
|
||||
#[error("Failed vectored reading from file")]
|
||||
ReadVectored(#[source] std::io::Error),
|
||||
/// Failed vectored writing to file.
|
||||
#[error("Failed vectored writing to file: {0}")]
|
||||
#[error("Failed vectored writing to file")]
|
||||
WriteVectored(#[source] std::io::Error),
|
||||
/// Failed synchronizing file.
|
||||
#[error("Failed synchronizing file: {0}")]
|
||||
#[error("Failed synchronizing file")]
|
||||
Fsync(#[source] std::io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ pub enum LockError {
|
|||
#[error("The file is already locked")]
|
||||
AlreadyLocked,
|
||||
/// IO error.
|
||||
#[error("The lock state could not be checked or set: {0}")]
|
||||
#[error("The lock state could not be checked or set")]
|
||||
Io(#[source] io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,21 +79,21 @@ pub enum Error {
|
|||
DescriptorChainTooShort,
|
||||
#[error("Guest gave us a descriptor that was too short to use")]
|
||||
DescriptorLengthTooSmall,
|
||||
#[error("Failed to detect image type: {0}")]
|
||||
#[error("Failed to detect image type")]
|
||||
DetectImageType(#[source] std::io::Error),
|
||||
#[error("Failure in fixed vhd: {0}")]
|
||||
#[error("Failure in fixed vhd")]
|
||||
FixedVhdError(#[source] std::io::Error),
|
||||
#[error("Getting a block's metadata fails for any reason")]
|
||||
GetFileMetadata,
|
||||
#[error("The requested operation would cause a seek beyond disk end")]
|
||||
InvalidOffset,
|
||||
#[error("Failure in qcow: {0}")]
|
||||
#[error("Failure in qcow")]
|
||||
QcowError(#[source] qcow::Error),
|
||||
#[error("Failure in raw file: {0}")]
|
||||
#[error("Failure in raw file")]
|
||||
RawFileError(#[source] std::io::Error),
|
||||
#[error("The requested operation does not support multiple descriptors")]
|
||||
TooManyDescriptors,
|
||||
#[error("Failure in vhdx: {0}")]
|
||||
#[error("Failure in vhdx")]
|
||||
VhdxError(#[source] VhdxError),
|
||||
}
|
||||
|
||||
|
|
@ -131,33 +131,33 @@ pub fn build_serial(disk_path: &Path) -> Vec<u8> {
|
|||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ExecuteError {
|
||||
#[error("Bad request: {0}")]
|
||||
#[error("Bad request")]
|
||||
BadRequest(#[source] Error),
|
||||
#[error("Failed to flush: {0}")]
|
||||
#[error("Failed to flush")]
|
||||
Flush(#[source] io::Error),
|
||||
#[error("Failed to read: {0}")]
|
||||
#[error("Failed to read")]
|
||||
Read(#[source] GuestMemoryError),
|
||||
#[error("Failed to read_exact: {0}")]
|
||||
#[error("Failed to read_exact")]
|
||||
ReadExact(#[source] io::Error),
|
||||
#[error("Failed to seek: {0}")]
|
||||
#[error("Failed to seek")]
|
||||
Seek(#[source] io::Error),
|
||||
#[error("Failed to write: {0}")]
|
||||
#[error("Failed to write")]
|
||||
Write(#[source] GuestMemoryError),
|
||||
#[error("Failed to write_all: {0}")]
|
||||
#[error("Failed to write_all")]
|
||||
WriteAll(#[source] io::Error),
|
||||
#[error("Unsupported request: {0}")]
|
||||
Unsupported(u32),
|
||||
#[error("Failed to submit io uring: {0}")]
|
||||
#[error("Failed to submit io uring")]
|
||||
SubmitIoUring(#[source] io::Error),
|
||||
#[error("Failed to get guest address: {0}")]
|
||||
#[error("Failed to get guest address")]
|
||||
GetHostAddress(#[source] GuestMemoryError),
|
||||
#[error("Failed to async read: {0}")]
|
||||
#[error("Failed to async read")]
|
||||
AsyncRead(#[source] AsyncIoError),
|
||||
#[error("Failed to async write: {0}")]
|
||||
#[error("Failed to async write")]
|
||||
AsyncWrite(#[source] AsyncIoError),
|
||||
#[error("failed to async flush: {0}")]
|
||||
#[error("failed to async flush")]
|
||||
AsyncFlush(#[source] AsyncIoError),
|
||||
#[error("Failed allocating a temporary buffer: {0}")]
|
||||
#[error("Failed allocating a temporary buffer")]
|
||||
TemporaryBufferAllocation(#[source] io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,23 +36,23 @@ const MAX_NESTING_DEPTH: u32 = 10;
|
|||
#[sorted]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error("Backing file io error: {0}")]
|
||||
#[error("Backing file io error")]
|
||||
BackingFileIo(#[source] io::Error),
|
||||
#[error("Backing file open error: {0}")]
|
||||
#[error("Backing file open error")]
|
||||
BackingFileOpen(#[source] Box<Error>),
|
||||
#[error("Backing file name is too long: {0} bytes over")]
|
||||
BackingFileTooLong(usize),
|
||||
#[error("Compressed blocks not supported")]
|
||||
CompressedBlocksNotSupported,
|
||||
#[error("Failed to evict cache: {0}")]
|
||||
#[error("Failed to evict cache")]
|
||||
EvictingCache(#[source] io::Error),
|
||||
#[error("File larger than max of {MAX_QCOW_FILE_SIZE}: {0}")]
|
||||
FileTooBig(u64),
|
||||
#[error("Failed to get file size: {0}")]
|
||||
#[error("Failed to get file size")]
|
||||
GettingFileSize(#[source] io::Error),
|
||||
#[error("Failed to get refcount: {0}")]
|
||||
#[error("Failed to get refcount")]
|
||||
GettingRefcount(#[source] refcount::Error),
|
||||
#[error("Failed to parse filename: {0}")]
|
||||
#[error("Failed to parse filename")]
|
||||
InvalidBackingFileName(#[source] str::Utf8Error),
|
||||
#[error("Invalid cluster index")]
|
||||
InvalidClusterIndex,
|
||||
|
|
@ -82,27 +82,27 @@ pub enum Error {
|
|||
NotEnoughSpaceForRefcounts,
|
||||
#[error("Failed to open file {0}")]
|
||||
OpeningFile(#[source] io::Error),
|
||||
#[error("Failed to read data: {0}")]
|
||||
#[error("Failed to read data")]
|
||||
ReadingData(#[source] io::Error),
|
||||
#[error("Failed to read header: {0}")]
|
||||
#[error("Failed to read header")]
|
||||
ReadingHeader(#[source] io::Error),
|
||||
#[error("Failed to read pointers: {0}")]
|
||||
#[error("Failed to read pointers")]
|
||||
ReadingPointers(#[source] io::Error),
|
||||
#[error("Failed to read ref count block: {0}")]
|
||||
#[error("Failed to read ref count block")]
|
||||
ReadingRefCountBlock(#[source] refcount::Error),
|
||||
#[error("Failed to read ref counts: {0}")]
|
||||
#[error("Failed to read ref counts")]
|
||||
ReadingRefCounts(#[source] io::Error),
|
||||
#[error("Failed to rebuild ref counts: {0}")]
|
||||
#[error("Failed to rebuild ref counts")]
|
||||
RebuildingRefCounts(#[source] io::Error),
|
||||
#[error("Refcount table offset past file end")]
|
||||
RefcountTableOffEnd,
|
||||
#[error("Too many clusters specified for refcount")]
|
||||
RefcountTableTooLarge,
|
||||
#[error("Failed to seek file: {0}")]
|
||||
#[error("Failed to seek file")]
|
||||
SeekingFile(#[source] io::Error),
|
||||
#[error("Failed to set file size: {0}")]
|
||||
#[error("Failed to set file size")]
|
||||
SettingFileSize(#[source] io::Error),
|
||||
#[error("Failed to set refcount refcount: {0}")]
|
||||
#[error("Failed to set refcount refcount")]
|
||||
SettingRefcountRefcount(#[source] io::Error),
|
||||
#[error("Size too small for number of clusters")]
|
||||
SizeTooSmallForNumberOfClusters,
|
||||
|
|
@ -114,9 +114,9 @@ pub enum Error {
|
|||
UnsupportedRefcountOrder,
|
||||
#[error("Unsupported version: {0}")]
|
||||
UnsupportedVersion(u32),
|
||||
#[error("Failed to write data: {0}")]
|
||||
#[error("Failed to write data")]
|
||||
WritingData(#[source] io::Error),
|
||||
#[error("Failed to write header: {0}")]
|
||||
#[error("Failed to write header")]
|
||||
WritingHeader(#[source] io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use crate::qcow::vec_cache::{CacheMap, Cacheable, VecCache};
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
/// `EvictingCache` - Error writing a refblock from the cache to disk.
|
||||
#[error("Failed to write a refblock from the cache to disk: {0}")]
|
||||
#[error("Failed to write a refblock from the cache to disk")]
|
||||
EvictingRefCounts(#[source] io::Error),
|
||||
/// `InvalidIndex` - Address requested isn't within the range of the disk.
|
||||
#[error("Address requested is not within the range of the disk")]
|
||||
|
|
@ -27,7 +27,7 @@ pub enum Error {
|
|||
#[error("New cluster needs to be allocated for refcounts")]
|
||||
NeedNewCluster,
|
||||
/// `ReadingRefCounts` - Error reading the file into the refcount cache.
|
||||
#[error("Failed to read the file into the refcount cache: {0}")]
|
||||
#[error("Failed to read the file into the refcount cache")]
|
||||
ReadingRefCounts(#[source] io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,19 +26,19 @@ mod vhdx_metadata;
|
|||
#[sorted]
|
||||
#[derive(Error, Debug)]
|
||||
pub enum VhdxError {
|
||||
#[error("Not a VHDx file: {0}")]
|
||||
#[error("Not a VHDx file")]
|
||||
NotVhdx(#[source] VhdxHeaderError),
|
||||
#[error("Failed to parse VHDx header: {0}")]
|
||||
#[error("Failed to parse VHDx header")]
|
||||
ParseVhdxHeader(#[source] VhdxHeaderError),
|
||||
#[error("Failed to parse VHDx metadata: {0}")]
|
||||
#[error("Failed to parse VHDx metadata")]
|
||||
ParseVhdxMetadata(#[source] VhdxMetadataError),
|
||||
#[error("Failed to parse VHDx region entries: {0}")]
|
||||
#[error("Failed to parse VHDx region entries")]
|
||||
ParseVhdxRegionEntry(#[source] VhdxHeaderError),
|
||||
#[error("Failed reading metadata: {0}")]
|
||||
#[error("Failed reading metadata")]
|
||||
ReadBatEntry(#[source] VhdxBatError),
|
||||
#[error("Failed reading sector from disk: {0}")]
|
||||
#[error("Failed reading sector from disk")]
|
||||
ReadFailed(#[source] VhdxIoError),
|
||||
#[error("Failed writing to sector on disk: {0}")]
|
||||
#[error("Failed writing to sector on disk")]
|
||||
WriteFailed(#[source] VhdxIoError),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ pub enum VhdxBatError {
|
|||
InvalidBatEntry,
|
||||
#[error("Invalid BAT entry count")]
|
||||
InvalidEntryCount,
|
||||
#[error("Failed to read BAT entry: {0}")]
|
||||
#[error("Failed to read BAT entry")]
|
||||
ReadBat(#[source] io::Error),
|
||||
#[error("Failed to write BAT entry: {0}")]
|
||||
#[error("Failed to write BAT entry")]
|
||||
WriteBat(#[source] io::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue