[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 02/50] multi-process: Refactor machine_init and exit notif
From: |
Marc-André Lureau |
Subject: |
Re: [PATCH v5 02/50] multi-process: Refactor machine_init and exit notifiers |
Date: |
Sun, 29 Mar 2020 18:45:53 +0200 |
Hi
On Mon, Feb 24, 2020 at 9:56 PM Jagannathan Raman <address@hidden> wrote:
>
> Relocate machine_int and exit notifiers into common code
utils/notify.c is not a good place to relocate those.
eventually, add a new softmmu/notifiers.c ?
And that patch broke make check test-char /char/mux, because it
overrides machine_init_done from stubs/machine-init-done.c..
>
> Signed-off-by: Elena Ufimtseva <address@hidden>
> Signed-off-by: John G Johnson <address@hidden>
> Signed-off-by: Jagannathan Raman <address@hidden>
> ---
> include/sysemu/sysemu.h | 2 ++
> softmmu/vl.c | 42 ------------------------------------------
> util/notify.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 45 insertions(+), 42 deletions(-)
>
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index dec64fc..2f37e2b 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -17,11 +17,13 @@ extern bool qemu_uuid_set;
>
> void qemu_add_exit_notifier(Notifier *notify);
> void qemu_remove_exit_notifier(Notifier *notify);
> +void qemu_run_exit_notifiers(void);
>
> extern bool machine_init_done;
>
> void qemu_add_machine_init_done_notifier(Notifier *notify);
> void qemu_remove_machine_init_done_notifier(Notifier *notify);
> +void qemu_run_machine_init_done_notifiers(void);
>
> extern int autostart;
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 92c7b3a..94a7b93 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -173,12 +173,6 @@ int icount_align_option;
> QemuUUID qemu_uuid;
> bool qemu_uuid_set;
>
> -static NotifierList exit_notifiers =
> - NOTIFIER_LIST_INITIALIZER(exit_notifiers);
> -
> -static NotifierList machine_init_done_notifiers =
> - NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers);
> -
> bool xen_allowed;
> uint32_t xen_domid;
> enum xen_mode xen_mode = XEN_EMULATE;
> @@ -2324,21 +2318,6 @@ static MachineClass *machine_parse(const char *name,
> GSList *machines)
> return mc;
> }
>
> -void qemu_add_exit_notifier(Notifier *notify)
> -{
> - notifier_list_add(&exit_notifiers, notify);
> -}
> -
> -void qemu_remove_exit_notifier(Notifier *notify)
> -{
> - notifier_remove(notify);
> -}
> -
> -static void qemu_run_exit_notifiers(void)
> -{
> - notifier_list_notify(&exit_notifiers, NULL);
> -}
> -
> static const char *pid_file;
> static Notifier qemu_unlink_pidfile_notifier;
>
> @@ -2349,27 +2328,6 @@ static void qemu_unlink_pidfile(Notifier *n, void
> *data)
> }
> }
>
> -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);
> -}
> -
> -static void qemu_run_machine_init_done_notifiers(void)
> -{
> - machine_init_done = true;
> - notifier_list_notify(&machine_init_done_notifiers, NULL);
> -}
> -
> static const QEMUOption *lookup_opt(int argc, char **argv,
> const char **poptarg, int *poptind)
> {
> diff --git a/util/notify.c b/util/notify.c
> index 76bab21..0e7479b 100644
> --- a/util/notify.c
> +++ b/util/notify.c
> @@ -15,6 +15,15 @@
>
> #include "qemu/osdep.h"
> #include "qemu/notify.h"
> +#include "sysemu/sysemu.h"
> +
> +bool machine_init_done;
> +
> +static NotifierList machine_init_done_notifiers =
> + NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers);
> +
> +static NotifierList exit_notifiers =
> + NOTIFIER_LIST_INITIALIZER(exit_notifiers);
>
> void notifier_list_init(NotifierList *list)
> {
> @@ -74,3 +83,37 @@ int
> notifier_with_return_list_notify(NotifierWithReturnList *list, void *data)
> }
> return ret;
> }
> +
> +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);
> +}
> +
> +void qemu_add_exit_notifier(Notifier *notify)
> +{
> + notifier_list_add(&exit_notifiers, notify);
> +}
> +
> +void qemu_remove_exit_notifier(Notifier *notify)
> +{
> + notifier_remove(notify);
> +}
> +
> +void qemu_run_exit_notifiers(void)
> +{
> + notifier_list_notify(&exit_notifiers, NULL);
> +}
> --
> 1.8.3.1
>
--
Marc-André Lureau
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v5 02/50] multi-process: Refactor machine_init and exit notifiers,
Marc-André Lureau <=