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

[Xen-devel] [PATCH 17 of 25] libxc: osdep: convert xc_gnttab_munmap()



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369007 0
# Node ID c5abbf2d6709770c039f2a01712986b1e37ec118
# Parent  68996338758eabdecbdfc5cfb4aa82ab7589b4e6
libxc: osdep: convert xc_gnttab_munmap()

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 68996338758e -r c5abbf2d6709 tools/libxc/xc_gnttab.c
--- a/tools/libxc/xc_gnttab.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_gnttab.c   Fri Dec 03 09:36:47 2010 +0000
@@ -174,6 +174,15 @@ void *xc_gnttab_map_domain_grant_refs(xc
                                                        count, domid, refs, 
prot);
 }
 
+int xc_gnttab_munmap(xc_gnttab *xcg,
+                     void *start_address,
+                     uint32_t count)
+{
+       return xcg->ops->u.gnttab.munmap(xcg, xcg->ops_handle,
+                                        start_address, count);
+}
+
+
 /*
  * Local variables:
  * mode: C
diff -r 68996338758e -r c5abbf2d6709 tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c    Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_linux.c    Fri Dec 03 09:36:47 2010 +0000
@@ -612,8 +612,10 @@ static void *linux_gnttab_map_domain_gra
     return do_gnttab_map_grant_refs(xcg, h, count, &domid, 0, refs, prot);
 }
 
-int xc_gnttab_munmap(xc_gnttab *xcg, void *start_address, uint32_t count)
+static int linux_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
+                               void *start_address, uint32_t count)
 {
+    int fd = (int)h;
     struct ioctl_gntdev_get_offset_for_vaddr get_offset;
     struct ioctl_gntdev_unmap_grant_ref unmap_grant;
     int rc;
@@ -628,7 +630,7 @@ int xc_gnttab_munmap(xc_gnttab *xcg, voi
      * mmap() the pages.
      */
     get_offset.vaddr = (unsigned long)start_address;
-    if ( (rc = ioctl(xcg->fd, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR,
+    if ( (rc = ioctl(fd, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR,
                      &get_offset)) )
         return rc;
 
@@ -645,7 +647,7 @@ int xc_gnttab_munmap(xc_gnttab *xcg, voi
     /* 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->fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant)) )
+    if ( (rc = ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant)) )
         return rc;
 
     return 0;
@@ -671,6 +673,7 @@ static struct xc_osdep_ops linux_gnttab_
         .map_grant_ref = &linux_gnttab_map_grant_ref,
         .map_grant_refs = &linux_gnttab_map_grant_refs,
         .map_domain_grant_refs = &linux_gnttab_map_domain_grant_refs,
+        .munmap = &linux_gnttab_munmap,
     },
 };
 
diff -r 68996338758e -r c5abbf2d6709 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_minios.c   Fri Dec 03 09:36:47 2010 +0000
@@ -488,12 +488,13 @@ static void *minios_gnttab_map_domain_gr
                                  prot & PROT_WRITE);
 }
 
-int xc_gnttab_munmap(xc_gnttab *xcg,
-                     void *start_address,
-                     uint32_t count)
+static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
+                                void *start_address,
+                                uint32_t count)
 {
+    int fd = (int)h;
     int ret;
-    ret = gntmap_munmap(&files[xcg->fd].gntmap,
+    ret = gntmap_munmap(&files[fd].gntmap,
                         (unsigned long) start_address,
                         count);
     if (ret < 0) {
@@ -524,6 +525,7 @@ static struct xc_osdep_ops minios_gnttab
         .map_grant_ref = &minios_gnttab_map_grant_ref,
         .map_grant_refs = &minios_gnttab_map_grant_refs,
         .map_domain_grant_refs = &minios_gnttab_map_domain_grant_refs,
+        .munmap = &minios_gnttab_munmap,
     },
 };
 
diff -r 68996338758e -r c5abbf2d6709 tools/libxc/xenctrlosdep.h
--- a/tools/libxc/xenctrlosdep.h        Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xenctrlosdep.h        Fri Dec 03 09:36:47 2010 +0000
@@ -104,6 +104,9 @@ struct xc_osdep_ops
                                            uint32_t domid,
                                            uint32_t *refs,
                                            int prot);
+            int (*munmap)(xc_gnttab *xcg, xc_osdep_handle h,
+                          void *start_address,
+                          uint32_t count);
         } gnttab;
     } u;
 };

_______________________________________________
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®.