[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/13] vl: plug -object back into -readconfig
From: |
Paolo Bonzini |
Subject: |
[PULL 13/13] vl: plug -object back into -readconfig |
Date: |
Fri, 4 Jun 2021 17:17:45 +0200 |
Commit bc2f4fcb1d ("qom: move user_creatable_add_opts logic to vl.c
and QAPIfy it", 2021-03-19) switched the creation of objects from
qemu_opts_foreach to a bespoke QTAILQ in preparation for supporting JSON
syntax in -object.
Unfortunately in doing so it lost support for [object] stanzas in
configuration files and also for "-set object.ID.KEY=VAL". The latter
is hard to re-establish and probably best solved by deprecating -set.
This patch uses the infrastructure introduced by the previous two
patches in order to parse QOM objects correctly from configuration
files.
Cc: Markus Armbruster <armbru@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210524105752.3318299-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 5e8240b9d8..326c1e9080 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1722,9 +1722,15 @@ static void object_option_foreach_add(bool
(*type_opt_predicate)(const char *))
}
}
+static void object_option_add_visitor(Visitor *v)
+{
+ ObjectOption *opt = g_new0(ObjectOption, 1);
+ visit_type_ObjectOptions(v, NULL, &opt->opts, &error_fatal);
+ QTAILQ_INSERT_TAIL(&object_opts, opt, next);
+}
+
static void object_option_parse(const char *optarg)
{
- ObjectOption *opt;
QemuOpts *opts;
const char *type;
Visitor *v;
@@ -1752,11 +1758,8 @@ static void object_option_parse(const char *optarg)
v = opts_visitor_new(opts);
}
- opt = g_new0(ObjectOption, 1);
- visit_type_ObjectOptions(v, NULL, &opt->opts, &error_fatal);
+ object_option_add_visitor(v);
visit_free(v);
-
- QTAILQ_INSERT_TAIL(&object_opts, opt, next);
}
/*
@@ -2134,13 +2137,22 @@ static int global_init_func(void *opaque, QemuOpts
*opts, Error **errp)
*/
static bool is_qemuopts_group(const char *group)
{
+ if (g_str_equal(group, "object")) {
+ return false;
+ }
return true;
}
static void qemu_record_config_group(const char *group, QDict *dict,
bool from_json, Error **errp)
{
- abort();
+ if (g_str_equal(group, "object")) {
+ Visitor *v = qobject_input_visitor_new_keyval(QOBJECT(dict));
+ object_option_add_visitor(v);
+ visit_free(v);
+ } else {
+ abort();
+ }
}
/*
--
2.31.1
- [PULL 03/13] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure, (continued)
- [PULL 03/13] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure, Paolo Bonzini, 2021/06/04
- [PULL 04/13] target/i386: tcg: fix segment register offsets for 16-bit TSS, Paolo Bonzini, 2021/06/04
- [PULL 05/13] target/i386: tcg: fix loading of registers from 16-bit TSS, Paolo Bonzini, 2021/06/04
- [PULL 08/13] tests/qtest/virtio-scsi-test: add unmap large LBA with 4k blocks test, Paolo Bonzini, 2021/06/04
- [PULL 07/13] target/i386: Fix decode of cr8, Paolo Bonzini, 2021/06/04
- [PULL 06/13] target/i386: tcg: fix switching from 16-bit to 32-bit tasks or vice versa, Paolo Bonzini, 2021/06/04
- [PULL 09/13] i386: reorder call to cpu_exec_realizefn, Paolo Bonzini, 2021/06/04
- [PULL 12/13] vl: plumb keyval-based options into -readconfig, Paolo Bonzini, 2021/06/04
- [PULL 10/13] i386: run accel_cpu_instance_init as post_init, Paolo Bonzini, 2021/06/04
- [PULL 11/13] qemu-config: parse configuration files to a QDict, Paolo Bonzini, 2021/06/04
- [PULL 13/13] vl: plug -object back into -readconfig,
Paolo Bonzini <=
- Re: [PULL 00/13] Misc bugfix patches for 2021-06-04, Peter Maydell, 2021/06/05