]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commitdiff
Change callers of libxc to use new libxc API.
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 15 Apr 2010 16:01:15 +0000 (17:01 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 27 May 2010 15:27:22 +0000 (16:27 +0100)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
hw/battery_mgmt.c
hw/xen_backend.c
hw/xen_backend.h
hw/xen_console.c
i386-dm/helper2.c
vl.c
xen-config-host.h
xenstore.c

index a53f5fc03cd542f97d8ea91d1b236741ef608990..983fb9b64963637d02f5ce5e2fd6bb5805aee8e5 100644 (file)
@@ -84,10 +84,10 @@ static int is_battery_pt_feasible(void)
 
 static void battery_mgmt_pt_mode_init(void)
 {
-    int xc;
+    xc_interface *xc;
 
-    xc = xc_interface_open();
-    if ( xc == -1 ) 
+    xc = xc_interface_open(0,0,0);
+    if ( !xc )
     {
         fprintf(logfile, "%s: xc_interface_open failed\n", __FUNCTION__);
         return;
@@ -99,7 +99,7 @@ static void battery_mgmt_pt_mode_init(void)
     if ( xc_domain_ioport_mapping(xc, domid, BATTERY_PORT_2, BATTERY_PORT_2, 0x1, 1) != 0 ) 
         fprintf(logfile, "Failed to map port %x to guest\n", BATTERY_PORT_2);
 
-    close(xc);
+    xc_interface_close(xc);
 }
 
 #ifdef BATTERY_MGMT_DEBUG_EXT
index 31ed7b07fb9a19f01d2afee473fefca8bd6ee7ad..709088c7a88249632406f6f167a2f539cd59bbbf 100644 (file)
@@ -44,7 +44,7 @@
 /* ------------------------------------------------------------- */
 
 /* public */
-int xen_xc;
+xc_interface *xen_xc;
 struct xs_handle *xenstore = NULL;
 const char *xen_protocol;
 
@@ -217,7 +217,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
     fcntl(xc_evtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
 
     if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
-       xendev->gnttabdev = xc_gnttab_open();
+       xendev->gnttabdev = xc_gnttab_open(xc_handle);
        if (xendev->gnttabdev < 0) {
            xen_be_printf(NULL, 0, "can't open gnttab device\n");
            xc_evtchn_close(xendev->evtchndev);
@@ -270,7 +270,7 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev)
        if (xendev->evtchndev >= 0)
            xc_evtchn_close(xendev->evtchndev);
        if (xendev->gnttabdev >= 0)
-           xc_gnttab_close(xendev->gnttabdev);
+           xc_gnttab_close(xc_handle, xendev->gnttabdev);
 
        TAILQ_REMOVE(&xendevs, xendev, next);
        qemu_free(xendev);
@@ -627,8 +627,8 @@ int xen_be_init(void)
     if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0)
        goto err;
 
-    xen_xc = xc_interface_open();
-    if (xen_xc == -1) {
+    xen_xc = xc_interface_open(0,0,0);
+    if (!xen_xc) {
        xen_be_printf(NULL, 0, "can't open xen interface\n");
        goto err;
     }
index 8c93c9f2ae7a8feb11829e7d4c30e13d968aa5fb..672a857e2d4ea50cc830f0016faca6fe6d8ce54c 100644 (file)
@@ -53,7 +53,7 @@ struct XenDevice {
 /* ------------------------------------------------------------- */
 
 /* variables */
-extern int xen_xc;
+extern xc_interface *xen_xc;
 extern struct xs_handle *xenstore;
 extern const char *xen_protocol;
 
index 9110302e1325cc3f75385a62202f5e6444be7e57..f1c2f8b61087c8acc03c4bb5969de6294b457d2d 100644 (file)
@@ -227,7 +227,7 @@ static int con_connect(struct XenDevice *xendev)
                                           PROT_READ|PROT_WRITE,
                                           con->ring_ref);
     else
-        con->sring = xc_gnttab_map_grant_ref(xendev->gnttabdev, con->xendev.dom,
+        con->sring = xc_gnttab_map_grant_ref(xen_xc, xendev->gnttabdev, con->xendev.dom,
                                              con->ring_ref,
                                              PROT_READ|PROT_WRITE);
     if (!con->sring)
@@ -258,7 +258,7 @@ static void con_disconnect(struct XenDevice *xendev)
         if (!xendev->gnttabdev)
            munmap(con->sring, XC_PAGE_SIZE);
         else
-            xc_gnttab_munmap(xendev->gnttabdev, con->sring, 1);
+            xc_gnttab_munmap(xen_xc, xendev->gnttabdev, con->sring, 1);
        con->sring = NULL;
     }
 }
index 986df3c1210c7a7da306a862d6b094879b13ac74..ce73421cfc5127363f270222569915943d759f0e 100644 (file)
@@ -83,7 +83,7 @@ int vcpus = 1;
 /* do not use 64b array to avoid underflow/overflow when strtol */
 uint32_t vcpu_avail[(HVM_MAX_VCPUS + 31)/32] = {0};
 
-int xc_handle = -1;
+xc_interface *xc_handle;
 
 char domain_name[64] = "Xen-no-name";
 
@@ -163,14 +163,14 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
 void cpu_reset(CPUX86State *env)
 {
     extern int s3_shutdown_flag;
-    int xcHandle;
+    xc_interface *xcHandle;
     int sts;
  
     if (s3_shutdown_flag)
         return;
 
-    xcHandle = xc_interface_open();
-    if (xcHandle < 0)
+    xcHandle = xc_interface_open(0,0,0);
+    if (!xcHandle)
         fprintf(logfile, "Cannot acquire xenctrl handle\n");
     else {
         xc_domain_shutdown_hook(xcHandle, domid);
@@ -605,11 +605,11 @@ int main_loop(void)
 
 void destroy_hvm_domain(void)
 {
-    int xcHandle;
+    xc_interface *xcHandle;
     int sts;
  
-    xcHandle = xc_interface_open();
-    if (xcHandle < 0)
+    xcHandle = xc_interface_open(0,0,0);
+    if (!xcHandle)
         fprintf(logfile, "Cannot acquire xenctrl handle\n");
     else {
         sts = xc_domain_shutdown(xcHandle, domid, SHUTDOWN_poweroff);
diff --git a/vl.c b/vl.c
index a49bf0896405673ced5a8db5e3a8cda0bfeb40db..404d67a67775d81a8b3d2cbc66c7e840b9174ec0 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -5811,7 +5811,7 @@ int main(int argc, char **argv, char **envp)
     bdrv_init();
     dma_helper_init();
 
-    xc_handle = xc_interface_open();
+    xc_handle = xc_interface_open(0,0,0); /* fixme check errors */
 #ifdef CONFIG_STUBDOM
     {
         char *domid_s, *msg;
index 6db16d30c056b357bbd9e90f81251fa7568f9c26..9526bb9f65333d3aa73d329e5debe85d1f468870 100644 (file)
@@ -28,7 +28,7 @@ extern int domid, domid_backend;
 
 void main_loop_prepare(void);
 
-extern int xc_handle;
+extern xc_interface *xc_handle;
 extern int xen_pause_requested;
 extern int vcpus;
 extern uint32_t vcpu_avail[];
index 43d30ee6c3e43dc33071e1c6c2f0020ea97122fa..c8244595cc256ad576f2e46903391325fc874be9 100644 (file)
@@ -1475,7 +1475,7 @@ static int store_dev_info(const char *devName, int domid,
     fprintf(logfile, "can't store dev %s name for domid %d in %s from a stub domain\n", devName, domid, storeString);
     return ENOSYS;
 #else
-    int xc_handle;
+    xc_interface *xc_handle;
     struct xs_handle *xs;
     char *path;
     char *newpath;
@@ -1503,8 +1503,8 @@ static int store_dev_info(const char *devName, int domid,
         return -1;
     }
 
-    xc_handle = xc_interface_open();
-    if (xc_handle == -1) {
+    xc_handle = xc_interface_open(0,0,0);
+    if (xc_handle == NULL) {
         fprintf(logfile, "xc_interface_open() error\n");
         return -1;
     }
@@ -1532,7 +1532,7 @@ static int store_dev_info(const char *devName, int domid,
 
     free(path);
     xs_daemon_close(xs);
-    close(xc_handle);
+    xc_interface_close(xc_handle);
 
     return 0;
 #endif