mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
nbd: Include error names in trace messages
NBD errors were originally sent over the wire based on Linux errno values; but not all the world is Linux, and not all platforms share the same values. Since a number isn't very easy to decipher on all platforms, update the trace messages to include the name of NBD errors being sent/received over the wire. Tweak the trace messages to be at the point where we are using the NBD error, not the translation to the host errno values. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20171027104037.8319-2-eblake@redhat.com>
This commit is contained in:
parent
abf6e752e5
commit
e7a78d0eff
5 changed files with 30 additions and 4 deletions
23
nbd/common.c
23
nbd/common.c
|
@ -148,3 +148,26 @@ const char *nbd_cmd_lookup(uint16_t cmd)
|
|||
return "<unknown>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *nbd_err_lookup(int err)
|
||||
{
|
||||
switch (err) {
|
||||
case NBD_SUCCESS:
|
||||
return "success";
|
||||
case NBD_EPERM:
|
||||
return "EPERM";
|
||||
case NBD_EIO:
|
||||
return "EIO";
|
||||
case NBD_ENOMEM:
|
||||
return "ENOMEM";
|
||||
case NBD_EINVAL:
|
||||
return "EINVAL";
|
||||
case NBD_ENOSPC:
|
||||
return "ENOSPC";
|
||||
case NBD_ESHUTDOWN:
|
||||
return "ESHUTDOWN";
|
||||
default:
|
||||
return "<unknown>";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue