aboutsummaryrefslogtreecommitdiff
path: root/hw/xen_domainbuild.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2010-03-17 17:59:26 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-19 15:27:38 -0500
commitd7234f4d7e373a708e1df9ab565a71b71b189025 (patch)
treee4db9e84d66e448fdda3fe426fd3904eba8a5382 /hw/xen_domainbuild.c
parent3b6304f706ef7eebc0b3b3f3a5093ec75448ee19 (diff)
Convert atexit users to exit_notifier
All of these users have global state so we really don't see a benefit from exit_notifier. However, using exit_notifier means that there's one less justification for having global state in the first place. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/xen_domainbuild.c')
-rw-r--r--hw/xen_domainbuild.c5
1 files changed, 3 insertions, 2 deletions
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;
}