From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org, Ian.Campbell@citrix.com,
ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com,
wei.liu2@citrix.com
Cc: Juergen Gross <jgross@suse.com>
Subject: [PATCH] libxc: remove most of tools/libxc/xc_dom_compat_linux.c
Date: Tue, 6 Oct 2015 13:35:27 +0200 [thread overview]
Message-ID: <1444131327-22000-1-git-send-email-jgross@suse.com> (raw)
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@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
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
next reply other threads:[~2015-10-06 11:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 11:35 Juergen Gross [this message]
2015-10-06 12:52 ` [PATCH] libxc: remove most of tools/libxc/xc_dom_compat_linux.c Andrew Cooper
2015-10-06 12:58 ` Wei Liu
2015-10-06 13:06 ` Andrew Cooper
2015-10-06 13:17 ` Ian Campbell
2015-10-19 10:36 ` Juergen Gross
2015-10-22 15:22 ` Ian Jackson
2015-10-22 15:38 ` Ian Campbell
2015-10-23 7:15 ` Juergen Gross
2015-10-23 9:42 ` Ian Campbell
2015-10-23 9:53 ` Juergen Gross
2015-10-23 10:11 ` Ian Campbell
2015-10-22 15:51 ` Andrew Cooper
2015-10-22 15:21 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444131327-22000-1-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=Ian.Campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).