From: Ian Campbell Date: Thu, 28 Jan 2016 14:43:53 +0000 (+0000) Subject: xen: make destroy_hvm_domain static X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=217e8455227a8952ae90abf0ccb1eacf31ee03c5;p=people%2Fliuw%2Flibxenctrl-split%2Fqemu-xen.git xen: make destroy_hvm_domain static which involves moving it higher up in the file to before its sole user (cpu_handle_ioreq). Apart from inserting the word "static" and removing the prototype in the header this is pure code motion. Signed-off-by: Ian Campbell --- diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index ab7046ccc..38502c752 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -76,8 +76,6 @@ static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom, #endif -void destroy_hvm_domain(bool reboot); - /* shutdown/destroy current domain because of an error */ void xen_shutdown_fatal_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2); diff --git a/xen-hvm.c b/xen-hvm.c index 73eef0cb3..d9b57f70d 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -1025,6 +1025,29 @@ static void handle_buffered_io(void *opaque) } } +static void destroy_hvm_domain(bool reboot) +{ + xc_interface *xc_handle; + int sts; + + xc_handle = xc_interface_open(0, 0, 0); + if (xc_handle == NULL) { + fprintf(stderr, "Cannot acquire xenctrl handle\n"); + } else { + sts = xc_domain_shutdown(xc_handle, xen_domid, + reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff); + if (sts != 0) { + fprintf(stderr, "xc_domain_shutdown failed to issue %s, " + "sts %d, %s\n", reboot ? "reboot" : "poweroff", + sts, strerror(errno)); + } else { + fprintf(stderr, "Issued domain %d %s\n", xen_domid, + reboot ? "reboot" : "poweroff"); + } + xc_interface_close(xc_handle); + } +} + static void cpu_handle_ioreq(void *opaque) { XenIOState *state = opaque; @@ -1353,29 +1376,6 @@ err: exit(1); } -void destroy_hvm_domain(bool reboot) -{ - xc_interface *xc_handle; - int sts; - - xc_handle = xc_interface_open(0, 0, 0); - if (xc_handle == NULL) { - fprintf(stderr, "Cannot acquire xenctrl handle\n"); - } else { - sts = xc_domain_shutdown(xc_handle, xen_domid, - reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff); - if (sts != 0) { - fprintf(stderr, "xc_domain_shutdown failed to issue %s, " - "sts %d, %s\n", reboot ? "reboot" : "poweroff", - sts, strerror(errno)); - } else { - fprintf(stderr, "Issued domain %d %s\n", xen_domid, - reboot ? "reboot" : "poweroff"); - } - xc_interface_close(xc_handle); - } -} - void xen_register_framebuffer(MemoryRegion *mr) { framebuffer = mr;