[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v14 14/21] qapi: allow repeated opts with qobject_in
From: |
Daniel P. Berrange |
Subject: |
[Qemu-block] [PATCH v14 14/21] qapi: allow repeated opts with qobject_input_visitor_new_opts |
Date: |
Fri, 30 Sep 2016 15:45:37 +0100 |
The qobject_input_visitor_new_opts() method gains a new
parameter to control whether it allows repeated option
keys in the input QemuOpts or not.
Signed-off-by: Daniel P. Berrange <address@hidden>
---
include/qapi/qobject-input-visitor.h | 6 ++++++
qapi/qobject-input-visitor.c | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/qapi/qobject-input-visitor.h
b/include/qapi/qobject-input-visitor.h
index 242b767..bc5062a 100644
--- a/include/qapi/qobject-input-visitor.h
+++ b/include/qapi/qobject-input-visitor.h
@@ -112,6 +112,11 @@ Visitor *qobject_input_visitor_new_autocast(QObject *obj,
* qobject_input_visitor_new_autocast() method. See the docs
* of that method for further details on processing behaviour.
*
+ * If the @permit_repeated_opts parameter is true, then the input
+ * @opts is allowed to contain repeated keys and they will be
+ * turned into a QList. If it is false, then repeated keys will
+ * result in an error being reported.
+ *
* The returned input visitor should be released by calling
* visit_free() when no longer required.
*/
@@ -119,6 +124,7 @@ Visitor *qobject_input_visitor_new_opts(const QemuOpts
*opts,
bool autocreate_list,
size_t autocreate_struct_levels,
bool permit_int_ranges,
+ bool permit_repeated_opts,
Error **errp);
#endif
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index 2287d11..5a3872c 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -753,6 +753,7 @@ Visitor *qobject_input_visitor_new_opts(const QemuOpts
*opts,
bool autocreate_list,
size_t autocreate_struct_levels,
bool permit_int_ranges,
+ bool permit_repeated_opts,
Error **errp)
{
QDict *pdict;
@@ -760,7 +761,9 @@ Visitor *qobject_input_visitor_new_opts(const QemuOpts
*opts,
Visitor *v = NULL;
pdict = qemu_opts_to_qdict(opts, NULL,
- QEMU_OPTS_REPEAT_POLICY_LAST,
+ permit_repeated_opts ?
+ QEMU_OPTS_REPEAT_POLICY_ALL :
+ QEMU_OPTS_REPEAT_POLICY_ERROR,
errp);
if (!pdict) {
goto cleanup;
--
2.7.4
- Re: [Qemu-block] [PATCH v14 08/21] qapi: allow QObjectInputVisitor to be created with QemuOpts, (continued)
- [Qemu-block] [PATCH v14 09/21] qapi: permit auto-creating single element lists, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 10/21] qapi: permit auto-creating nested structs, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 11/21] qapi: add integer range support for QObjectInputVisitor, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 12/21] option: allow qemu_opts_to_qdict to merge repeated options, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 13/21] qdict: allow qdict_crumple to accept compound types as values, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 14/21] qapi: allow repeated opts with qobject_input_visitor_new_opts,
Daniel P. Berrange <=
- [Qemu-block] [PATCH v14 15/21] qom: support non-scalar properties with -object, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 16/21] hmp: support non-scalar properties with object_add, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 17/21] numa: convert to use QObjectInputVisitor for -numa, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 18/21] block: convert crypto driver to use QObjectInputVisitor, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 19/21] acpi: convert to QObjectInputVisitor for -acpi parsing, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 20/21] net: convert to QObjectInputVisitor for -net/-netdev parsing, Daniel P. Berrange, 2016/09/30
- [Qemu-block] [PATCH v14 21/21] qapi: delete unused OptsVisitor code, Daniel P. Berrange, 2016/09/30
- Re: [Qemu-block] [Qemu-devel] [PATCH v14 00/21] QAPI/QOM work for non-scalar object properties, no-reply, 2016/09/30