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

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



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

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

diff -r c64fd0d604b0 -r 3da69fbb6ff2 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
@@ -20,8 +20,15 @@
 
 #include "xc_private.h"
 
+void *xc_map_foreign_range(xc_interface *xch, uint32_t dom,
+                           int size, int prot, unsigned long mfn)
+{
+    return xch->ops->u.privcmd.map_foreign_range(xch, xch->ops_handle,
+                                                 dom, size, prot, mfn);
+}
+
 void *xc_map_foreign_batch(xc_interface *xch, uint32_t dom, int prot,
-                           xen_pfn_t *arr, int num )
+                           xen_pfn_t *arr, int num)
 {
     return xch->ops->u.privcmd.map_foreign_batch(xch, xch->ops_handle,
                                                  dom, prot, arr, num);
@@ -33,3 +40,13 @@ void *xc_map_foreign_bulk(xc_interface *
     return xch->ops->u.privcmd.map_foreign_bulk(xch, xch->ops_handle,
                                                 dom, prot, arr, err, num);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r c64fd0d604b0 -r 3da69fbb6ff2 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
@@ -283,8 +283,9 @@ static void *linux_privcmd_map_foreign_b
     return addr;
 }
 
-void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot,
-                           unsigned long mfn)
+static void *linux_privcmd_map_foreign_range(xc_interface *xch, 
xc_osdep_handle h,
+                                             uint32_t dom, int size, int prot,
+                                             unsigned long mfn)
 {
     xen_pfn_t *arr;
     int num;
@@ -335,6 +336,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,
     },
 };
 
diff -r c64fd0d604b0 -r 3da69fbb6ff2 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
@@ -134,9 +134,10 @@ static void *minios_privcmd_map_foreign_
     return (void *) addr;
 }
 
-void *xc_map_foreign_range(xc_interface *xch, uint32_t dom,
-                           int size, int prot,
-                           unsigned long mfn)
+static void *minios_privcmd_map_foreign_range(xc_interface *xch, 
xc_osdep_handle h,
+                                              uint32_t dom,
+                                              int size, int prot,
+                                              unsigned long mfn)
 {
     unsigned long pt_prot = 0;
 #ifdef __ia64__
@@ -190,6 +191,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,
     },
 };
 
diff -r c64fd0d604b0 -r 3da69fbb6ff2 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
@@ -108,10 +108,12 @@ static void *netbsd_privcmd_map_foreign_
 
 }
 
-void *xc_map_foreign_range(xc_interface *xch, uint32_t dom,
-                           int size, int prot,
-                           unsigned long mfn)
-{
+static void *netbsd_privcmd_map_foreign_range(xc_interface *xch, 
xc_osdep_handle h,
+                                              uint32_t dom,
+                                              int size, int prot,
+                                              unsigned long mfn)
+{
+    int fd = (int)h;
     privcmd_mmap_t ioctlx;
     privcmd_mmap_entry_t entry;
     void *addr;
@@ -127,7 +129,7 @@ void *xc_map_foreign_range(xc_interface 
     entry.va=(unsigned long) addr;
     entry.mfn=mfn;
     entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
-    if ( ioctl(xch->fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 )
+    if ( ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 )
     {
         int saved_errno = errno;
         PERROR("xc_map_foreign_range: ioctl failed");
@@ -183,6 +185,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,
     },
 };
 
diff -r c64fd0d604b0 -r 3da69fbb6ff2 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
@@ -101,14 +101,16 @@ static void *solaris_privcmd_map_foreign
 
 }
 
-void *xc_map_foreign_range(xc_interface *xch, uint32_t dom,
-                           int size, int prot,
-                           unsigned long mfn)
-{
+static void *xc_map_foreign_range(xc_interface *xch, xc_osdep_handle h,
+                                  uint32_t dom,
+                                  int size, int prot,
+                                  unsigned long mfn)
+{
+    int fd = (int)fd;
     privcmd_mmap_t ioctlx;
     privcmd_mmap_entry_t entry;
     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 )
         return NULL;
 
@@ -118,7 +120,7 @@ void *xc_map_foreign_range(xc_interface 
     entry.va=(unsigned long) addr;
     entry.mfn=mfn;
     entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
-    if ( ioctl(xch->fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 )
+    if ( ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 )
     {
         int saved_errno = errno;
         (void)munmap(addr, size);
@@ -173,6 +175,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,
     },
 };
 
diff -r c64fd0d604b0 -r 3da69fbb6ff2 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
@@ -68,6 +68,8 @@ struct xc_osdep_ops
                                        xen_pfn_t *arr, int num);
             void *(*map_foreign_bulk)(xc_interface *xch, xc_osdep_handle h, 
uint32_t dom, int prot,
                                       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);
         } 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®.