libxc: osdep: convert xc_gnttab_set_max_grants()
authorIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxc/xc_gnttab.c
tools/libxc/xc_linux.c
tools/libxc/xc_minios.c
tools/libxc/xenctrlosdep.h

index eb78d0132731575e2d99fe6db5b8646d786a03af..ae152fd2a54381d39af7f21d97913c441cd82971 100644 (file)
@@ -182,6 +182,10 @@ int xc_gnttab_munmap(xc_gnttab *xcg,
                                         start_address, count);
 }
 
+int xc_gnttab_set_max_grants(xc_gnttab *xcg, uint32_t count)
+{
+       return xcg->ops->u.gnttab.set_max_grants(xcg, xcg->ops_handle, count);
+}
 
 /*
  * Local variables:
index 945b26f93d031ef1424e5c519d1ac1785125b35a..7c62ee375e876197ff285d2b730e913097cbf7f0 100644 (file)
@@ -653,13 +653,14 @@ static int linux_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
     return 0;
 }
 
-int xc_gnttab_set_max_grants(xc_gnttab *xcg, uint32_t count)
+static int linux_gnttab_set_max_grants(xc_gnttab *xcg, xc_osdep_handle h, uint32_t count)
 {
+    int fd = (int)h;
     struct ioctl_gntdev_set_max_grants set_max;
     int rc;
 
     set_max.count = count;
-    if ( (rc = ioctl(xcg->fd, IOCTL_GNTDEV_SET_MAX_GRANTS, &set_max)) )
+    if ( (rc = ioctl(fd, IOCTL_GNTDEV_SET_MAX_GRANTS, &set_max)) )
         return rc;
 
     return 0;
@@ -674,6 +675,7 @@ static struct xc_osdep_ops linux_gnttab_ops = {
         .map_grant_refs = &linux_gnttab_map_grant_refs,
         .map_domain_grant_refs = &linux_gnttab_map_domain_grant_refs,
         .munmap = &linux_gnttab_munmap,
+        .set_max_grants = &linux_gnttab_set_max_grants,
     },
 };
 
index c249f81cbe62f5fedecacd67a804e89da02c176b..2d5b43544c0c5be60f8f8a6ec3d6b752fe0e5aea 100644 (file)
@@ -504,11 +504,12 @@ static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
     return ret;
 }
 
-int xc_gnttab_set_max_grants(xc_gnttab *xcg,
+static int minios_gnttab_set_max_grants(xc_gnttab *xcg, xc_osdep_handle h,
                              uint32_t count)
 {
+    int fd = (int)h;
     int ret;
-    ret = gntmap_set_max_grants(&files[xcg->fd].gntmap,
+    ret = gntmap_set_max_grants(&files[fd].gntmap,
                                 count);
     if (ret < 0) {
         errno = -ret;
@@ -526,6 +527,7 @@ static struct xc_osdep_ops minios_gnttab_ops = {
         .map_grant_refs = &minios_gnttab_map_grant_refs,
         .map_domain_grant_refs = &minios_gnttab_map_domain_grant_refs,
         .munmap = &minios_gnttab_munmap,
+        .set_max_grants = &minios_gnttab_set_max_grants,
     },
 };
 
index 094d03504547f63b56c7e4bd9ea5388b31dd3c53..d862fcff859c0a952dfc5d0342ccc658430a6d34 100644 (file)
@@ -107,6 +107,7 @@ struct xc_osdep_ops
             int (*munmap)(xc_gnttab *xcg, xc_osdep_handle h,
                           void *start_address,
                           uint32_t count);
+            int (*set_max_grants)(xc_gnttab *xcg, xc_osdep_handle h, uint32_t count);
         } gnttab;
     } u;
 };