Add a new function that takes a QemuOptsList pointer and expects
informative messages to be printed instead of returned in an Error
object. This makes the _noisily version simmetric with the
"non-noisily". The next patch will convert the callers to use the
appropriate version.

Signed-off-by: Fabiano Rosas <[email protected]>
---
 include/qemu/option.h |  2 ++
 util/qemu-option.c    | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/qemu/option.h b/include/qemu/option.h
index dfe0d9b893..df68da9aa8 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -134,6 +134,8 @@ QemuOpts *qemu_opts_parse(const char *group, const char 
*params,
                           bool permit_abbrev, Error **errp);
 QemuOpts *qemu_opts_parse_list(QemuOptsList *list, const char *params,
                                bool permit_abbrev, Error **errp);
+QemuOpts *qemu_opts_parse_list_noisily(QemuOptsList *list, const char *params,
+                                       bool permit_abbrev);
 QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
                                Error **errp);
 QDict *qemu_opts_to_qdict_filtered(QemuOpts *opts, QDict *qdict,
diff --git a/util/qemu-option.c b/util/qemu-option.c
index 7cb45f0710..be9404ab7f 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -965,6 +965,20 @@ QemuOpts *qemu_opts_parse_list(QemuOptsList *list, const 
char *params,
  */
 QemuOpts *qemu_opts_parse_noisily(QemuOptsList *list, const char *params,
                                   bool permit_abbrev)
+{
+    return qemu_opts_parse_list_noisily(list, params, permit_abbrev);
+}
+
+/**
+ * Create a QemuOpts in @list and with options parsed from @params.
+ * If @permit_abbrev, the first key=value in @params may omit key=,
+ * and is treated as if key was @list->implied_opt_name.
+ * Report errors with error_report_err().  This is inappropriate in
+ * QMP context.  Do not use this function there!
+ * Return the new QemuOpts on success, null pointer on error.
+ */
+QemuOpts *qemu_opts_parse_list_noisily(QemuOptsList *list, const char *params,
+                                       bool permit_abbrev)
 {
     Error *err = NULL;
     QemuOpts *opts;
-- 
2.53.0


Reply via email to