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

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