Skip to content

Commit

Permalink
vl: export machine_init_done
Browse files Browse the repository at this point in the history
We have that variable but not exported.  Export that so modules can have
a way to poke on whether machine init has finished.

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 <pbonzini@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180306053320.15401-2-peterx@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
xzpeter authored and bonzini committed Mar 12, 2018
1 parent 205f31a commit c8ca2a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/sysemu/sysemu.h
Expand Up @@ -88,6 +88,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);

Expand Down
2 changes: 2 additions & 0 deletions stubs/machine-init-done.c
Expand Up @@ -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)
{
}
4 changes: 2 additions & 2 deletions vl.c
Expand Up @@ -2696,7 +2696,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)
{
Expand All @@ -2713,8 +2713,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,
Expand Down

0 comments on commit c8ca2a2

Please sign in to comment.