Blame SOURCES/kvm-block-Add-block-specific-QDict-header.patch

383d26
From 29e09fe238bfbf9657384e8a05087398925626ac Mon Sep 17 00:00:00 2001
383d26
From: Markus Armbruster <armbru@redhat.com>
383d26
Date: Mon, 18 Jun 2018 08:43:15 +0200
383d26
Subject: [PATCH 08/54] block: Add block-specific QDict header
383d26
383d26
RH-Author: Markus Armbruster <armbru@redhat.com>
383d26
Message-id: <20180618084330.30009-9-armbru@redhat.com>
383d26
Patchwork-id: 80736
383d26
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 08/23] block: Add block-specific QDict header
383d26
Bugzilla: 1557995
383d26
RH-Acked-by: Max Reitz <mreitz@redhat.com>
383d26
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
383d26
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
383d26
383d26
From: Max Reitz <mreitz@redhat.com>
383d26
383d26
There are numerous QDict functions that have been introduced for and are
383d26
used only by the block layer.  Move their declarations into an own
383d26
header file to reflect that.
383d26
383d26
While qdict_extract_subqdict() is in fact used outside of the block
383d26
layer (in util/qemu-config.c), it is still a function related very
383d26
closely to how the block layer works with nested QDicts, namely by
383d26
sometimes flattening them.  Therefore, its declaration is put into this
383d26
header as well and util/qemu-config.c includes it with a comment stating
383d26
exactly which function it needs.
383d26
383d26
Suggested-by: Markus Armbruster <armbru@redhat.com>
383d26
Signed-off-by: Max Reitz <mreitz@redhat.com>
383d26
Message-Id: <20180509165530.29561-7-mreitz@redhat.com>
383d26
[Copyright note tweaked, superfluous includes dropped]
383d26
Signed-off-by: Markus Armbruster <armbru@redhat.com>
383d26
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
383d26
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
383d26
(cherry picked from commit 609f45ea9507fc1603eaeda7f5066b99beac6721)
383d26
[Trivial conflict in block/nbd.c resolved]
383d26
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 block.c                  |  1 +
383d26
 block/gluster.c          |  1 +
383d26
 block/iscsi.c            |  1 +
383d26
 block/nbd.c              |  1 +
383d26
 block/nfs.c              |  1 +
383d26
 block/parallels.c        |  1 +
383d26
 block/qcow.c             |  1 +
383d26
 block/qcow2.c            |  1 +
383d26
 block/qed.c              |  1 +
383d26
 block/quorum.c           |  1 +
383d26
 block/rbd.c              |  1 +
383d26
 block/sheepdog.c         |  1 +
383d26
 block/snapshot.c         |  1 +
383d26
 block/ssh.c              |  1 +
383d26
 block/vhdx.c             |  1 +
383d26
 block/vpc.c              |  1 +
383d26
 block/vvfat.c            |  1 +
383d26
 block/vxhs.c             |  1 +
383d26
 blockdev.c               |  1 +
383d26
 include/block/qdict.h    | 32 ++++++++++++++++++++++++++++++++
383d26
 include/qapi/qmp/qdict.h | 17 -----------------
383d26
 qobject/qdict.c          |  1 +
383d26
 tests/check-qdict.c      |  1 +
383d26
 tests/check-qobject.c    |  1 +
383d26
 tests/test-replication.c |  1 +
383d26
 util/qemu-config.c       |  1 +
383d26
 26 files changed, 56 insertions(+), 17 deletions(-)
383d26
 create mode 100644 include/block/qdict.h
383d26
383d26
diff --git a/block.c b/block.c
383d26
index 676e57f..3c3e8fd 100644
383d26
--- a/block.c
383d26
+++ b/block.c
383d26
@@ -27,6 +27,7 @@
383d26
 #include "block/block_int.h"
383d26
 #include "block/blockjob.h"
383d26
 #include "block/nbd.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qemu/error-report.h"
383d26
 #include "module_block.h"
383d26
 #include "qemu/module.h"
383d26
diff --git a/block/gluster.c b/block/gluster.c
383d26
index 55be566..418bb73 100644
383d26
--- a/block/gluster.c
383d26
+++ b/block/gluster.c
383d26
@@ -11,6 +11,7 @@
383d26
 #include "qemu/osdep.h"
383d26
 #include <glusterfs/api/glfs.h>
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/error.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
 #include "qapi/qmp/qerror.h"
