]> xenbits.xensource.com Git - qemu-xen-unstable.git/commitdiff
qemu-xen: update for libxc gnttab interface change
authorIan Campbell <ian.campbell@citrix.com>
Thu, 23 Dec 2010 15:29:37 +0000 (15:29 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 23 Dec 2010 15:29:37 +0000 (15:29 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
hw/xen_backend.c
hw/xen_backend.h
hw/xen_console.c
hw/xen_disk.c

index 577f68e040159b1a09df2a39bedf226a51552acb..d9be5139e1660636cce6a409c39e8a4cb18827b8 100644 (file)
@@ -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);
index a68067d6aef5e70f9b8d8898c45bddf801b6f47a..e4213911df037b645fe9f0c4eb5b4096b49a7a25 100644 (file)
@@ -45,7 +45,7 @@ struct XenDevice {
     int                local_port;
 
     xc_evtchn          *evtchndev;
-    int                gnttabdev;
+    xc_gnttab          *gnttabdev;
 
     struct XenDevOps   *ops;
     TAILQ_ENTRY(XenDevice) next;
index 54bfc6fa135d1780a573f74c0b10318f0462a73a..d7099c4e389afde8d855e10719979fd9246c8c44 100644 (file)
@@ -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;
     }
 }
index 94af0014560155fb1bce608d5dc76e779678deff..218f65451a0bcca78a3b8aa0f1c50a806e74e294 100644 (file)
@@ -240,7 +240,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)
@@ -248,7 +248,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;
@@ -257,7 +257,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--;
@@ -268,14 +268,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",
@@ -289,7 +289,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",
@@ -692,7 +692,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);
@@ -745,7 +745,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;
     }