@@ -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);
@@ -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;
@@ -5,6 +5,7 @@
#include <inttypes.h>
#include <xenevtchn.h>
+#include <xengnttab.h>
#include <xenctrl.h>
#include <xenstore.h>
#include <xen/io/xenbus.h>
@@ -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;
}
}
@@ -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;
}
@@ -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