diff options
author | Eric Blake <eblake@redhat.com> | 2017-10-27 12:40:27 +0200 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2017-10-30 21:07:21 +0100 |
commit | dd6894404947d39a724ea265389fe0f2d6d5ecb7 (patch) | |
tree | f53596145ed5c1ee00c82ce4bdd96eea4691c67e /include/block | |
parent | e7a78d0eff820b56d33be31af1bb49e2948374fd (diff) |
nbd: Move nbd_errno_to_system_errno() to public header
This is needed in preparation for structured reply handling,
as we will be performing the translation from NBD error to
system errno value higher in the stack at block/nbd-client.c.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20171027104037.8319-3-eblake@redhat.com>
Diffstat (limited to 'include/block')
-rw-r--r-- | include/block/nbd.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h index a6df5ce8b5..dc62b5cd19 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -149,6 +149,18 @@ enum { * aren't overflowing some other buffer. */ #define NBD_MAX_NAME_SIZE 256 +/* NBD errors are based on errno numbers, so there is a 1:1 mapping, + * but only a limited set of errno values is specified in the protocol. + * Everything else is squashed to EINVAL. + */ +#define NBD_SUCCESS 0 +#define NBD_EPERM 1 +#define NBD_EIO 5 +#define NBD_ENOMEM 12 +#define NBD_EINVAL 22 +#define NBD_ENOSPC 28 +#define NBD_ESHUTDOWN 108 + /* Details collected by NBD_OPT_EXPORT_NAME and NBD_OPT_GO */ struct NBDExportInfo { /* Set by client before nbd_receive_negotiate() */ @@ -172,6 +184,7 @@ int nbd_send_request(QIOChannel *ioc, NBDRequest *request); int nbd_receive_reply(QIOChannel *ioc, NBDReply *reply, Error **errp); int nbd_client(int fd); int nbd_disconnect(int fd); +int nbd_errno_to_system_errno(int err); typedef struct NBDExport NBDExport; typedef struct NBDClient NBDClient; |