[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] libxc: remove most of tools/libxc/xc_dom_compat_linux.c
In tools/libxc/xc_dom_compat_linux.c only xc_linux_build() is currently being used by an in-tree component (qemu-xen). All other functions are superfluous wrappers of the domain builder which can be removed. Suggested-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- tools/libxc/include/xenguest.h | 52 -------------- tools/libxc/xc_dom_compat_linux.c | 142 +++++--------------------------------- tools/libxl/libxl_arch.h | 2 + 3 files changed, 20 insertions(+), 176 deletions(-) diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h index 1a1a185..0a8d6e5 100644 --- a/tools/libxc/include/xenguest.h +++ b/tools/libxc/include/xenguest.h @@ -151,54 +151,6 @@ int xc_linux_build(xc_interface *xch, unsigned int console_evtchn, unsigned long *console_mfn); -/** The same interface, but the dom structure is managed by the caller */ -struct xc_dom_image; -int xc_dom_linux_build(xc_interface *xch, - struct xc_dom_image *dom, - uint32_t domid, - unsigned int mem_mb, - const char *image_name, - const char *ramdisk_name, - unsigned long flags, - unsigned int store_evtchn, - unsigned long *store_mfn, - unsigned int console_evtchn, - unsigned long *console_mfn); - -/** - * This function will create a domain for a paravirtualized Linux - * using buffers for kernel and initrd - * - * @parm xch a handle to an open hypervisor interface - * @parm domid the id of the domain - * @parm mem_mb memory size in megabytes - * @parm image_buffer buffer containing kernel image - * @parm image_size size of the kernel image buffer - * @parm initrd_buffer name of the ramdisk image file - * @parm initrd_size size of the ramdisk buffer - * @parm cmdline command line string - * @parm flags domain creation flags - * @parm store_evtchn the store event channel for this domain to use - * @parm store_mfn returned with the mfn of the store page - * @parm console_evtchn the console event channel for this domain to use - * @parm conole_mfn returned with the mfn of the console page - * @return 0 on success, -1 on failure - */ -int xc_linux_build_mem(xc_interface *xch, - uint32_t domid, - unsigned int mem_mb, - const char *image_buffer, - unsigned long image_size, - const char *initrd_buffer, - unsigned long initrd_size, - const char *cmdline, - const char *features, - unsigned long flags, - unsigned int store_evtchn, - unsigned long *store_mfn, - unsigned int console_evtchn, - unsigned long *console_mfn); - struct xc_hvm_firmware_module { uint8_t *data; uint32_t length; @@ -276,10 +228,6 @@ int xc_await_suspend(xc_interface *xch, xc_evtchn *xce, int suspend_evtchn); int xc_suspend_evtchn_init_sane(xc_interface *xch, xc_evtchn *xce, int domid, int port, int *lockfd); -int xc_get_bit_size(xc_interface *xch, - const char *image_name, const char *cmdline, - const char *features, int *type); - int xc_mark_page_online(xc_interface *xch, unsigned long start, unsigned long end, uint32_t *status); diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xc_dom_compat_linux.c index a3abb99..105b1a8 100644 --- a/tools/libxc/xc_dom_compat_linux.c +++ b/tools/libxc/xc_dom_compat_linux.c @@ -34,79 +34,6 @@ /* ------------------------------------------------------------------------ */ -static int xc_linux_build_internal(struct xc_dom_image *dom, - xc_interface *xch, uint32_t domid, - unsigned int mem_mb, - unsigned long flags, - unsigned int store_evtchn, - unsigned long *store_mfn, - unsigned int console_evtchn, - unsigned long *console_mfn) -{ - int rc; - - dom->flags = flags; - dom->console_evtchn = console_evtchn; - dom->xenstore_evtchn = store_evtchn; - - if ( (rc = xc_dom_boot_xen_init(dom, xch, domid)) != 0 ) - goto out; - if ( (rc = xc_dom_parse_image(dom)) != 0 ) - goto out; - if ( (rc = xc_dom_mem_init(dom, mem_mb)) != 0 ) - goto out; - if ( (rc = xc_dom_boot_mem_init(dom)) != 0 ) - goto out; - if ( (rc = xc_dom_build_image(dom)) != 0 ) - goto out; - if ( (rc = xc_dom_boot_image(dom)) != 0 ) - goto out; - if ( (rc = xc_dom_gnttab_init(dom)) != 0) - goto out; - - *console_mfn = xc_dom_p2m_host(dom, dom->console_pfn); - *store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn); - - out: - return rc; -} - -int xc_linux_build_mem(xc_interface *xch, uint32_t domid, - unsigned int mem_mb, - const char *image_buffer, - unsigned long image_size, - const char *initrd, - unsigned long initrd_len, - const char *cmdline, - const char *features, - unsigned long flags, - unsigned int store_evtchn, - unsigned long *store_mfn, - unsigned int console_evtchn, - unsigned long *console_mfn) -{ - struct xc_dom_image *dom; - int rc; - - xc_dom_loginit(xch); - dom = xc_dom_allocate(xch, cmdline, features); - if (dom == NULL) - return -1; - if ( (rc = xc_dom_kernel_mem(dom, image_buffer, image_size)) != 0 ) - goto out; - if ( initrd && ((rc = xc_dom_ramdisk_mem(dom, initrd, initrd_len)) != 0) ) - goto out; - - rc = xc_linux_build_internal(dom, xch, domid, - mem_mb, flags, - store_evtchn, store_mfn, - console_evtchn, console_mfn); - - out: - xc_dom_release(dom); - return rc; -} - int xc_linux_build(xc_interface *xch, uint32_t domid, unsigned int mem_mb, const char *image_name, @@ -132,66 +59,33 @@ int xc_linux_build(xc_interface *xch, uint32_t domid, ((rc = xc_dom_ramdisk_file(dom, initrd_name)) != 0) ) goto out; - rc = xc_linux_build_internal(dom, xch, domid, - mem_mb, flags, - store_evtchn, store_mfn, - console_evtchn, console_mfn); + dom->flags = flags; + dom->console_evtchn = console_evtchn; + dom->xenstore_evtchn = store_evtchn; - out: - xc_dom_release(dom); - return rc; -} -int xc_get_bit_size(xc_interface *xch, - const char *image_name, const char *cmdline, - const char *features, int *bit_size) -{ - struct xc_dom_image *dom; - int rc; - *bit_size = 0; - dom = xc_dom_allocate(xch, cmdline, features); - if (dom == NULL) - return -1; - if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 ) + if ( (rc = xc_dom_boot_xen_init(dom, xch, domid)) != 0 ) goto out; if ( (rc = xc_dom_parse_image(dom)) != 0 ) goto out; - if( dom->guest_type != NULL){ - if(strstr(dom->guest_type, "x86_64") != NULL) - *bit_size = X86_64_B_SIZE; //64bit Guest - if(strstr(dom->guest_type, "x86_32") != NULL) - *bit_size = X86_32_B_SIZE; //32bit Guest - } + if ( (rc = xc_dom_mem_init(dom, mem_mb)) != 0 ) + goto out; + if ( (rc = xc_dom_boot_mem_init(dom)) != 0 ) + goto out; + if ( (rc = xc_dom_build_image(dom)) != 0 ) + goto out; + if ( (rc = xc_dom_boot_image(dom)) != 0 ) + goto out; + if ( (rc = xc_dom_gnttab_init(dom)) != 0) + goto out; + + *console_mfn = xc_dom_p2m_host(dom, dom->console_pfn); + *store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn); -out: + out: xc_dom_release(dom); return rc; } -int xc_dom_linux_build(xc_interface *xch, - struct xc_dom_image *dom, - uint32_t domid, - unsigned int mem_mb, - const char *image_name, - const char *initrd_name, - unsigned long flags, - unsigned int store_evtchn, - unsigned long *store_mfn, - unsigned int console_evtchn, unsigned long *console_mfn) -{ - int rc; - - if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 ) - return rc; - if ( initrd_name && strlen(initrd_name) && - ((rc = xc_dom_ramdisk_file(dom, initrd_name)) != 0) ) - return rc; - - return xc_linux_build_internal(dom, xch, domid, - mem_mb, flags, - store_evtchn, store_mfn, - console_evtchn, console_mfn); -} - /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index bd030b6..55e3513 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -15,6 +15,8 @@ #ifndef LIBXL_ARCH_H #define LIBXL_ARCH_H +struct xc_dom_image; + /* fill the arch specific configuration for the domain */ _hidden int libxl__arch_domain_prepare_config(libxl__gc *gc, -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |