]> xenbits.xensource.com Git - qemu-xen-unstable.git/commitdiff
qemu-xen-traditional: Use libxengnttab
authorIan Campbell <ian.campbell@citrix.com>
Fri, 15 Jan 2016 13:23:54 +0000 (13:23 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 22 Jan 2016 12:14:16 +0000 (12:14 +0000)
/dev/xen/gntdev related wrappers have been moved out of libxenctrl
into their own library.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
hw/xen_backend.c
hw/xen_backend.h
hw/xen_common.h
hw/xen_console.c
hw/xen_disk.c
xen-hooks.mak

index 40f6887312efebbc9678c413b3e84782e870fefd..97d25da15cbb6918c364ebc6af1caebff385f50f 100644 (file)
@@ -217,7 +217,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
     fcntl(xenevtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
 
     if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
-       xendev->gnttabdev = xc_gnttab_open(NULL, 0);
+       xendev->gnttabdev = xengnttab_open(NULL, 0);
        if (xendev->gnttabdev == NULL) {
            xen_be_printf(NULL, 0, "can't open gnttab device\n");
            xenevtchn_close(xendev->evtchndev);
@@ -270,7 +270,7 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev)
        if (xendev->evtchndev != NULL)
            xenevtchn_close(xendev->evtchndev);
        if (xendev->gnttabdev != NULL)
-           xc_gnttab_close(xendev->gnttabdev);
+           xengnttab_close(xendev->gnttabdev);
 
        TAILQ_REMOVE(&xendevs, xendev, next);
        qemu_free(xendev);
index 60f18f86c08ac28caf869a28a898f032c01854aa..ba1e12f2ef45821d79b31de77cfcb7f0c4bbc6f9 100644 (file)
@@ -45,7 +45,7 @@ struct XenDevice {
     int                local_port;
 
     xenevtchn_handle   *evtchndev;
-    xc_gnttab          *gnttabdev;
+    xengnttab_handle          *gnttabdev;
 
     struct XenDevOps   *ops;
     TAILQ_ENTRY(XenDevice) next;
index cee908f197ccf18c4e5d008b7b82c570ca468ccf..cc48892fde87cf0599362aa5474c905be5fd92e8 100644 (file)
@@ -5,6 +5,7 @@
 #include <inttypes.h>
 
 #include <xenevtchn.h>
+#include <xengnttab.h>
 #include <xenctrl.h>
 #include <xenstore.h>
 #include <xen/io/xenbus.h>
index 80beb31b7329a17539127e12b4f313a24b8cb2ad..0bb4469f321507fb3db66cf33fb2cb77ae3d50f1 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(xendev->gnttabdev, con->xendev.dom,
+        con->sring = xengnttab_map_grant_ref(xendev->gnttabdev, con->xendev.dom,
                                              con->ring_ref,
                                              PROT_READ|PROT_WRITE);
     if (!con->sring)
@@ -263,7 +263,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);
+            xengnttab_unmap(xendev->gnttabdev, con->sring, 1);
        con->sring = NULL;
     }
 }
index 250d806d6aec03fd0dd06989a93bc18f7405c0b0..bc7874810aea5a2f37cdccd45896fe57c4897452 100644 (file)
@@ -266,7 +266,7 @@ err:
 
 static void ioreq_unmap(struct ioreq *ioreq)
 {
-    xc_gnttab *gnt = ioreq->blkdev->xendev.gnttabdev;
+    xengnttab_handle *gnt = ioreq->blkdev->xendev.gnttabdev;
     int i;
 
     if (ioreq->v.niov == 0)
@@ -274,8 +274,8 @@ static void ioreq_unmap(struct ioreq *ioreq)
     if (batch_maps) {
        if (!ioreq->pages)
            return;
-       if (xc_gnttab_munmap(gnt, ioreq->pages, ioreq->v.niov) != 0)
-           xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
+       if (xengnttab_unmap(gnt, ioreq->pages, ioreq->v.niov) != 0)
+           xen_be_printf(&ioreq->blkdev->xendev, 0, "xengnttab_unmap failed: %s\n",
                          strerror(errno));
        ioreq->blkdev->cnt_map -= ioreq->v.niov;
        ioreq->pages = NULL;
@@ -283,8 +283,8 @@ static void ioreq_unmap(struct ioreq *ioreq)
        for (i = 0; i < ioreq->v.niov; i++) {
            if (!ioreq->page[i])
                continue;
-           if (xc_gnttab_munmap(gnt, ioreq->page[i], 1) != 0)
-               xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
+           if (xengnttab_unmap(gnt, ioreq->page[i], 1) != 0)
+               xen_be_printf(&ioreq->blkdev->xendev, 0, "xengnttab_unmap failed: %s\n",
                              strerror(errno));
            ioreq->blkdev->cnt_map--;
            ioreq->page[i] = NULL;
@@ -294,13 +294,13 @@ static void ioreq_unmap(struct ioreq *ioreq)
 
 static int ioreq_map(struct ioreq *ioreq)
 {
-    xc_gnttab *gnt = ioreq->blkdev->xendev.gnttabdev;
+    xengnttab_handle *gnt = ioreq->blkdev->xendev.gnttabdev;
     int i;
 
     if (ioreq->v.niov == 0)
         return 0;
     if (batch_maps) {
-       ioreq->pages = xc_gnttab_map_grant_refs
+       ioreq->pages = xengnttab_map_grant_refs
            (gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot);
        if (ioreq->pages == NULL) {
            xen_be_printf(&ioreq->blkdev->xendev, 0,
@@ -314,7 +314,7 @@ static int ioreq_map(struct ioreq *ioreq)
        ioreq->blkdev->cnt_map += ioreq->v.niov;
     } else  {
        for (i = 0; i < ioreq->v.niov; i++) {
-           ioreq->page[i] = xc_gnttab_map_grant_ref
+           ioreq->page[i] = xengnttab_map_grant_ref
                (gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot);
            if (ioreq->page[i] == NULL) {
                xen_be_printf(&ioreq->blkdev->xendev, 0,
@@ -611,9 +611,9 @@ static void blk_alloc(struct XenDevice *xendev)
     blkdev->bh = qemu_bh_new(blk_bh, blkdev);
     if (xen_mode != XEN_EMULATE)
         batch_maps = 1;
-    if (xc_gnttab_set_max_grants(xendev->gnttabdev,
+    if (xengnttab_set_max_grants(xendev->gnttabdev,
             MAX_GRANTS(max_requests, BLKIF_MAX_SEGMENTS_PER_REQUEST)) < 0) {
-        xen_be_printf(xendev, 0, "xc_gnttab_set_max_grants failed: %s\n",
+        xen_be_printf(xendev, 0, "xengnttab_set_max_grants failed: %s\n",
                       strerror(errno));
     }
 }
@@ -734,7 +734,7 @@ static int blk_connect(struct XenDevice *xendev)
             blkdev->protocol = BLKIF_PROTOCOL_X86_64;
     }
 
-    blkdev->sring = xc_gnttab_map_grant_ref(blkdev->xendev.gnttabdev,
+    blkdev->sring = xengnttab_map_grant_ref(blkdev->xendev.gnttabdev,
                                            blkdev->xendev.dom,
                                            blkdev->ring_ref,
                                            PROT_READ | PROT_WRITE);
@@ -787,7 +787,7 @@ static void blk_disconnect(struct XenDevice *xendev)
     xen_be_unbind_evtchn(&blkdev->xendev);
 
     if (blkdev->sring) {
-       xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1);
+       xengnttab_unmap(blkdev->xendev.gnttabdev, blkdev->sring, 1);
        blkdev->cnt_map--;
        blkdev->sring = NULL;
     }
index 18259d4d9a50078b8ad4fb518c4d3ca5b30775dc..179a6b702cad3dee078c355eb5c7676057418d77 100644 (file)
@@ -1,5 +1,6 @@
 CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/toollog/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/evtchn/include
+CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/gnttab/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/include
@@ -20,6 +21,7 @@ endif
 CFLAGS += $(CMDLINE_CFLAGS)
 
 LIBS += -L$(XEN_ROOT)/tools/libs/evtchn -lxenevtchn
+LIBS += -L$(XEN_ROOT)/tools/libs/gnttab -lxengnttab
 LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest
 LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore
 LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog