aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-06-22 12:50:30 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-06-22 12:50:30 +0100
commit0a3346f5dea0a679322df804e1e78d7c10d12a9f (patch)
treec3357e42d47b35f6b2631d16b83c14450ac4f924 /vl.c
parentcb4e0f9ddf7d45de7e4716cbab661ea568bd0b6c (diff)
parentdaeba9699d41ad79e2f3d34acea9c85c5d67a2ac (diff)
downloadqemu-0a3346f5dea0a679322df804e1e78d7c10d12a9f.zip
qemu-0a3346f5dea0a679322df804e1e78d7c10d12a9f.tar.gz
qemu-0a3346f5dea0a679322df804e1e78d7c10d12a9f.tar.bz2
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
QOM infrastructure fixes and device conversions * Changes to name string ownership for alias properties * Improvements around enum properties * Cleanups around -object handling * New helper functions * Cleanups of qdev init helper functions * Add path argument to qom-tree script * QTest cleanup to use new qtest_add_data_func() consistently # gpg: Signature made Fri Jun 19 18:14:38 2015 BST using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: qdev: Un-deprecate qdev_init_nofail() qdev: Deprecated qdev_init() is finally unused, drop qom: Don't pass string table to object_get_enum() function qom: Add an object_property_add_enum() helper function qom: Make enum string tables const-correct qom: Add object_new_with_props() / object_new_withpropv() helpers qom: Add helper function for getting user objects root vl: Create (most) objects before creating chardev backends doc: Document user creatable object types in help text backends: Fix typename of 'policy' enum property in hostmem obj scripts: Add support for path as argument of qom-tree tests: Use qtest_add_data_func() consistently qdev: Free property names after registering gpio aliases qom: strdup() target property name on object_property_add_alias() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 1a920e6..0c2208f 100644
--- a/vl.c
+++ b/vl.c
@@ -2749,6 +2749,33 @@ static int machine_set_property(void *opaque,
return 0;
}
+
+/*
+ * Initial object creation happens before all other
+ * QEMU data types are created. The majority of objects
+ * can be created at this point. The rng-egd object
+ * cannot be created here, as it depends on the chardev
+ * already existing.
+ */
+static bool object_create_initial(const char *type)
+{
+ if (g_str_equal(type, "rng-egd")) {
+ return false;
+ }
+ return true;
+}
+
+
+/*
+ * The remainder of object creation happens after the
+ * creation of chardev, fsdev and device data types.
+ */
+static bool object_create_delayed(const char *type)
+{
+ return !object_create_initial(type);
+}
+
+
static int object_create(void *opaque, QemuOpts *opts, Error **errp)
{
Error *err = NULL;
@@ -2757,6 +2784,7 @@ static int object_create(void *opaque, QemuOpts *opts, Error **errp)
void *dummy = NULL;
OptsVisitor *ov;
QDict *pdict;
+ bool (*type_predicate)(const char *) = opaque;
ov = opts_visitor_new(opts);
pdict = qemu_opts_to_qdict(opts, NULL);
@@ -2771,6 +2799,9 @@ static int object_create(void *opaque, QemuOpts *opts, Error **errp)
if (err) {
goto out;
}
+ if (!type_predicate(type)) {
+ goto out;
+ }
qdict_del(pdict, "id");
visit_type_str(opts_get_visitor(ov), &id, "id", &err);
@@ -4192,6 +4223,12 @@ int main(int argc, char **argv, char **envp)
socket_init();
+ if (qemu_opts_foreach(qemu_find_opts("object"),
+ object_create,
+ object_create_initial, NULL)) {
+ exit(1);
+ }
+
if (qemu_opts_foreach(qemu_find_opts("chardev"),
chardev_init_func, NULL, NULL)) {
exit(1);
@@ -4215,7 +4252,8 @@ int main(int argc, char **argv, char **envp)
}
if (qemu_opts_foreach(qemu_find_opts("object"),
- object_create, NULL, NULL)) {
+ object_create,
+ object_create_delayed, NULL)) {
exit(1);
}