[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 02/50] multi-process: Refactor machine_init and exit notifiers
From: |
Jagannathan Raman |
Subject: |
[PATCH v5 02/50] multi-process: Refactor machine_init and exit notifiers |
Date: |
Mon, 24 Feb 2020 15:54:53 -0500 |
Relocate machine_int and exit notifiers into common code
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
- [PATCH v5 00/50] Initial support for multi-process qemu, Jagannathan Raman, 2020/02/24
- [PATCH v5 02/50] multi-process: Refactor machine_init and exit notifiers,
Jagannathan Raman <=
- [PATCH v5 03/50] multi-process: add a command line option for debug file, Jagannathan Raman, 2020/02/24
- [PATCH v5 01/50] multi-process: memory: alloc RAM from file at offset, Jagannathan Raman, 2020/02/24
- [PATCH v5 05/50] multi-process: Add config option for multi-process QEMU, Jagannathan Raman, 2020/02/24
- [PATCH v5 07/50] multi-process: define mpqemu-link object, Jagannathan Raman, 2020/02/24
- [PATCH v5 09/50] multi-process: setup PCI host bridge for remote device, Jagannathan Raman, 2020/02/24
- [PATCH v5 06/50] multi-process: build system for remote device process, Jagannathan Raman, 2020/02/24
- [PATCH v5 08/50] multi-process: add functions to synchronize proxy and remote endpoints, Jagannathan Raman, 2020/02/24
- [PATCH v5 11/50] multi-process: setup memory manager for remote device, Jagannathan Raman, 2020/02/24
- [PATCH v5 10/50] multi-process: setup a machine object for remote device process, Jagannathan Raman, 2020/02/24
- [PATCH v5 12/50] multi-process: remote process initialization, Jagannathan Raman, 2020/02/24