WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [qemu-xen-unstable] Change callers of libxc to use new l

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [qemu-xen-unstable] Change callers of libxc to use new libxc API.
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Thu, 27 May 2010 09:05:03 -0700
Delivery-date: Thu, 27 May 2010 09:39:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
commit ffb0cf2ad55e952dae55e6166c4fcea79be6cd30
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Thu Apr 15 17:01:15 2010 +0100

    Change callers of libxc to use new libxc API.
    
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 hw/battery_mgmt.c |    8 ++++----
 hw/xen_backend.c  |   10 +++++-----
 hw/xen_backend.h  |    2 +-
 hw/xen_console.c  |    4 ++--
 i386-dm/helper2.c |   14 +++++++-------
 vl.c              |    2 +-
 xen-config-host.h |    2 +-
 xenstore.c        |    8 ++++----
 8 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/hw/battery_mgmt.c b/hw/battery_mgmt.c
index a53f5fc..983fb9b 100644
--- a/hw/battery_mgmt.c
+++ b/hw/battery_mgmt.c
@@ -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
diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index 31ed7b0..709088c 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -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;
     }
diff --git a/hw/xen_backend.h b/hw/xen_backend.h
index 8c93c9f..672a857 100644
--- a/hw/xen_backend.h
+++ b/hw/xen_backend.h
@@ -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;
 
diff --git a/hw/xen_console.c b/hw/xen_console.c
index 9110302..f1c2f8b 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -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;
     }
 }
diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c
index 986df3c..ce73421 100644
--- a/i386-dm/helper2.c
+++ b/i386-dm/helper2.c
@@ -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 a49bf08..404d67a 100644
--- 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;
diff --git a/xen-config-host.h b/xen-config-host.h
index 6db16d3..9526bb9 100644
--- a/xen-config-host.h
+++ b/xen-config-host.h
@@ -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[];
diff --git a/xenstore.c b/xenstore.c
index 43d30ee..c824459 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -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
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [qemu-xen-unstable] Change callers of libxc to use new libxc API., Ian Jackson <=