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>
diff -r aeb8a70f42a5 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c Tue Feb 02 17:19:23 2010 +0000
+++ b/tools/libxc/xc_misc.c Thu Feb 04 12:00:45 2010 +0000
@@ -349,37 +349,6 @@
}
-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 *
#ifdef __GNUC__
@@ -424,6 +393,37 @@
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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|