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-changelog

[Xen-changelog] [xen-unstable] libxc: move foreign memory functions to x

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: move foreign memory functions to xc_foreign_memory.c
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Dec 2010 15:46:14 -0800
Delivery-date: Fri, 24 Dec 2010 15:49:52 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369007 0
# Node ID 51defb6d39bed1d8ad39d89ffdb34737051dfd4b
# Parent  81987b3eac08d0fe35ecd0a7568642fae1b8e5b9
libxc: move foreign memory functions to xc_foreign_memory.c

Now that this file exists it is a better home for these than xc_misc.c

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
---
 tools/libxc/xc_foreign_memory.c |   72 ++++++++++++++++++++++++++++++++++++++++
 tools/libxc/xc_misc.c           |   72 ----------------------------------------
 2 files changed, 72 insertions(+), 72 deletions(-)

diff -r 81987b3eac08 -r 51defb6d39be 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
@@ -19,6 +19,37 @@
  */
 
 #include "xc_private.h"
+
+void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot,
+                           const xen_pfn_t *arr, int num)
+{
+    void *res;
+    int i, *err;
+
+    if (num < 0) {
+        errno = -EINVAL;
+        return NULL;
+    }
+
+    err = malloc(num * sizeof(*err));
+    if (!err)
+        return NULL;
+
+    res = xc_map_foreign_bulk(xch, dom, prot, arr, err, num);
+    if (res) {
+        for (i = 0; i < num; i++) {
+            if (err[i]) {
+                errno = -err[i];
+                munmap(res, num * PAGE_SIZE);
+                res = NULL;
+                break;
+            }
+        }
+    }
+
+    free(err);
+    return res;
+}
 
 void *xc_map_foreign_range(xc_interface *xch, uint32_t dom,
                            int size, int prot, unsigned long mfn)
@@ -49,6 +80,47 @@ void *xc_map_foreign_bulk(xc_interface *
                                                 dom, prot, arr, err, num);
 }
 
+/* stub for all not yet converted OSes */
+void *xc_map_foreign_bulk_compat(xc_interface *xch, xc_osdep_handle h,
+                                 uint32_t dom, int prot,
+                                 const xen_pfn_t *arr, int *err, unsigned int 
num)
+{
+    xen_pfn_t *pfn;
+    unsigned int i;
+    void *ret;
+
+    if ((int)num <= 0) {
+        errno = EINVAL;
+        return NULL;
+    }
+
+    pfn = malloc(num * sizeof(*pfn));
+    if (!pfn) {
+        errno = ENOMEM;
+        return NULL;
+    }
+
+    memcpy(pfn, arr, num * sizeof(*arr));
+    ret = xc_map_foreign_batch(xch, dom, prot, pfn, num);
+
+    if (ret) {
+        for (i = 0; i < num; ++i)
+            switch (pfn[i] ^ arr[i]) {
+            case 0:
+                err[i] = 0;
+                break;
+            default:
+                err[i] = -EINVAL;
+                break;
+            }
+    } else
+        memset(err, 0, num * sizeof(*err));
+
+    free(pfn);
+
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 81987b3eac08 -r 51defb6d39be tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_misc.c     Fri Dec 03 09:36:47 2010 +0000
@@ -512,78 +512,6 @@ int xc_hvm_set_mem_type(
 }
 
 
-/* stub for all not yet converted OSes */
-void *xc_map_foreign_bulk_compat(xc_interface *xch, xc_osdep_handle h,
-                                 uint32_t dom, int prot,
-                                 const xen_pfn_t *arr, int *err, unsigned int 
num)
-{
-    xen_pfn_t *pfn;
-    unsigned int i;
-    void *ret;
-
-    if ((int)num <= 0) {
-        errno = EINVAL;
-        return NULL;
-    }
-
-    pfn = malloc(num * sizeof(*pfn));
-    if (!pfn) {
-        errno = ENOMEM;
-        return NULL;
-    }
-
-    memcpy(pfn, arr, num * sizeof(*arr));
-    ret = xc_map_foreign_batch(xch, dom, prot, pfn, num);
-
-    if (ret) {
-        for (i = 0; i < num; ++i)
-            switch (pfn[i] ^ arr[i]) {
-            case 0:
-                err[i] = 0;
-                break;
-            default:
-                err[i] = -EINVAL;
-                break;
-            }
-    } else
-        memset(err, 0, num * sizeof(*err));
-
-    free(pfn);
-
-    return ret;
-}
-
-void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot,
-                           const xen_pfn_t *arr, int num)
-{
-    void *res;
-    int i, *err;
-
-    if (num < 0) {
-        errno = -EINVAL;
-        return NULL;
-    }
-
-    err = malloc(num * sizeof(*err));
-    if (!err)
-        return NULL;
-
-    res = xc_map_foreign_bulk(xch, dom, prot, arr, err, num);
-    if (res) {
-        for (i = 0; i < num; i++) {
-            if (err[i]) {
-                errno = -err[i];
-                munmap(res, num * PAGE_SIZE);
-                res = NULL;
-                break;
-            }
-        }
-    }
-
-    free(err);
-    return res;
-}
-
 /*
  * Local variables:
  * mode: C

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxc: move foreign memory functions to xc_foreign_memory.c, Xen patchbot-unstable <=