[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] qemu-xen: update for libxc gnttab interface change.



Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 hw/xen_backend.c |   10 +++++-----
 hw/xen_backend.h |    2 +-
 hw/xen_console.c |    4 ++--
 hw/xen_disk.c    |   16 ++++++++--------
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index 577f68e..d9be513 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -217,15 +217,15 @@ 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(xc_handle);
-       if (xendev->gnttabdev < 0) {
+       xendev->gnttabdev = xc_gnttab_open(NULL, 0);
+       if (xendev->gnttabdev == NULL) {
            xen_be_printf(NULL, 0, "can't open gnttab device\n");
            xc_evtchn_close(xendev->evtchndev);
            qemu_free(xendev);
            return NULL;
        }
     } else {
-       xendev->gnttabdev = -1;
+       xendev->gnttabdev = NULL;
     }
 
     TAILQ_INSERT_TAIL(&xendevs, xendev, next);
@@ -269,8 +269,8 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev)
 
        if (xendev->evtchndev != NULL)
            xc_evtchn_close(xendev->evtchndev);
-       if (xendev->gnttabdev >= 0)
-           xc_gnttab_close(xc_handle, xendev->gnttabdev);
+       if (xendev->gnttabdev != NULL)
+           xc_gnttab_close(xendev->gnttabdev);
 
        TAILQ_REMOVE(&xendevs, xendev, next);
        qemu_free(xendev);
diff --git a/hw/xen_backend.h b/hw/xen_backend.h
index a68067d..e421391 100644
--- a/hw/xen_backend.h
+++ b/hw/xen_backend.h
@@ -45,7 +45,7 @@ struct XenDevice {
     int                local_port;
 
     xc_evtchn          *evtchndev;
-    int                gnttabdev;
+    xc_gnttab          *gnttabdev;
 
     struct XenDevOps   *ops;
     TAILQ_ENTRY(XenDevice) next;
diff --git a/hw/xen_console.c b/hw/xen_console.c
index 54bfc6f..d7099c4 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -230,7 +230,7 @@ static int con_initialise(struct XenDevice *xendev)
                                           PROT_READ|PROT_WRITE,
                                           con->ring_ref);
     else
-        con->sring = xc_gnttab_map_grant_ref(xen_xc, xendev->gnttabdev, 
con->xendev.dom,
+        con->sring = xc_gnttab_map_grant_ref(xendev->gnttabdev, 
con->xendev.dom,
                                              con->ring_ref,
                                              PROT_READ|PROT_WRITE);
     if (!con->sring)
@@ -261,7 +261,7 @@ static void con_disconnect(struct XenDevice *xendev)
         if (!xendev->gnttabdev)
            munmap(con->sring, XC_PAGE_SIZE);
         else
-            xc_gnttab_munmap(xen_xc, xendev->gnttabdev, con->sring, 1);
+            xc_gnttab_munmap(xendev->gnttabdev, con->sring, 1);
        con->sring = NULL;
     }
 }
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 38b5fbf..b3870fb 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -236,7 +236,7 @@ err:
 
 static void ioreq_unmap(struct ioreq *ioreq)
 {
-    int gnt = ioreq->blkdev->xendev.gnttabdev;
+    xc_gnttab *gnt = ioreq->blkdev->xendev.gnttabdev;
     int i;
 
     if (ioreq->v.niov == 0)
@@ -244,7 +244,7 @@ static void ioreq_unmap(struct ioreq *ioreq)
     if (batch_maps) {
        if (!ioreq->pages)
            return;
-       if (xc_gnttab_munmap(xen_xc, gnt, ioreq->pages, ioreq->v.niov) != 0)
+       if (xc_gnttab_munmap(gnt, ioreq->pages, ioreq->v.niov) != 0)
            xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: 
%s\n",
                          strerror(errno));
        ioreq->blkdev->cnt_map -= ioreq->v.niov;
@@ -253,7 +253,7 @@ static void ioreq_unmap(struct ioreq *ioreq)
        for (i = 0; i < ioreq->v.niov; i++) {
            if (!ioreq->page[i])
                continue;
-           if (xc_gnttab_munmap(xen_xc, gnt, ioreq->page[i], 1) != 0)
+           if (xc_gnttab_munmap(gnt, ioreq->page[i], 1) != 0)
                xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap 
failed: %s\n",
                              strerror(errno));
            ioreq->blkdev->cnt_map--;
@@ -264,14 +264,14 @@ static void ioreq_unmap(struct ioreq *ioreq)
 
 static int ioreq_map(struct ioreq *ioreq)
 {
-    int gnt = ioreq->blkdev->xendev.gnttabdev;
+    xc_gnttab *gnt = ioreq->blkdev->xendev.gnttabdev;
     int i;
 
     if (ioreq->v.niov == 0)
         return 0;
     if (batch_maps) {
        ioreq->pages = xc_gnttab_map_grant_refs
-           (xen_xc, gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, 
ioreq->prot);
+           (gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot);
        if (ioreq->pages == NULL) {
            xen_be_printf(&ioreq->blkdev->xendev, 0,
                          "can't map %d grant refs (%s, %d maps)\n",
@@ -285,7 +285,7 @@ static int ioreq_map(struct ioreq *ioreq)
     } else  {
        for (i = 0; i < ioreq->v.niov; i++) {
            ioreq->page[i] = xc_gnttab_map_grant_ref
-               (xen_xc, gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot);
+               (gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot);
            if (ioreq->page[i] == NULL) {
                xen_be_printf(&ioreq->blkdev->xendev, 0,
                              "can't map grant ref %d (%s, %d maps)\n",
@@ -684,7 +684,7 @@ static int blk_connect(struct XenDevice *xendev)
             blkdev->protocol = BLKIF_PROTOCOL_X86_64;
     }
 
-    blkdev->sring = xc_gnttab_map_grant_ref(xen_xc, blkdev->xendev.gnttabdev,
+    blkdev->sring = xc_gnttab_map_grant_ref(blkdev->xendev.gnttabdev,
                                            blkdev->xendev.dom,
                                            blkdev->ring_ref,
                                            PROT_READ | PROT_WRITE);
@@ -737,7 +737,7 @@ static void blk_disconnect(struct XenDevice *xendev)
     xen_be_unbind_evtchn(&blkdev->xendev);
 
     if (blkdev->sring) {
-       xc_gnttab_munmap(xen_xc, blkdev->xendev.gnttabdev, blkdev->sring, 1);
+       xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1);
        blkdev->cnt_map--;
        blkdev->sring = NULL;
     }
-- 
1.5.6.5


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.