aboutsummaryrefslogtreecommitdiff
path: root/qobject
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-06-14 21:14:33 +0200
committerKevin Wolf <kwolf@redhat.com>2018-06-15 14:49:44 +0200
commitaf91062ee1408f7f5bb58389d355d29a5040c648 (patch)
treecf745cb42a9189cef01e0a14d1d8543e123de892 /qobject
parent92adf9dbcd3cf9cedddae995b04a99f5c42ae08c (diff)
block: Factor out qobject_input_visitor_new_flat_confused()
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qobject')
-rw-r--r--qobject/block-qdict.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/qobject/block-qdict.c b/qobject/block-qdict.c
index aba372c2eb..41f39abc4a 100644
--- a/qobject/block-qdict.c
+++ b/qobject/block-qdict.c
@@ -13,6 +13,7 @@
#include "qapi/qmp/qlist.h"
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h"
+#include "qapi/qobject-input-visitor.h"
#include "qemu/cutils.h"
#include "qapi/error.h"
@@ -529,7 +530,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
* used for anything else, and it should go away once the block
* subsystem has been cleaned up.
*/
-QObject *qdict_crumple_for_keyval_qiv(QDict *src, Error **errp)
+static QObject *qdict_crumple_for_keyval_qiv(QDict *src, Error **errp)
{
QDict *tmp = NULL;
char *buf;
@@ -695,3 +696,28 @@ bool qdict_rename_keys(QDict *qdict, const QDictRenames *renames, Error **errp)
}
return true;
}
+
+/*
+ * Create a QObject input visitor for flat @qdict with possibly
+ * confused scalar types.
+ *
+ * The block subsystem uses this function to visit its flat QDict with
+ * possibly confused scalar types. It should not be used for anything
+ * else, and it should go away once the block subsystem has been
+ * cleaned up.
+ */
+Visitor *qobject_input_visitor_new_flat_confused(QDict *qdict,
+ Error **errp)
+{
+ QObject *crumpled;
+ Visitor *v;
+
+ crumpled = qdict_crumple_for_keyval_qiv(qdict, errp);
+ if (!crumpled) {
+ return NULL;
+ }
+
+ v = qobject_input_visitor_new_keyval(crumpled);
+ qobject_unref(crumpled);
+ return v;
+}