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

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