383d26
diff --git a/block/iscsi.c b/block/iscsi.c
383d26
index 658462b..1705187 100644
383d26
--- a/block/iscsi.c
383d26
+++ b/block/iscsi.c
383d26
@@ -33,6 +33,7 @@
383d26
 #include "qemu/bitops.h"
383d26
 #include "qemu/bitmap.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "scsi/constants.h"
383d26
 #include "qemu/iov.h"
383d26
 #include "qemu/option.h"
383d26
diff --git a/block/nbd.c b/block/nbd.c
383d26
index 3e1693c..f499830 100644
383d26
--- a/block/nbd.c
383d26
+++ b/block/nbd.c
383d26
@@ -28,6 +28,7 @@
383d26
 
383d26
 #include "qemu/osdep.h"
383d26
 #include "block/nbd-client.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/error.h"
383d26
 #include "qemu/uri.h"
383d26
 #include "block/block_int.h"
383d26
diff --git a/block/nfs.c b/block/nfs.c
383d26
index 66fddf1..5159ef0 100644
383d26
--- a/block/nfs.c
383d26
+++ b/block/nfs.c
383d26
@@ -29,6 +29,7 @@
383d26
 #include "qemu/error-report.h"
383d26
 #include "qapi/error.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "trace.h"
383d26
 #include "qemu/iov.h"
383d26
 #include "qemu/option.h"
383d26
diff --git a/block/parallels.c b/block/parallels.c
383d26
index 045810d..0ee1f6a 100644
383d26
--- a/block/parallels.c
383d26
+++ b/block/parallels.c
383d26
@@ -31,6 +31,7 @@
383d26
 #include "qemu/osdep.h"
383d26
 #include "qapi/error.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "sysemu/block-backend.h"
383d26
 #include "qemu/module.h"
383d26
 #include "qemu/option.h"
383d26
diff --git a/block/qcow.c b/block/qcow.c
383d26
index 4b2f7db..fb821ad 100644
383d26
--- a/block/qcow.c
383d26
+++ b/block/qcow.c
383d26
@@ -26,6 +26,7 @@
383d26
 #include "qapi/error.h"
383d26
 #include "qemu/error-report.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "sysemu/block-backend.h"
383d26
 #include "qemu/module.h"
383d26
 #include "qemu/option.h"
383d26
diff --git a/block/qcow2.c b/block/qcow2.c
383d26
index 2f36e63..fa9f557 100644
383d26
--- a/block/qcow2.c
383d26
+++ b/block/qcow2.c
383d26
@@ -24,6 +24,7 @@
383d26
 
383d26
 #include "qemu/osdep.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "sysemu/block-backend.h"
383d26
 #include "qemu/module.h"
383d26
 #include <zlib.h>
383d26
diff --git a/block/qed.c b/block/qed.c
383d26
index 1db8eaf..9a8997a 100644
383d26
--- a/block/qed.c
383d26
+++ b/block/qed.c
383d26
@@ -13,6 +13,7 @@
383d26
  */
383d26
 
383d26
 #include "qemu/osdep.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/error.h"
383d26
 #include "qemu/timer.h"
383d26
 #include "qemu/bswap.h"
383d26
diff --git a/block/quorum.c b/block/quorum.c
383d26
index a5051da..f1f39ba 100644
383d26
--- a/block/quorum.c
383d26
+++ b/block/quorum.c
383d26
@@ -17,6 +17,7 @@
383d26
 #include "qemu/cutils.h"
383d26
 #include "qemu/option.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/error.h"
383d26
 #include "qapi/qapi-events-block.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
diff --git a/block/rbd.c b/block/rbd.c
383d26
index 2842c0e..e695cf2 100644
383d26
--- a/block/rbd.c
383d26
+++ b/block/rbd.c
383d26
@@ -18,6 +18,7 @@
383d26
 #include "qemu/error-report.h"
383d26
 #include "qemu/option.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "crypto/secret.h"
383d26
 #include "qemu/cutils.h"
383d26
 #include "qapi/qmp/qstring.h"
383d26
diff --git a/block/sheepdog.c b/block/sheepdog.c
383d26
index 07529f4..fd3876f 100644
383d26
--- a/block/sheepdog.c
383d26
+++ b/block/sheepdog.c
383d26
@@ -24,6 +24,7 @@
383d26
 #include "qemu/option.h"
383d26
 #include "qemu/sockets.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "sysemu/block-backend.h"
383d26
 #include "qemu/bitops.h"
383d26
 #include "qemu/cutils.h"
