mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
nbd: Add types for extended headers
Add the constants and structs necessary for later patches to start implementing the NBD_OPT_EXTENDED_HEADERS extension in both the client and server, matching recent upstream nbd.git (through commit e6f3b94a934). This patch does not change any existing behavior, but merely sets the stage for upcoming patches. This patch does not change the status quo that neither the client nor server use a packed-struct representation for the request header. While most of the patch adds new types, there is also some churn for renaming the existing NBDExtent to NBDExtent32 to contrast it with NBDExtent64, which I thought was a nicer name than NBDExtentExt. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-ID: <20230829175826.377251-22-eblake@redhat.com>
This commit is contained in:
parent
297365b40f
commit
d95ffb6fe6
5 changed files with 106 additions and 45 deletions
12
nbd/common.c
12
nbd/common.c
|
@ -79,6 +79,8 @@ const char *nbd_opt_lookup(uint32_t opt)
|
|||
return "list meta context";
|
||||
case NBD_OPT_SET_META_CONTEXT:
|
||||
return "set meta context";
|
||||
case NBD_OPT_EXTENDED_HEADERS:
|
||||
return "extended headers";
|
||||
default:
|
||||
return "<unknown>";
|
||||
}
|
||||
|
@ -112,6 +114,10 @@ const char *nbd_rep_lookup(uint32_t rep)
|
|||
return "server shutting down";
|
||||
case NBD_REP_ERR_BLOCK_SIZE_REQD:
|
||||
return "block size required";
|
||||
case NBD_REP_ERR_TOO_BIG:
|
||||
return "option payload too big";
|
||||
case NBD_REP_ERR_EXT_HEADER_REQD:
|
||||
return "extended headers required";
|
||||
default:
|
||||
return "<unknown>";
|
||||
}
|
||||
|
@ -170,7 +176,9 @@ const char *nbd_reply_type_lookup(uint16_t type)
|
|||
case NBD_REPLY_TYPE_OFFSET_HOLE:
|
||||
return "hole";
|
||||
case NBD_REPLY_TYPE_BLOCK_STATUS:
|
||||
return "block status";
|
||||
return "block status (32-bit)";
|
||||
case NBD_REPLY_TYPE_BLOCK_STATUS_EXT:
|
||||
return "block status (64-bit)";
|
||||
case NBD_REPLY_TYPE_ERROR:
|
||||
return "generic error";
|
||||
case NBD_REPLY_TYPE_ERROR_OFFSET:
|
||||
|
@ -261,6 +269,8 @@ const char *nbd_mode_lookup(NBDMode mode)
|
|||
return "simple headers";
|
||||
case NBD_MODE_STRUCTURED:
|
||||
return "structured replies";
|
||||
case NBD_MODE_EXTENDED:
|
||||
return "extended headers";
|
||||
default:
|
||||
return "<unknown>";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue