aboutsummaryrefslogtreecommitdiff
path: root/nbd/common.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2023-08-29 12:58:30 -0500
committerEric Blake <eblake@redhat.com>2023-09-22 17:21:08 -0500
commitd95ffb6fe6008c114602e20d848100081d62f7aa (patch)
tree6e051c4a1e55a3ba7dec997426a9a4ab450b4df2 /nbd/common.c
parent297365b40ff24c7e07d6f40ec8f9ac83229ace94 (diff)
downloadqemu-d95ffb6fe6008c114602e20d848100081d62f7aa.zip
qemu-d95ffb6fe6008c114602e20d848100081d62f7aa.tar.gz
qemu-d95ffb6fe6008c114602e20d848100081d62f7aa.tar.bz2
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>
Diffstat (limited to 'nbd/common.c')
-rw-r--r--nbd/common.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/nbd/common.c b/nbd/common.c
index 989fbe5..3247c1d 100644
--- a/nbd/common.c
+++ b/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>";
}