# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369006 0
# Node ID d210f8cc84b3b228017afcca2158ccf1e06c1430
# Parent e82cccb0d9770e51f9785f109ea11d704ae4df45
libxc: convert gnttab interfaces to use an opaque handle type
The xc_interface previously passed to xc_gnttab_* was only used for
logging which can now be done via the xc_gnttab handle instead.
This makes the interface consistent with the changes made to the main
interface in 21483:779c0ef9682c.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r e82cccb0d977 -r d210f8cc84b3 tools/fs-back/fs-backend.c
--- a/tools/fs-back/fs-backend.c Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/fs-back/fs-backend.c Fri Dec 03 09:36:46 2010 +0000
@@ -168,9 +168,8 @@ void terminate_mount_request(struct fs_m
}
xenbus_write_backend_state(mount, STATE_CLOSED);
- xc_gnttab_munmap(mount->xch, mount->gnth,
- mount->ring.sring, mount->shared_ring_size);
- xc_gnttab_close(mount->xch, mount->gnth);
+ xc_gnttab_munmap(mount->gnth, mount->ring.sring, mount->shared_ring_size);
+ xc_gnttab_close(mount->gnth);
xc_evtchn_unbind(mount->evth, mount->local_evtchn);
xc_evtchn_close(mount->evth);
@@ -242,15 +241,15 @@ static void handle_connection(int fronte
FS_DEBUG("ERROR: Couldn't bind evtchn!\n");
goto error;
}
- mount->gnth = -1;
- mount->gnth = xc_gnttab_open(mount->xch);
- if (mount->gnth < 0) {
+ mount->gnth = NULL;
+ mount->gnth = xc_gnttab_open(NULL, 0);
+ if (mount->gnth == NULL) {
FS_DEBUG("ERROR: Couldn't open gnttab!\n");
goto error;
}
for(i=0; i<mount->shared_ring_size; i++)
dom_ids[i] = mount->dom_id;
- sring = xc_gnttab_map_grant_refs(mount->xch, mount->gnth,
+ sring = xc_gnttab_map_grant_refs(mount->gnth,
mount->shared_ring_size,
dom_ids,
mount->grefs,
@@ -283,10 +282,9 @@ error:
error:
xenbus_write_backend_state(mount, STATE_CLOSED);
if (sring)
- xc_gnttab_munmap(mount->xch, mount->gnth,
- mount->ring.sring, mount->shared_ring_size);
- if (mount->gnth > 0)
- xc_gnttab_close(mount->xch, mount->gnth);
+ xc_gnttab_munmap(mount->gnth, mount->ring.sring,
mount->shared_ring_size);
+ if (mount->gnth != NULL)
+ xc_gnttab_close(mount->gnth);
if (mount->local_evtchn > 0)
xc_evtchn_unbind(mount->evth, mount->local_evtchn);
if (mount->evth != NULL)
diff -r e82cccb0d977 -r d210f8cc84b3 tools/fs-back/fs-backend.h
--- a/tools/fs-back/fs-backend.h Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/fs-back/fs-backend.h Fri Dec 03 09:36:46 2010 +0000
@@ -47,7 +47,7 @@ struct fs_mount
xc_interface *xch; /* just for error logging, so a dummy */
xc_evtchn *evth; /* Handle to the event channel */
evtchn_port_t local_evtchn;
- int gnth;
+ xc_gnttab *gnth;
int shared_ring_size; /* in pages */
struct fsif_back_ring ring;
int nr_entries;
diff -r e82cccb0d977 -r d210f8cc84b3 tools/fs-back/fs-ops.c
--- a/tools/fs-back/fs-ops.c Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/fs-back/fs-ops.c Fri Dec 03 09:36:46 2010 +0000
@@ -75,7 +75,7 @@ static void dispatch_file_open(struct fs
FS_DEBUG("Dispatching file open operation (gref=%d).\n",
req->u.fopen.gref);
/* Read the request, and open file */
- file_name = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
+ file_name = xc_gnttab_map_grant_ref(mount->gnth,
mount->dom_id,
req->u.fopen.gref,
PROT_READ);
@@ -99,7 +99,7 @@ static void dispatch_file_open(struct fs
}
}
out:
- if (xc_gnttab_munmap(mount->xch, mount->gnth, file_name, 1) != 0) {
+ if (xc_gnttab_munmap(mount->gnth, file_name, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
@@ -159,7 +159,7 @@ static void dispatch_file_read(struct fs
assert(req->u.fread.len > 0);
count = (req->u.fread.len - 1) / XC_PAGE_SIZE + 1;
assert(count <= FSIF_NR_READ_GNTS);
- buf = xc_gnttab_map_domain_grant_refs(mount->xch, mount->gnth,
+ buf = xc_gnttab_map_domain_grant_refs(mount->gnth,
count,
mount->dom_id,
req->u.fread.grefs,
@@ -192,8 +192,7 @@ static void dispatch_file_read(struct fs
priv_req->aiocb.aio_sigevent.sigev_value.sival_ptr = priv_req;
if (aio_read(&priv_req->aiocb) < 0) {
FS_DEBUG("ERROR: aio_read failed errno=%d\n", errno);
- xc_gnttab_munmap(mount->xch, mount->gnth,
- priv_req->page, priv_req->count);
+ xc_gnttab_munmap(mount->gnth, priv_req->page, priv_req->count);
terminate_mount_request(mount);
}
@@ -209,7 +208,7 @@ static void end_file_read(struct fs_moun
uint16_t req_id;
/* Release the grant */
- if (xc_gnttab_munmap(mount->xch, mount->gnth,
+ if (xc_gnttab_munmap(mount->gnth,
priv_req->page, priv_req->count) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
@@ -236,7 +235,7 @@ static void dispatch_file_write(struct f
assert(req->u.fwrite.len > 0);
count = (req->u.fwrite.len - 1) / XC_PAGE_SIZE + 1;
assert(count <= FSIF_NR_WRITE_GNTS);
- buf = xc_gnttab_map_domain_grant_refs(mount->xch, mount->gnth,
+ buf = xc_gnttab_map_domain_grant_refs(mount->gnth,
count,
mount->dom_id,
req->u.fwrite.grefs,
@@ -269,7 +268,7 @@ static void dispatch_file_write(struct f
priv_req->aiocb.aio_sigevent.sigev_value.sival_ptr = priv_req;
if (aio_write(&priv_req->aiocb) < 0) {
FS_DEBUG("ERROR: aio_write failed errno=%d\n", errno);
- xc_gnttab_munmap(mount->xch, mount->gnth,
+ xc_gnttab_munmap(mount->gnth,
priv_req->page, priv_req->count);
terminate_mount_request(mount);
}
@@ -287,7 +286,7 @@ static void end_file_write(struct fs_mou
uint16_t req_id;
/* Release the grant */
- if (xc_gnttab_munmap(mount->xch, mount->gnth,
+ if (xc_gnttab_munmap(mount->gnth,
priv_req->page, priv_req->count) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
@@ -395,7 +394,7 @@ static void dispatch_remove(struct fs_mo
FS_DEBUG("Dispatching remove operation (gref=%d).\n", req->u.fremove.gref);
/* Read the request, and open file */
- file_name = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
+ file_name = xc_gnttab_map_grant_ref(mount->gnth,
mount->dom_id,
req->u.fremove.gref,
PROT_READ);
@@ -409,7 +408,7 @@ static void dispatch_remove(struct fs_mo
ret = remove(file_name);
}
FS_DEBUG("Got ret: %d\n", ret);
- if (xc_gnttab_munmap(mount->xch, mount->gnth, file_name, 1) != 0) {
+ if (xc_gnttab_munmap(mount->gnth, file_name, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
@@ -437,7 +436,7 @@ static void dispatch_rename(struct fs_mo
FS_DEBUG("Dispatching rename operation (gref=%d).\n", req->u.fremove.gref);
/* Read the request, and open file */
- buf = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
+ buf = xc_gnttab_map_grant_ref(mount->gnth,
mount->dom_id,
req->u.frename.gref,
PROT_READ);
@@ -455,7 +454,7 @@ static void dispatch_rename(struct fs_mo
ret = rename(old_file_name, new_file_name);
}
FS_DEBUG("Got ret: %d\n", ret);
- if (xc_gnttab_munmap(mount->xch, mount->gnth, buf, 1) != 0) {
+ if (xc_gnttab_munmap(mount->gnth, buf, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
@@ -487,7 +486,7 @@ static void dispatch_create(struct fs_mo
/* Read the request, and create file/directory */
mode = req->u.fcreate.mode;
directory = req->u.fcreate.directory;
- file_name = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
+ file_name = xc_gnttab_map_grant_ref(mount->gnth,
mount->dom_id,
req->u.fcreate.gref,
PROT_READ);
@@ -523,7 +522,7 @@ static void dispatch_create(struct fs_mo
}
}
out:
- if (xc_gnttab_munmap(mount->xch, mount->gnth, file_name, 1) != 0) {
+ if (xc_gnttab_munmap(mount->gnth, file_name, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
@@ -551,7 +550,7 @@ static void dispatch_list(struct fs_moun
FS_DEBUG("Dispatching list operation (gref=%d).\n", req->u.flist.gref);
/* Read the request, and list directory */
offset = req->u.flist.offset;
- buf = file_name = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
+ buf = file_name = xc_gnttab_map_grant_ref(mount->gnth,
mount->dom_id,
req->u.flist.gref,
PROT_READ | PROT_WRITE);
@@ -599,7 +598,7 @@ error_out:
ret_val = ((nr_files << NR_FILES_SHIFT) & NR_FILES_MASK) |
((error_code << ERROR_SHIFT) & ERROR_MASK) |
(dirent != NULL ? HAS_MORE_FLAG : 0);
- if (xc_gnttab_munmap(mount->xch, mount->gnth, file_name, 1) != 0) {
+ if (xc_gnttab_munmap(mount->gnth, file_name, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
@@ -654,7 +653,7 @@ static void dispatch_fs_space(struct fs_
FS_DEBUG("Dispatching fs space operation (gref=%d).\n",
req->u.fspace.gref);
/* Read the request, and open file */
- file_name = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
+ file_name = xc_gnttab_map_grant_ref(mount->gnth,
mount->dom_id,
req->u.fspace.gref,
PROT_READ);
@@ -670,7 +669,7 @@ static void dispatch_fs_space(struct fs_
if(ret >= 0)
ret = stat.f_bsize * stat.f_bfree;
- if (xc_gnttab_munmap(mount->xch, mount->gnth, file_name, 1) != 0) {
+ if (xc_gnttab_munmap(mount->gnth, file_name, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
diff -r e82cccb0d977 -r d210f8cc84b3 tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/libxc/xc_linux.c Fri Dec 03 09:36:46 2010 +0000
@@ -443,18 +443,17 @@ void discard_file_cache(xc_interface *xc
errno = saved_errno;
}
-int xc_gnttab_open(xc_interface *xch)
+int xc_gnttab_open_core(xc_gnttab *xcg)
{
return open(DEVXEN "gntdev", O_RDWR);
}
-int xc_gnttab_close(xc_interface *xch, int xcg_handle)
+int xc_gnttab_close_core(xc_gnttab *xcg)
{
- return close(xcg_handle);
+ return close(xcg->fd);
}
-void *xc_gnttab_map_grant_ref(xc_interface *xch, int xcg_handle,
- uint32_t domid, uint32_t ref, int prot)
+void *xc_gnttab_map_grant_ref(xc_gnttab *xch, uint32_t domid, uint32_t ref,
int prot)
{
struct ioctl_gntdev_map_grant_ref map;
void *addr;
@@ -463,13 +462,13 @@ void *xc_gnttab_map_grant_ref(xc_interfa
map.refs[0].domid = domid;
map.refs[0].ref = ref;
- if ( ioctl(xcg_handle, IOCTL_GNTDEV_MAP_GRANT_REF, &map) ) {
+ if ( ioctl(xch->fd, IOCTL_GNTDEV_MAP_GRANT_REF, &map) ) {
PERROR("xc_gnttab_map_grant_ref: ioctl MAP_GRANT_REF failed");
return NULL;
}
mmap_again:
- addr = mmap(NULL, PAGE_SIZE, prot, MAP_SHARED, xcg_handle, map.index);
+ addr = mmap(NULL, PAGE_SIZE, prot, MAP_SHARED, xch->fd, map.index);
if ( addr == MAP_FAILED )
{
int saved_errno = errno;
@@ -484,7 +483,7 @@ mmap_again:
PERROR("xc_gnttab_map_grant_ref: mmap failed");
unmap_grant.index = map.index;
unmap_grant.count = 1;
- ioctl(xcg_handle, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
+ ioctl(xch->fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
errno = saved_errno;
return NULL;
}
@@ -492,8 +491,7 @@ mmap_again:
return addr;
}
-static void *do_gnttab_map_grant_refs(xc_interface *xch,
- int xcg_handle, uint32_t count,
+static void *do_gnttab_map_grant_refs(xc_gnttab *xch, uint32_t count,
uint32_t *domids, int domids_stride,
uint32_t *refs, int prot)
{
@@ -514,12 +512,12 @@ static void *do_gnttab_map_grant_refs(xc
map->count = count;
- if ( ioctl(xcg_handle, IOCTL_GNTDEV_MAP_GRANT_REF, map) ) {
+ if ( ioctl(xch->fd, IOCTL_GNTDEV_MAP_GRANT_REF, map) ) {
PERROR("xc_gnttab_map_grant_refs: ioctl MAP_GRANT_REF failed");
goto out;
}
- addr = mmap(NULL, PAGE_SIZE * count, prot, MAP_SHARED, xcg_handle,
+ addr = mmap(NULL, PAGE_SIZE * count, prot, MAP_SHARED, xch->fd,
map->index);
if ( addr == MAP_FAILED )
{
@@ -530,7 +528,7 @@ static void *do_gnttab_map_grant_refs(xc
PERROR("xc_gnttab_map_grant_refs: mmap failed");
unmap_grant.index = map->index;
unmap_grant.count = count;
- ioctl(xcg_handle, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
+ ioctl(xch->fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
errno = saved_errno;
addr = NULL;
}
@@ -541,22 +539,19 @@ static void *do_gnttab_map_grant_refs(xc
return addr;
}
-void *xc_gnttab_map_grant_refs(xc_interface *xch,
- int xcg_handle, uint32_t count, uint32_t
*domids,
+void *xc_gnttab_map_grant_refs(xc_gnttab *xcg, uint32_t count, uint32_t
*domids,
uint32_t *refs, int prot)
{
- return do_gnttab_map_grant_refs(xch, xcg_handle, count, domids, 1, refs,
prot);
+ return do_gnttab_map_grant_refs(xcg, count, domids, 1, refs, prot);
}
-void *xc_gnttab_map_domain_grant_refs(xc_interface *xch,
- int xcg_handle, uint32_t count,
+void *xc_gnttab_map_domain_grant_refs(xc_gnttab *xcg, uint32_t count,
uint32_t domid, uint32_t *refs, int prot)
{
- return do_gnttab_map_grant_refs(xch, xcg_handle, count, &domid, 0, refs,
prot);
+ return do_gnttab_map_grant_refs(xcg, count, &domid, 0, refs, prot);
}
-int xc_gnttab_munmap(xc_interface *xch,
- int xcg_handle, void *start_address, uint32_t count)
+int xc_gnttab_munmap(xc_gnttab *xcg, void *start_address, uint32_t count)
{
struct ioctl_gntdev_get_offset_for_vaddr get_offset;
struct ioctl_gntdev_unmap_grant_ref unmap_grant;
@@ -572,7 +567,7 @@ int xc_gnttab_munmap(xc_interface *xch,
* mmap() the pages.
*/
get_offset.vaddr = (unsigned long)start_address;
- if ( (rc = ioctl(xcg_handle, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR,
+ if ( (rc = ioctl(xcg->fd, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR,
&get_offset)) )
return rc;
@@ -589,20 +584,19 @@ int xc_gnttab_munmap(xc_interface *xch,
/* Finally, unmap the driver slots used to store the grant information. */
unmap_grant.index = get_offset.offset;
unmap_grant.count = count;
- if ( (rc = ioctl(xcg_handle, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant)) )
+ if ( (rc = ioctl(xcg->fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant)) )
return rc;
return 0;
}
-int xc_gnttab_set_max_grants(xc_interface *xch,
- int xcg_handle, uint32_t count)
+int xc_gnttab_set_max_grants(xc_gnttab *xcg, uint32_t count)
{
struct ioctl_gntdev_set_max_grants set_max;
int rc;
set_max.count = count;
- if ( (rc = ioctl(xcg_handle, IOCTL_GNTDEV_SET_MAX_GRANTS, &set_max)) )
+ if ( (rc = ioctl(xcg->fd, IOCTL_GNTDEV_SET_MAX_GRANTS, &set_max)) )
return rc;
return 0;
diff -r e82cccb0d977 -r d210f8cc84b3 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/libxc/xc_minios.c Fri Dec 03 09:36:46 2010 +0000
@@ -375,17 +375,17 @@ void discard_file_cache(xc_interface *xc
fsync(fd);
}
-int xc_gnttab_open(xc_interface *xch)
+int xc_gnttab_open_core(xc_gnttab *xcg)
{
- int xcg_handle;
- xcg_handle = alloc_fd(FTYPE_GNTMAP);
- gntmap_init(&files[xcg_handle].gntmap);
- return xcg_handle;
+ int fd;
+ fd = alloc_fd(FTYPE_GNTMAP);
+ gntmap_init(&files[fd].gntmap);
+ return fd;
}
-int xc_gnttab_close(xc_interface *xch, int xcg_handle)
+int xc_gnttab_close_core(xc_gnttab *xcg)
{
- return close(xcg_handle);
+ return close(xcg->fd);
}
void minios_gnttab_close_fd(int fd)
@@ -394,50 +394,50 @@ void minios_gnttab_close_fd(int fd)
files[fd].type = FTYPE_NONE;
}
-void *xc_gnttab_map_grant_ref(xc_interface *xch, int xcg_handle,
+void *xc_gnttab_map_grant_ref(xc_gnttab *xcg,
uint32_t domid,
uint32_t ref,
int prot)
{
- return gntmap_map_grant_refs(&files[xcg_handle].gntmap,
+ return gntmap_map_grant_refs(&files[xcg->fd].gntmap,
1,
&domid, 0,
&ref,
prot & PROT_WRITE);
}
-void *xc_gnttab_map_grant_refs(xc_interface *xch, int xcg_handle,
+void *xc_gnttab_map_grant_refs(xc_gnttab *xcg,
uint32_t count,
uint32_t *domids,
uint32_t *refs,
int prot)
{
- return gntmap_map_grant_refs(&files[xcg_handle].gntmap,
+ return gntmap_map_grant_refs(&files[xcg->fd].gntmap,
count,
domids, 1,
refs,
prot & PROT_WRITE);
}
-void *xc_gnttab_map_domain_grant_refs(xc_interface *xch, int xcg_handle,
+void *xc_gnttab_map_domain_grant_refs(xc_gnttab *xcg,
uint32_t count,
uint32_t domid,
uint32_t *refs,
int prot)
{
- return gntmap_map_grant_refs(&files[xcg_handle].gntmap,
+ return gntmap_map_grant_refs(&files[xcg->fd].gntmap,
count,
&domid, 0,
refs,
prot & PROT_WRITE);
}
-int xc_gnttab_munmap(xc_interface *xch, int xcg_handle,
+int xc_gnttab_munmap(xc_gnttab *xcg,
void *start_address,
uint32_t count)
{
int ret;
- ret = gntmap_munmap(&files[xcg_handle].gntmap,
+ ret = gntmap_munmap(&files[xcg->fd].gntmap,
(unsigned long) start_address,
count);
if (ret < 0) {
@@ -447,11 +447,11 @@ int xc_gnttab_munmap(xc_interface *xch,
return ret;
}
-int xc_gnttab_set_max_grants(xc_interface *xch, int xcg_handle,
+int xc_gnttab_set_max_grants(xc_gnttab *xcg,
uint32_t count)
{
int ret;
- ret = gntmap_set_max_grants(&files[xcg_handle].gntmap,
+ ret = gntmap_set_max_grants(&files[xcg->fd].gntmap,
count);
if (ret < 0) {
errno = -ret;
diff -r e82cccb0d977 -r d210f8cc84b3 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/libxc/xc_private.c Fri Dec 03 09:36:46 2010 +0000
@@ -113,6 +113,18 @@ int xc_evtchn_close(xc_evtchn *xce)
int xc_evtchn_close(xc_evtchn *xce)
{
return xc_interface_close_common(xce, &xc_evtchn_close_core);
+}
+
+xc_gnttab *xc_gnttab_open(xentoollog_logger *logger,
+ unsigned open_flags)
+{
+ return xc_interface_open_common(logger, NULL, open_flags,
+ XC_INTERFACE_GNTTAB, &xc_gnttab_open_core);
+}
+
+int xc_gnttab_close(xc_gnttab *xcg)
+{
+ return xc_interface_close_common(xcg, &xc_gnttab_close_core);
}
static pthread_key_t errbuf_pkey;
diff -r e82cccb0d977 -r d210f8cc84b3 tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/libxc/xc_private.h Fri Dec 03 09:36:46 2010 +0000
@@ -68,6 +68,7 @@ enum xc_interface_type {
enum xc_interface_type {
XC_INTERFACE_PRIVCMD,
XC_INTERFACE_EVTCHN,
+ XC_INTERFACE_GNTTAB,
};
struct xc_interface_core {
@@ -269,6 +270,9 @@ int xc_evtchn_open_core(struct xc_interf
int xc_evtchn_open_core(struct xc_interface_core *xce); /* returns fd, logs
errors */
int xc_evtchn_close_core(struct xc_interface_core *xce); /* no logging */
+int xc_gnttab_open_core(struct xc_interface_core *xcg); /* returns fd, logs
errors */
+int xc_gnttab_close_core(struct xc_interface_core *xcg); /* no logging */
+
void *xc_map_foreign_ranges(xc_interface *xch, uint32_t dom,
size_t size, int prot, size_t chunksize,
privcmd_mmap_entry_t entries[], int nentries);
diff -r e82cccb0d977 -r d210f8cc84b3 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Fri Dec 03 09:36:46 2010 +0000
+++ b/tools/libxc/xenctrl.h Fri Dec 03 09:36:46 2010 +0000
@@ -106,6 +106,7 @@
typedef struct xc_interface_core xc_interface;
typedef struct xc_interface_core xc_evtchn;
+typedef struct xc_interface_core xc_gnttab;
typedef enum xc_error_code xc_error_code;
@@ -1239,25 +1240,25 @@ int xc_domain_subscribe_for_suspend(
/*
* Return an fd onto the grant table driver. Logs errors.
*/
-int xc_gnttab_open(xc_interface *xch);
+xc_gnttab *xc_gnttab_open(xentoollog_logger *logger,
+ unsigned open_flags);
/*
* Close a handle previously allocated with xc_gnttab_open().
* Never logs errors.
*/
-int xc_gnttab_close(xc_interface *xch, int xcg_handle);
+int xc_gnttab_close(xc_gnttab *xcg);
/*
* Memory maps a grant reference from one domain to a local address range.
* Mappings should be unmapped with xc_gnttab_munmap. Logs errors.
*
- * @parm xcg_handle a handle on an open grant table interface
+ * @parm xcg a handle on an open grant table interface
* @parm domid the domain to map memory from
* @parm ref the grant reference ID to map
* @parm prot same flag as in mmap()
*/
-void *xc_gnttab_map_grant_ref(xc_interface *xch,
- int xcg_handle,
+void *xc_gnttab_map_grant_ref(xc_gnttab *xcg,
uint32_t domid,
uint32_t ref,
int prot);
@@ -1267,15 +1268,14 @@ void *xc_gnttab_map_grant_ref(xc_interfa
* contiguous local address range. Mappings should be unmapped with
* xc_gnttab_munmap. Logs errors.
*
- * @parm xcg_handle a handle on an open grant table interface
+ * @parm xcg a handle on an open grant table interface
* @parm count the number of grant references to be mapped
* @parm domids an array of @count domain IDs by which the corresponding @refs
* were granted
* @parm refs an array of @count grant references to be mapped
* @parm prot same flag as in mmap()
*/
-void *xc_gnttab_map_grant_refs(xc_interface *xch,
- int xcg_handle,
+void *xc_gnttab_map_grant_refs(xc_gnttab *xcg,
uint32_t count,
uint32_t *domids,
uint32_t *refs,
@@ -1286,14 +1286,13 @@ void *xc_gnttab_map_grant_refs(xc_interf
* contiguous local address range. Mappings should be unmapped with
* xc_gnttab_munmap. Logs errors.
*
- * @parm xcg_handle a handle on an open grant table interface
+ * @parm xcg a handle on an open grant table interface
* @parm count the number of grant references to be mapped
* @parm domid the domain to map memory from
* @parm refs an array of @count grant references to be mapped
* @parm prot same flag as in mmap()
*/
-void *xc_gnttab_map_domain_grant_refs(xc_interface *xch,
- int xcg_handle,
+void *xc_gnttab_map_domain_grant_refs(xc_gnttab *xcg,
uint32_t count,
uint32_t domid,
uint32_t *refs,
@@ -1303,8 +1302,7 @@ void *xc_gnttab_map_domain_grant_refs(xc
* Unmaps the @count pages starting at @start_address, which were mapped by a
* call to xc_gnttab_map_grant_ref or xc_gnttab_map_grant_refs. Never logs.
*/
-int xc_gnttab_munmap(xc_interface *xch,
- int xcg_handle,
+int xc_gnttab_munmap(xc_gnttab *xcg,
void *start_address,
uint32_t count);
@@ -1319,8 +1317,7 @@ int xc_gnttab_munmap(xc_interface *xch,
* and it may not be possible to satisfy requests up to the maximum number
* of grants.
*/
-int xc_gnttab_set_max_grants(xc_interface *xch,
- int xcg_handle,
+int xc_gnttab_set_max_grants(xc_gnttab *xcg,
uint32_t count);
int xc_gnttab_op(xc_interface *xch, int cmd,
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|