WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 07 of 25] libxc: osdep: convert xc_map_foreign_range(

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 07 of 25] libxc: osdep: convert xc_map_foreign_range()
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 03 Dec 2010 09:57:11 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 03 Dec 2010 02:09:19 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1291370224@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369007 0
# Node ID 1c71417729377312b82096541adec0bd19e8f2d0
# Parent  d0214e8537cee3c401e5ba5567d632d386ac5860
libxc: osdep: convert xc_map_foreign_range()

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

diff -r d0214e8537ce -r 1c7141772937 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 d0214e8537ce -r 1c7141772937 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 d0214e8537ce -r 1c7141772937 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 d0214e8537ce -r 1c7141772937 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 d0214e8537ce -r 1c7141772937 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 d0214e8537ce -r 1c7141772937 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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>