misc: tpm: 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:31:40 +02:00
committed by Rob Bradford
parent 1ede418dcc
commit 3541cebbf1
3 changed files with 11 additions and 11 deletions

View File

@@ -45,19 +45,19 @@ pub fn is_selftest(input: &[u8]) -> bool {
#[derive(Error, Debug)]
pub enum Error {
#[error("Could not initialize emulator's backend: {0}")]
#[error("Could not initialize emulator's backend")]
InitializeEmulator(#[source] anyhow::Error),
#[error("Failed to create data fd to pass to swtpm: {0}")]
#[error("Failed to create data fd to pass to swtpm")]
PrepareDataFd(#[source] anyhow::Error),
#[error("Failed to run Control Cmd: {0}")]
#[error("Failed to run Control Cmd")]
RunControlCmd(#[source] anyhow::Error),
#[error("Emulator doesn't implement min required capabilities: {0}")]
#[error("Emulator doesn't implement min required capabilities")]
CheckCaps(#[source] anyhow::Error),
#[error("Emulator failed to deliver request: {0}")]
#[error("Emulator failed to deliver request")]
DeliverRequest(#[source] anyhow::Error),
#[error("Emulator failed to send/receive msg on data fd: {0}")]
#[error("Emulator failed to send/receive msg on data fd")]
SendReceive(#[source] anyhow::Error),
#[error("Incorrect response to Self Test: {0}")]
#[error("Incorrect response to Self Test")]
SelfTest(#[source] anyhow::Error),
}

View File

@@ -46,7 +46,7 @@ pub enum Commands {
#[derive(Error, Debug)]
pub enum Error {
#[error("Failed converting buf to PTM : {0}")]
#[error("Failed converting buf to PTM ")]
ConvertToPtm(#[source] anyhow::Error),
}
type Result<T> = anyhow::Result<T, Error>;

View File

@@ -13,11 +13,11 @@ use vmm_sys_util::sock_ctrl_msg::ScmSocket;
#[derive(Error, Debug)]
pub enum Error {
#[error("Cannot connect to tpm Socket: {0}")]
#[error("Cannot connect to tpm Socket")]
ConnectToSocket(#[source] anyhow::Error),
#[error("Failed to read from socket: {0}")]
#[error("Failed to read from socket")]
ReadFromSocket(#[source] anyhow::Error),
#[error("Failed to write to socket: {0}")]
#[error("Failed to write to socket")]
WriteToSocket(#[source] anyhow::Error),
}
type Result<T> = anyhow::Result<T, Error>;