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: Reorder functions in xc_misc.c to

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: Reorder functions in xc_misc.c to avoid weak symbol problem
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Feb 2010 05:20:17 -0800
Delivery-date: Thu, 04 Feb 2010 05:20:26 -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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1265289399 0
# Node ID 3c3759296796ae9b986c1ec295ce66b654589f7f
# Parent  8c18892970840a17b91cede4f2e923181414d134
libxc: Reorder functions in xc_misc.c to avoid weak symbol problem

Using a function, and then declaring it weak later, has undefined
behaviour:
  cc1: warnings being treated as errors
  xc_misc.c:388: error: weak declaration of 'xc_map_foreign_bulk'
  after first use results in unspecified behavior

So swap the functions xc_map_foreign_pages and xc_map_foreign_bulk.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxc/xc_misc.c |   62 +++++++++++++++++++++++++-------------------------
 1 files changed, 31 insertions(+), 31 deletions(-)

diff -r 8c1889297084 -r 3c3759296796 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Thu Feb 04 13:16:03 2010 +0000
+++ b/tools/libxc/xc_misc.c     Thu Feb 04 13:16:39 2010 +0000
@@ -369,37 +369,6 @@ int xc_hvm_set_mem_type(
     return rc;
 }
 
-
-void *xc_map_foreign_pages(int xc_handle, 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(xc_handle, 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;
-}
 
 /* stub for all not yet converted OSes */
 void *
@@ -445,6 +414,37 @@ xc_map_foreign_bulk(int xc_handle, uint3
     return ret;
 }
 
+void *xc_map_foreign_pages(int xc_handle, 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(xc_handle, 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: Reorder functions in xc_misc.c to avoid weak symbol problem, Xen patchbot-unstable <=