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

[Xen-changelog] [xen-unstable] libxc: osdep: convert xc_map_foreign_ranges()



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369007 0
# Node ID 70884d5a273d23757412e82fa69077c8dbf4d90f
# Parent  3da69fbb6ff2ab175d93f4982f3a5c3f64d06ee5
libxc: osdep: convert xc_map_foreign_ranges()

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
---
 tools/libxc/xc_foreign_memory.c |    8 ++++++++
 tools/libxc/xc_linux.c          |    8 +++++---
 tools/libxc/xc_minios.c         |    8 +++++---
 tools/libxc/xc_netbsd.c         |   13 ++++++++-----
 tools/libxc/xc_solaris.c        |   15 +++++++++------
 tools/libxc/xenctrlosdep.h      |    3 +++
 6 files changed, 38 insertions(+), 17 deletions(-)

diff -r 3da69fbb6ff2 -r 70884d5a273d tools/libxc/xc_foreign_memory.c
--- a/tools/libxc/xc_foreign_memory.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_foreign_memory.c   Fri Dec 03 09:36:47 2010 +0000
@@ -27,6 +27,14 @@ void *xc_map_foreign_range(xc_interface 
                                                  dom, size, prot, mfn);
 }
 
+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)
+{
+    return xch->ops->u.privcmd.map_foreign_ranges(xch, xch->ops_handle,
+                                                  dom, size, prot, chunksize, 
entries, nentries);
+}
+
 void *xc_map_foreign_batch(xc_interface *xch, uint32_t dom, int prot,
                            xen_pfn_t *arr, int num)
 {
diff -r 3da69fbb6ff2 -r 70884d5a273d 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
@@ -303,9 +303,10 @@ static void *linux_privcmd_map_foreign_r
     return ret;
 }
 
-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)
+static void *linux_privcmd_map_foreign_ranges(xc_interface *xch, 
xc_osdep_handle h,
+                                              uint32_t dom, size_t size, int 
prot,
+                                              size_t chunksize, 
privcmd_mmap_entry_t entries[],
+                                              int nentries)
 {
     xen_pfn_t *arr;
     int num_per_entry;
@@ -337,6 +338,7 @@ static struct xc_osdep_ops linux_privcmd
         .map_foreign_batch = &linux_privcmd_map_foreign_batch,
         .map_foreign_bulk = &linux_privcmd_map_foreign_bulk,
         .map_foreign_range = &linux_privcmd_map_foreign_range,
+        .map_foreign_ranges = &linux_privcmd_map_foreign_ranges,
     },
 };
 
diff -r 3da69fbb6ff2 -r 70884d5a273d 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
@@ -152,9 +152,10 @@ static void *minios_privcmd_map_foreign_
     return map_frames_ex(&mfn, size / getpagesize(), 0, 1, 1, dom, NULL, 
pt_prot);
 }
 
-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)
+static void *minios_privcmd_map_foreign_ranges(xc_interface *xch, 
xc_osdep_handle h,
+                                               uint32_t dom,
+                                               size_t size, int prot, size_t 
chunksize,
+                                               privcmd_mmap_entry_t entries[], 
int nentries)
 {
     unsigned long *mfns;
     int i, j, n;
@@ -192,6 +193,7 @@ static struct xc_osdep_ops minios_privcm
         .map_foreign_batch = &minios_privcmd_map_foreign_batch,
         .map_foreign_bulk = &minios_privcmd_map_foreign_bulk,
         .map_foreign_range = &minios_privcmd_map_foreign_range,
+        .map_foreign_ranges = &minios_privcmd_map_foreign_ranges,
     },
 };
 
diff -r 3da69fbb6ff2 -r 70884d5a273d tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_netbsd.c   Fri Dec 03 09:36:47 2010 +0000
@@ -140,10 +140,12 @@ static void *netbsd_privcmd_map_foreign_
     return addr;
 }
 
-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)
-{
+static void *netbsd_privcmd_map_foreign_ranges(xc_interface *xch, 
xc_osdep_handle h,
+                                               uint32_t dom,
+                                               size_t size, int prot, size_t 
chunksize,
+                                               privcmd_mmap_entry_t entries[], 
int nentries)
+{
+    int fd = (int)h;
        privcmd_mmap_t ioctlx;
        int i, rc;
        void *addr;
@@ -161,7 +163,7 @@ void *xc_map_foreign_ranges(xc_interface
        ioctlx.dom   = dom;
        ioctlx.entry = entries;
 
-       rc = ioctl(xch->fd, IOCTL_PRIVCMD_MMAP, &ioctlx);
+       rc = ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx);
        if (rc)
                goto ioctl_failed;
 
@@ -186,6 +188,7 @@ static struct xc_osdep_ops netbsd_privcm
         .map_foreign_batch = &netbsd_privcmd_map_foreign_batch,
         .map_foreign_bulk = &xc_map_foreign_bulk_compat,
         .map_foreign_range = &netbsd_privcmd_map_foreign_range,
+        .map_foreign_ranges = &netbsd_privcmd_map_foreign_ranges,
     },
 };
 
diff -r 3da69fbb6ff2 -r 70884d5a273d tools/libxc/xc_solaris.c
--- a/tools/libxc/xc_solaris.c  Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_solaris.c  Fri Dec 03 09:36:47 2010 +0000
@@ -130,15 +130,17 @@ static void *xc_map_foreign_range(xc_int
     return addr;
 }
 
-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)
-{
+static void *solaric_privcmd_map_foreign_ranges(xc_interface *xch, 
xc_osdep_handle h,
+                                                uint32_t dom,
+                                                size_t size, int prot, size_t 
chunksize,
+                                                privcmd_mmap_entry_t 
entries[], int nentries)
+{
+    int fd = (int)fd;
     privcmd_mmap_t ioctlx;
     int i, rc;
     void *addr;
 
-    addr = mmap(NULL, size, prot, MAP_SHARED, xch->fd, 0);
+    addr = mmap(NULL, size, prot, MAP_SHARED, fd, 0);
     if (addr == MAP_FAILED)
         goto mmap_failed;
 
@@ -151,7 +153,7 @@ void *xc_map_foreign_ranges(xc_interface
     ioctlx.dom   = dom;
     ioctlx.entry = entries;
 
-    rc = ioctl(xch->fd, IOCTL_PRIVCMD_MMAP, &ioctlx);
+    rc = ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx);
     if (rc)
         goto ioctl_failed;
 
@@ -176,6 +178,7 @@ static struct xc_osdep_ops solaris_privc
         .map_foreign_batch = &solaris_privcmd_map_foreign_batch,
         .map_foreign_bulk = &xc_map_foreign_bulk_compat,
         .map_foreign_range = &solaris_privcmd_map_foreign_range,
+        .map_foreign_ranges = &solaris_privcmd_map_foreign_ranges,
     },
 };
 
diff -r 3da69fbb6ff2 -r 70884d5a273d 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
@@ -70,6 +70,9 @@ struct xc_osdep_ops
                                       const xen_pfn_t *arr, int *err, unsigned 
int num);
             void *(*map_foreign_range)(xc_interface *xch, xc_osdep_handle h, 
uint32_t dom, int size, int prot,
                                        unsigned long mfn);
+            void *(*map_foreign_ranges)(xc_interface *xch, xc_osdep_handle h, 
uint32_t dom, size_t size, int prot,
+                                        size_t chunksize, privcmd_mmap_entry_t 
entries[],
+                                        int nentries);
         } privcmd;
     } u;
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.