383d26
diff --git a/block/snapshot.c b/block/snapshot.c
383d26
index 2953d96..f9903bc 100644
383d26
--- a/block/snapshot.c
383d26
+++ b/block/snapshot.c
383d26
@@ -25,6 +25,7 @@
383d26
 #include "qemu/osdep.h"
383d26
 #include "block/snapshot.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/error.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
 #include "qapi/qmp/qerror.h"
383d26
diff --git a/block/ssh.c b/block/ssh.c
383d26
index 412a1bf..5931064 100644
383d26
--- a/block/ssh.c
383d26
+++ b/block/ssh.c
383d26
@@ -28,6 +28,7 @@
383d26
 #include <libssh2_sftp.h>
383d26
 
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/error.h"
383d26
 #include "qemu/error-report.h"
383d26
 #include "qemu/option.h"
383d26
diff --git a/block/vhdx.c b/block/vhdx.c
383d26
index c3a4220..26c05aa 100644
383d26
--- a/block/vhdx.c
383d26
+++ b/block/vhdx.c
383d26
@@ -18,6 +18,7 @@
383d26
 #include "qemu/osdep.h"
383d26
 #include "qapi/error.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "sysemu/block-backend.h"
383d26
 #include "qemu/module.h"
383d26
 #include "qemu/option.h"
383d26
diff --git a/block/vpc.c b/block/vpc.c
383d26
index 0ebfcd3..41c8c98 100644
383d26
--- a/block/vpc.c
383d26
+++ b/block/vpc.c
383d26
@@ -26,6 +26,7 @@
383d26
 #include "qemu/osdep.h"
383d26
 #include "qapi/error.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "sysemu/block-backend.h"
383d26
 #include "qemu/module.h"
383d26
 #include "qemu/option.h"
383d26
diff --git a/block/vvfat.c b/block/vvfat.c
383d26
index 662dca0..4595f33 100644
383d26
--- a/block/vvfat.c
383d26
+++ b/block/vvfat.c
383d26
@@ -27,6 +27,7 @@
383d26
 #include <dirent.h>
383d26
 #include "qapi/error.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qemu/module.h"
383d26
 #include "qemu/option.h"
383d26
 #include "qemu/bswap.h"
383d26
diff --git a/block/vxhs.c b/block/vxhs.c
383d26
index 96e83d9..25fea7f 100644
383d26
--- a/block/vxhs.c
383d26
+++ b/block/vxhs.c
383d26
@@ -13,6 +13,7 @@
383d26
 #include <gmodule.h>
383d26
 #include <sys/param.h>
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/qmp/qerror.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
 #include "qapi/qmp/qstring.h"
383d26
diff --git a/blockdev.c b/blockdev.c
383d26
index 129e444..96a89cc 100644
383d26
--- a/blockdev.c
383d26
+++ b/blockdev.c
383d26
@@ -35,6 +35,7 @@
383d26
 #include "sysemu/blockdev.h"
383d26
 #include "hw/block/block.h"
383d26
 #include "block/blockjob.h"
383d26
+#include "block/qdict.h"
383d26
 #include "block/throttle-groups.h"
383d26
 #include "monitor/monitor.h"
383d26
 #include "qemu/error-report.h"
