aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/xen_backend.h2
-rw-r--r--hw/xen_devconfig.c2
-rw-r--r--hw/xen_domainbuild.c5
-rw-r--r--hw/xen_machine_pv.c3
4 files changed, 7 insertions, 5 deletions
diff --git a/hw/xen_backend.h b/hw/xen_backend.h
index f07f7d4224..991a7b7d54 100644
--- a/hw/xen_backend.h
+++ b/hw/xen_backend.h
@@ -97,7 +97,7 @@ extern struct XenDevOps xen_netdev_ops; /* xen_nic.c */
void xen_init_display(int domid);
/* configuration (aka xenbus setup) */
-void xen_config_cleanup(void);
+void xen_config_cleanup(Notifier *notifier);
int xen_config_dev_blk(DriveInfo *disk);
int xen_config_dev_nic(NICInfo *nic);
int xen_config_dev_vfb(int vdev, const char *type);
diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c
index ea8f8c4c2d..028f47ecb5 100644
--- a/hw/xen_devconfig.c
+++ b/hw/xen_devconfig.c
@@ -17,7 +17,7 @@ static void xen_config_cleanup_dir(char *dir)
QTAILQ_INSERT_TAIL(&xs_cleanup, d, list);
}
-void xen_config_cleanup(void)
+void xen_config_cleanup(Notifier *notifier)
{
struct xs_dirs *d;
diff --git a/hw/xen_domainbuild.c b/hw/xen_domainbuild.c
index 2f59856f73..b735ca453d 100644
--- a/hw/xen_domainbuild.c
+++ b/hw/xen_domainbuild.c
@@ -211,7 +211,7 @@ static int xen_domain_watcher(void)
}
/* normal cleanup */
-static void xen_domain_cleanup(void)
+static void xen_domain_cleanup(Notifier *notifier)
{
char *dom;
@@ -232,6 +232,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,
unsigned int xenstore_port = 0, console_port = 0;
unsigned long xenstore_mfn = 0, console_mfn = 0;
int rc;
+ static Notifier exit_notifier = { .notify = xen_domain_cleanup };
memcpy(uuid, qemu_uuid, sizeof(uuid));
rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid);
@@ -240,7 +241,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,
goto err;
}
qemu_log("xen: created domain %d\n", xen_domid);
- atexit(xen_domain_cleanup);
+ exit_notifier_add(&exit_notifier);
if (xen_domain_watcher() == -1) {
goto err;
}
diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c
index 162f88db33..abfa02c951 100644
--- a/hw/xen_machine_pv.c
+++ b/hw/xen_machine_pv.c
@@ -42,6 +42,7 @@ static void xen_init_pv(ram_addr_t ram_size,
CPUState *env;
DriveInfo *dinfo;
int i;
+ static Notifier exit_notifier = { .notify = xen_config_cleanup };
/* Initialize a dummy CPU */
if (cpu_model == NULL) {
@@ -105,7 +106,7 @@ static void xen_init_pv(ram_addr_t ram_size,
}
/* config cleanup hook */
- atexit(xen_config_cleanup);
+ exit_notifier_addr(&exit_notifier);
/* setup framebuffer */
xen_init_display(xen_domid);