Am 27.05.2015 um 20:20 schrieb Andreas Färber: > From: "Daniel P. Berrange" <berra...@redhat.com> > > Some types of object must be created before chardevs, other types of > object must be created after chardevs. As such there is no option but > to create objects in two phases. > > This takes the decision to create as many object types as possible > right away before anyother backends are created, and only delay > creation of those few which have an explicit dependency on the > chardevs. Hopefully the set which need delaying will remain small > over time. > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> > Signed-off-by: Andreas Färber <afaer...@suse.de> > --- > vl.c | 40 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 39 insertions(+), 1 deletion(-)
Rebasing my queue, I needed the attached changes to make it apply and build. Second pairs of eyes welcome. Regards, Andreas -- SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton; HRB 21284 (AG Nürnberg)
diff --cc vl.c index 2201e27,b7c7511..0000000 --- a/vl.c +++ b/vl.c @@@ -2671,7 -2601,34 +2671,34 @@@ static int machine_set_property(void *o 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(QemuOpts *opts, void *opaque) +static int object_create(void *opaque, QemuOpts *opts, Error **errp) { Error *err = NULL; char *type = NULL; @@@ -4114,14 -4062,16 +4145,20 @@@ int main(int argc, char **argv, char ** socket_init(); + if (qemu_opts_foreach(qemu_find_opts("object"), + object_create, - object_create_initial, 0) != 0) { ++ object_create_initial, NULL)) { + exit(1); + } + - if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0) + if (qemu_opts_foreach(qemu_find_opts("chardev"), + chardev_init_func, NULL, NULL)) { exit(1); + } + #ifdef CONFIG_VIRTFS - if (qemu_opts_foreach(qemu_find_opts("fsdev"), fsdev_init_func, NULL, 1) != 0) { + if (qemu_opts_foreach(qemu_find_opts("fsdev"), + fsdev_init_func, NULL, NULL)) { exit(1); } #endif @@@ -4137,7 -4087,8 +4174,8 @@@ } if (qemu_opts_foreach(qemu_find_opts("object"), - object_create, NULL, NULL)) { + object_create, - object_create_delayed, 0) != 0) { ++ object_create_delayed, NULL)) { exit(1); }