383d26
diff --git a/include/block/qdict.h b/include/block/qdict.h
383d26
new file mode 100644
383d26
index 0000000..71c037a
383d26
--- /dev/null
383d26
+++ b/include/block/qdict.h
383d26
@@ -0,0 +1,32 @@
383d26
+/*
383d26
+ * Special QDict functions used by the block layer
383d26
+ *
383d26
+ * Copyright (c) 2013-2018 Red Hat, Inc.
383d26
+ *
383d26
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
383d26
+ * See the COPYING.LIB file in the top-level directory.
383d26
+ */
383d26
+
383d26
+#ifndef BLOCK_QDICT_H
383d26
+#define BLOCK_QDICT_H
383d26
+
383d26
+#include "qapi/qmp/qdict.h"
383d26
+
383d26
+void qdict_copy_default(QDict *dst, QDict *src, const char *key);
383d26
+void qdict_set_default_str(QDict *dst, const char *key, const char *val);
383d26
+
383d26
+void qdict_join(QDict *dest, QDict *src, bool overwrite);
383d26
+
383d26
+void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
383d26
+void qdict_array_split(QDict *src, QList **dst);
383d26
+int qdict_array_entries(QDict *src, const char *subqdict);
383d26
+QObject *qdict_crumple(const QDict *src, Error **errp);
383d26
+void qdict_flatten(QDict *qdict);
383d26
+
383d26
+typedef struct QDictRenames {
383d26
+    const char *from;
383d26
+    const char *to;
383d26
+} QDictRenames;
383d26
+bool qdict_rename_keys(QDict *qdict, const QDictRenames *renames, Error **errp);
383d26
+
383d26
+#endif
383d26
diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h
383d26
index 921a28d..7f3ec10 100644
383d26
--- a/include/qapi/qmp/qdict.h
383d26
+++ b/include/qapi/qmp/qdict.h
383d26
@@ -67,23 +67,6 @@ int64_t qdict_get_try_int(const QDict *qdict, const char *key,
383d26
 bool qdict_get_try_bool(const QDict *qdict, const char *key, bool def_value);
383d26
 const char *qdict_get_try_str(const QDict *qdict, const char *key);
383d26
 
383d26
-void qdict_copy_default(QDict *dst, QDict *src, const char *key);
383d26
-void qdict_set_default_str(QDict *dst, const char *key, const char *val);
383d26
-
383d26
 QDict *qdict_clone_shallow(const QDict *src);
383d26
-void qdict_flatten(QDict *qdict);
383d26
-
383d26
-void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
383d26
-void qdict_array_split(QDict *src, QList **dst);
383d26
-int qdict_array_entries(QDict *src, const char *subqdict);
383d26
-QObject *qdict_crumple(const QDict *src, Error **errp);
383d26
-
383d26
-void qdict_join(QDict *dest, QDict *src, bool overwrite);
383d26
-
383d26
-typedef struct QDictRenames {
383d26
-    const char *from;
383d26
-    const char *to;
383d26
-} QDictRenames;
383d26
-bool qdict_rename_keys(QDict *qdict, const QDictRenames *renames, Error **errp);
383d26
 
383d26
 #endif /* QDICT_H */
383d26
diff --git a/qobject/qdict.c b/qobject/qdict.c
383d26
index 22800ee..0554c64 100644
383d26
--- a/qobject/qdict.c
383d26
+++ b/qobject/qdict.c
383d26
@@ -11,6 +11,7 @@
383d26
  */
383d26
 
383d26
 #include "qemu/osdep.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/qmp/qnum.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
 #include "qapi/qmp/qbool.h"
383d26
diff --git a/tests/check-qdict.c b/tests/check-qdict.c
383d26
index eba5d35..93e2112 100644
383d26
--- a/tests/check-qdict.c
383d26
+++ b/tests/check-qdict.c
383d26
@@ -11,6 +11,7 @@
383d26
  */
383d26
 
383d26
 #include "qemu/osdep.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
 #include "qapi/qmp/qlist.h"
383d26
 #include "qapi/qmp/qnum.h"
383d26
diff --git a/tests/check-qobject.c b/tests/check-qobject.c
383d26
index 5cb08fc..16ccbde 100644
383d26
--- a/tests/check-qobject.c
383d26
+++ b/tests/check-qobject.c
383d26
@@ -8,6 +8,7 @@
383d26
  */
383d26
 
383d26
 #include "qemu/osdep.h"
383d26
+#include "block/qdict.h"
383d26
 #include "qapi/qmp/qbool.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
 #include "qapi/qmp/qlist.h"
383d26
diff --git a/tests/test-replication.c b/tests/test-replication.c
383d26
index 68c0d04..c8165ae 100644
383d26
--- a/tests/test-replication.c
383d26
+++ b/tests/test-replication.c
383d26
@@ -15,6 +15,7 @@
383d26
 #include "qemu/option.h"
383d26
 #include "replication.h"
383d26
 #include "block/block_int.h"
383d26
+#include "block/qdict.h"
383d26
 #include "sysemu/block-backend.h"
383d26
 
383d26
 #define IMG_SIZE (64 * 1024 * 1024)
383d26
diff --git a/util/qemu-config.c b/util/qemu-config.c
383d26
index 14d8402..9d2e278 100644
383d26
--- a/util/qemu-config.c
383d26
+++ b/util/qemu-config.c
383d26
@@ -1,4 +1,5 @@
383d26
 #include "qemu/osdep.h"
383d26
+#include "block/qdict.h" /* for qdict_extract_subqdict() */
383d26
 #include "qapi/error.h"
383d26
 #include "qapi/qapi-commands-misc.h"
383d26
 #include "qapi/qmp/qdict.h"
383d26
-- 
383d26
1.8.3.1
383d26