aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-11-01 19:05:43 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-11-01 19:05:43 +0000
commit6f2ef80b0ce87d258b4736471a81747da2a7a881 (patch)
treec6c021403cff99fd92391546edbd62c415600f6a /include
parent700d20b49e303549b32d3a7a3efbfcee8c7a4f6c (diff)
parentdbc7b01492371e4a54b92d2b6d968f9b863cc794 (diff)
downloadqemu-6f2ef80b0ce87d258b4736471a81747da2a7a881.zip
qemu-6f2ef80b0ce87d258b4736471a81747da2a7a881.tar.gz
qemu-6f2ef80b0ce87d258b4736471a81747da2a7a881.tar.bz2
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-10-27-v2' into staging
nbd patches for 2020-10-27 - Tweak the new block-export-add QMP command - Allow multiple -B options for qemu-nbd - Add qemu:allocation-depth metadata context as qemu-nbd -A - Improve iotest use of NBD # gpg: Signature made Fri 30 Oct 2020 20:22:42 GMT # gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full] # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full] # gpg: aka "[jpeg image of size 6874]" [full] # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2020-10-27-v2: nbd: Add 'qemu-nbd -A' to expose allocation depth nbd: Add new qemu:allocation-depth metadata context block: Return depth level during bdrv_is_allocated_above nbd: Allow export of multiple bitmaps for one device nbd: Refactor counting of metadata contexts nbd: Simplify qemu bitmap context name nbd: Update qapi to support exporting multiple bitmaps nbd: Utilize QAPI_CLONE for type conversion qapi: Add QAPI_LIST_PREPEND() macro block: Simplify QAPI_LIST_ADD iotests/291: Stop NBD server iotests/291: Filter irrelevant parts of img-info Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/block/nbd.h8
-rw-r--r--include/qapi/util.h13
2 files changed, 18 insertions, 3 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h
index 3dd9a04..4a52a43 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2019 Red Hat, Inc.
+ * Copyright (C) 2016-2020 Red Hat, Inc.
* Copyright (C) 2005 Anthony Liguori <anthony@codemonkey.ws>
*
* Network Block Device
@@ -47,7 +47,7 @@ typedef struct NBDOptionReply NBDOptionReply;
typedef struct NBDOptionReplyMetaContext {
NBDOptionReply h; /* h.type = NBD_REP_META_CONTEXT, h.length > 4 */
uint32_t context_id;
- /* meta context name follows */
+ /* metadata context name follows */
} QEMU_PACKED NBDOptionReplyMetaContext;
/* Transmission phase structs
@@ -229,7 +229,7 @@ enum {
#define NBD_MAX_BUFFER_SIZE (32 * 1024 * 1024)
/*
- * Maximum size of a protocol string (export name, meta context name,
+ * Maximum size of a protocol string (export name, metadata context name,
* etc.). Use malloc rather than stack allocation for storage of a
* string.
*/
@@ -259,6 +259,8 @@ enum {
/* Extent flags for qemu:dirty-bitmap in NBD_REPLY_TYPE_BLOCK_STATUS */
#define NBD_STATE_DIRTY (1 << 0)
+/* No flags needed for qemu:allocation-depth in NBD_REPLY_TYPE_BLOCK_STATUS */
+
static inline bool nbd_reply_type_is_error(int type)
{
return type & (1 << 15);
diff --git a/include/qapi/util.h b/include/qapi/util.h
index a7c3c64..bc312e9 100644
--- a/include/qapi/util.h
+++ b/include/qapi/util.h
@@ -22,4 +22,17 @@ int qapi_enum_parse(const QEnumLookup *lookup, const char *buf,
int parse_qapi_name(const char *name, bool complete);
+/*
+ * For any GenericList @list, insert @element at the front.
+ *
+ * Note that this macro evaluates @element exactly once, so it is safe
+ * to have side-effects with that argument.
+ */
+#define QAPI_LIST_PREPEND(list, element) do { \
+ typeof(list) _tmp = g_malloc(sizeof(*(list))); \
+ _tmp->value = (element); \
+ _tmp->next = (list); \
+ (list) = _tmp; \
+} while (0)
+
#endif