diff options
author | Paolo Bonzini | 2020-10-28 12:36:57 +0100 |
---|---|---|
committer | Paolo Bonzini | 2020-12-10 18:15:18 +0100 |
commit | 6b21670cfda76e47a827810eea5eb3b518cb6521 (patch) | |
tree | f04a2ea9e60db8497f7ea34e4613a3ec2d5610c1 /hw | |
parent | vl: extract softmmu/datadir.c (diff) | |
download | qemu-6b21670cfda76e47a827810eea5eb3b518cb6521.tar.gz qemu-6b21670cfda76e47a827810eea5eb3b518cb6521.tar.xz qemu-6b21670cfda76e47a827810eea5eb3b518cb6521.zip |
vl: extract machine done notifiers
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/machine.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c index 71a0e375ab..d7f8fdee45 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1169,6 +1169,30 @@ void machine_run_board_init(MachineState *machine) machine_class->init(machine); } +static NotifierList machine_init_done_notifiers = + NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); + +bool machine_init_done; + +void qemu_add_machine_init_done_notifier(Notifier *notify) +{ + notifier_list_add(&machine_init_done_notifiers, notify); + if (machine_init_done) { + notify->notify(notify, NULL); + } +} + +void qemu_remove_machine_init_done_notifier(Notifier *notify) +{ + notifier_remove(notify); +} + +void qemu_run_machine_init_done_notifiers(void) +{ + machine_init_done = true; + notifier_list_notify(&machine_init_done_notifiers, NULL); +} + static const TypeInfo machine_info = { .name = TYPE_MACHINE, .parent = TYPE_OBJECT, |