aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_compat_linux.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-05-28 09:30:19 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-05-28 09:30:19 +0100
commit5cc436c1d2b3b0be3f42104582f53eec3969b43a (patch)
tree1e30ade146ee7287c486d1309b5d3d2c69a2d9b9 /tools/libxc/xc_dom_compat_linux.c
parent7f9a888af4b65cb8c22cea3c8295d30d0fedd623 (diff)
downloadxen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.gz
xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.bz2
xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.zip
libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_dom_compat_linux.c')
-rw-r--r--tools/libxc/xc_dom_compat_linux.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xc_dom_compat_linux.c
index ef809627f8..772934a4b0 100644
--- a/tools/libxc/xc_dom_compat_linux.c
+++ b/tools/libxc/xc_dom_compat_linux.c
@@ -22,7 +22,7 @@
/* ------------------------------------------------------------------------ */
static int xc_linux_build_internal(struct xc_dom_image *dom,
- int xc_handle, uint32_t domid,
+ xc_interface *xch, uint32_t domid,
unsigned int mem_mb,
unsigned long flags,
unsigned int store_evtchn,
@@ -36,7 +36,7 @@ static int xc_linux_build_internal(struct xc_dom_image *dom,
dom->console_evtchn = console_evtchn;
dom->xenstore_evtchn = store_evtchn;
- if ( (rc = xc_dom_boot_xen_init(dom, xc_handle, domid)) != 0 )
+ if ( (rc = xc_dom_boot_xen_init(dom, xch, domid)) != 0 )
goto out;
if ( (rc = xc_dom_parse_image(dom)) != 0 )
goto out;
@@ -56,7 +56,7 @@ static int xc_linux_build_internal(struct xc_dom_image *dom,
return rc;
}
-int xc_linux_build_mem(int xc_handle, uint32_t domid,
+int xc_linux_build_mem(xc_interface *xch, uint32_t domid,
unsigned int mem_mb,
const char *image_buffer,
unsigned long image_size,
@@ -73,14 +73,14 @@ int xc_linux_build_mem(int xc_handle, uint32_t domid,
struct xc_dom_image *dom;
int rc;
- xc_dom_loginit();
- dom = xc_dom_allocate(cmdline, features);
+ xc_dom_loginit(xch);
+ dom = xc_dom_allocate(xch, cmdline, features);
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, xc_handle, domid,
+ rc = xc_linux_build_internal(dom, xch, domid,
mem_mb, flags,
store_evtchn, store_mfn,
console_evtchn, console_mfn);
@@ -90,7 +90,7 @@ int xc_linux_build_mem(int xc_handle, uint32_t domid,
return rc;
}
-int xc_linux_build(int xc_handle, uint32_t domid,
+int xc_linux_build(xc_interface *xch, uint32_t domid,
unsigned int mem_mb,
const char *image_name,
const char *initrd_name,
@@ -105,15 +105,15 @@ int xc_linux_build(int xc_handle, uint32_t domid,
struct xc_dom_image *dom;
int rc;
- xc_dom_loginit();
- dom = xc_dom_allocate(cmdline, features);
+ xc_dom_loginit(xch);
+ dom = xc_dom_allocate(xch, cmdline, features);
if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 )
goto out;
if ( initrd_name && strlen(initrd_name) &&
((rc = xc_dom_ramdisk_file(dom, initrd_name)) != 0) )
goto out;
- rc = xc_linux_build_internal(dom, xc_handle, domid,
+ rc = xc_linux_build_internal(dom, xch, domid,
mem_mb, flags,
store_evtchn, store_mfn,
console_evtchn, console_mfn);
@@ -122,13 +122,14 @@ int xc_linux_build(int xc_handle, uint32_t domid,
xc_dom_release(dom);
return rc;
}
-int xc_get_bit_size(const char *image_name, const char *cmdline,
- const char *features, int *bit_size)
+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(cmdline, features);
+ dom = xc_dom_allocate(xch, cmdline, features);
if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 )
goto out;
if ( (rc = xc_dom_parse_image(dom)) != 0 )
@@ -145,7 +146,7 @@ out:
return rc;
}
-int xc_dom_linux_build(int xc_handle,
+int xc_dom_linux_build(xc_interface *xch,
struct xc_dom_image *dom,
uint32_t domid,
unsigned int mem_mb,
@@ -164,7 +165,7 @@ int xc_dom_linux_build(int xc_handle,
((rc = xc_dom_ramdisk_file(dom, initrd_name)) != 0) )
return rc;
- return xc_linux_build_internal(dom, xc_handle, domid,
+ return xc_linux_build_internal(dom, xch, domid,
mem_mb, flags,
store_evtchn, store_mfn,
console_evtchn, console_mfn);