diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-02-04 13:16:39 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-02-04 13:16:39 +0000 |
commit | e670c28c9f0b284c05e4e8a6c4001899b13129c8 (patch) | |
tree | 7b4cc21e99ac8ea7afd2c91ea56db675b750d01b /tools/libxc/xc_misc.c | |
parent | 7a381d270730709ace882969937f53552970c97d (diff) | |
download | xen-e670c28c9f0b284c05e4e8a6c4001899b13129c8.tar.gz xen-e670c28c9f0b284c05e4e8a6c4001899b13129c8.tar.bz2 xen-e670c28c9f0b284c05e4e8a6c4001899b13129c8.zip |
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@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_misc.c')
-rw-r--r-- | tools/libxc/xc_misc.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index 317cfe1c16..662c2982fa 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -370,37 +370,6 @@ int xc_hvm_set_mem_type( } -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__ @@ -445,6 +414,37 @@ xc_map_foreign_bulk(int xc_handle, uint32_t dom, int prot, 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 |