Hi On Mon, Mar 5, 2018 at 7:50 AM, Peter Xu <pet...@redhat.com> wrote: > We have that variable but not exported. Export that so modules can have > a way to poke on whether machine init has finished.
Which modules? > Meanwhile, set that up even before calling the notifiers, so that > notifiers who may depend on this field will get a correct answer. > > Suggested-by: Paolo Bonzini <pbonz...@redhat.com> > Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > include/sysemu/sysemu.h | 2 ++ > stubs/machine-init-done.c | 2 ++ > vl.c | 4 ++-- > 3 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index 77bb3da582..3f0f35610b 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -86,6 +86,8 @@ void qemu_system_guest_panicked(GuestPanicInformation > *info); > void qemu_add_exit_notifier(Notifier *notify); > void qemu_remove_exit_notifier(Notifier *notify); > > +extern bool machine_init_done; > + > void qemu_add_machine_init_done_notifier(Notifier *notify); > void qemu_remove_machine_init_done_notifier(Notifier *notify); > > diff --git a/stubs/machine-init-done.c b/stubs/machine-init-done.c > index 9a0d62514f..4121f1709b 100644 > --- a/stubs/machine-init-done.c > +++ b/stubs/machine-init-done.c > @@ -2,6 +2,8 @@ > #include "qemu-common.h" > #include "sysemu/sysemu.h" > > +bool machine_init_done = true; > + > void qemu_add_machine_init_done_notifier(Notifier *notify) > { > } > diff --git a/vl.c b/vl.c > index a33ac008fb..57777e8d47 100644 > --- a/vl.c > +++ b/vl.c > @@ -2712,7 +2712,7 @@ static void qemu_run_exit_notifiers(void) > notifier_list_notify(&exit_notifiers, NULL); > } > > -static bool machine_init_done; > +bool machine_init_done; > > void qemu_add_machine_init_done_notifier(Notifier *notify) > { > @@ -2729,8 +2729,8 @@ void qemu_remove_machine_init_done_notifier(Notifier > *notify) > > static void qemu_run_machine_init_done_notifiers(void) > { > - notifier_list_notify(&machine_init_done_notifiers, NULL); > machine_init_done = true; > + notifier_list_notify(&machine_init_done_notifiers, NULL); > } > > static const QEMUOption *lookup_opt(int argc, char **argv, > -- > 2.14.3 >