[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] ocaml: Add -Werror to CFLAGS and fix resulting errors.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1273220039 -3600 # Node ID 692f5c949d570e3f66d6c8a3cfdc5f573559738c # Parent 269d1e73facc7f375bfae25812603f7de6107961 ocaml: Add -Werror to CFLAGS and fix resulting errors. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- tools/ocaml/common.make | 2 - tools/ocaml/libs/log/syslog_stubs.c | 2 + tools/ocaml/libs/xc/xc.h | 3 +- tools/ocaml/libs/xc/xc_lib.c | 45 ++++++++++++++++++++++++++++++++---- tools/ocaml/libs/xc/xc_stubs.c | 10 ++++---- 5 files changed, 50 insertions(+), 12 deletions(-) diff -r 269d1e73facc -r 692f5c949d57 tools/ocaml/common.make --- a/tools/ocaml/common.make Fri May 07 08:55:12 2010 +0100 +++ b/tools/ocaml/common.make Fri May 07 09:13:59 2010 +0100 @@ -6,7 +6,7 @@ OCAMLLEX ?= ocamllex OCAMLLEX ?= ocamllex OCAMLYACC ?= ocamlyacc -CFLAGS ?= -Wall -fPIC -O2 +CFLAGS ?= -Wall -fPIC -O2 -Werror CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc CFLAGS += -I/usr/lib64/ocaml -I/usr/lib/ocaml diff -r 269d1e73facc -r 692f5c949d57 tools/ocaml/libs/log/syslog_stubs.c --- a/tools/ocaml/libs/log/syslog_stubs.c Fri May 07 08:55:12 2010 +0100 +++ b/tools/ocaml/libs/log/syslog_stubs.c Fri May 07 09:13:59 2010 +0100 @@ -25,9 +25,11 @@ static int __syslog_level_table[] = { LOG_NOTICE, LOG_INFO, LOG_DEBUG }; +/* static int __syslog_options_table[] = { LOG_CONS, LOG_NDELAY, LOG_NOWAIT, LOG_ODELAY, LOG_PERROR, LOG_PID }; +*/ static int __syslog_facility_table[] = { LOG_AUTH, LOG_AUTHPRIV, LOG_CRON, LOG_DAEMON, LOG_FTP, LOG_KERN, diff -r 269d1e73facc -r 692f5c949d57 tools/ocaml/libs/xc/xc.h --- a/tools/ocaml/libs/xc/xc.h Fri May 07 08:55:12 2010 +0100 +++ b/tools/ocaml/libs/xc/xc.h Fri May 07 09:13:59 2010 +0100 @@ -130,7 +130,8 @@ int xc_readconsolering(int handle, char unsigned int *pnr_chars, int clear); int xc_send_debug_keys(int handle, char *keys); int xc_physinfo(int handle, xc_physinfo_t *put_info); -int xc_pcpu_info(int handle, int max_cpus, uint64_t *info, int *nr_cpus); +int xc_pcpu_info( + int handle, int max_cpus, xen_sysctl_cpuinfo_t *info, int *nr_cpus); int xc_sched_id(int handle, int *sched_id); int xc_version(int handle, int cmd, void *arg); int xc_evtchn_alloc_unbound(int handle, unsigned int domid, diff -r 269d1e73facc -r 692f5c949d57 tools/ocaml/libs/xc/xc_lib.c --- a/tools/ocaml/libs/xc/xc_lib.c Fri May 07 08:55:12 2010 +0100 +++ b/tools/ocaml/libs/xc/xc_lib.c Fri May 07 09:13:59 2010 +0100 @@ -478,15 +478,47 @@ int xc_domain_shutdown(int handle, int d return ret; } +static void bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, int nbits) +{ + uint64_t l; + int i, j, b; + + for (i = 0, b = 0; nbits > 0; i++, b += sizeof(l)) { + l = lp[i]; + for (j = 0; (j < sizeof(l)) && (nbits > 0); j++) { + bp[b+j] = l; + l >>= 8; + nbits -= 8; + } + } +} + +static void bitmap_byte_to_64(uint64_t *lp, const uint8_t *bp, int nbits) +{ + uint64_t l; + int i, j, b; + + for (i = 0, b = 0; nbits > 0; i++, b += sizeof(l)) { + l = 0; + for (j = 0; (j < sizeof(l)) && (nbits > 0); j++) { + l |= (uint64_t)bp[b+j] << (j*8); + nbits -= 8; + } + lp[i] = l; + } +} + int xc_vcpu_setaffinity(int handle, unsigned int domid, int vcpu, uint64_t cpumap) { int ret; + uint8_t local[sizeof(cpumap)]; DECLARE_DOMCTL(XEN_DOMCTL_setvcpuaffinity, domid); domctl.u.vcpuaffinity.vcpu = vcpu; domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8; - set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, (uint8_t *) &cpumap); + bitmap_64_to_byte(local, &cpumap, sizeof(cpumap)*8); + set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local); if (mlock(&cpumap, sizeof(cpumap)) != 0) { xc_error_set("mlock failed: %s", strerror(errno)); @@ -505,11 +537,12 @@ int xc_vcpu_getaffinity(int handle, unsi uint64_t *cpumap) { int ret; + uint8_t local[sizeof(*cpumap)]; DECLARE_DOMCTL(XEN_DOMCTL_getvcpuaffinity, domid); domctl.u.vcpuaffinity.vcpu = vcpu; domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8; - set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, cpumap); + set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local); if (mlock(cpumap, sizeof(*cpumap)) != 0) { xc_error_set("mlock failed: %s", strerror(errno)); @@ -521,6 +554,7 @@ int xc_vcpu_getaffinity(int handle, unsi if (ret < 0) xc_error_dom_set(domid, "vcpu %d get affinity", vcpu); munlock(cpumap, sizeof(*cpumap)); + bitmap_byte_to_64(cpumap, local, sizeof(*cpumap) * 8); return ret; } @@ -812,7 +846,7 @@ int xc_vcpu_getcontext(int handle, unsig int ret; DECLARE_DOMCTL(XEN_DOMCTL_getvcpucontext, domid); domctl.u.vcpucontext.vcpu = vcpu; - set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt); + set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt->c); if (mlock(ctxt, sizeof(*ctxt)) != 0) { xc_error_set("mlock failed: %s", strerror(errno)); @@ -832,7 +866,7 @@ int xc_vcpu_setcontext(int handle, unsig int ret; DECLARE_DOMCTL(XEN_DOMCTL_setvcpucontext, domid); domctl.u.vcpucontext.vcpu = vcpu; - set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt); + set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt->c); if (mlock(ctxt, sizeof(*ctxt)) != 0) { xc_error_set("mlock failed: %s", strerror(errno)); @@ -1007,7 +1041,8 @@ int xc_physinfo(int handle, xc_physinfo_ return 0; } -int xc_pcpu_info(int handle, int max_cpus, uint64_t *info, int *nr_cpus) +int xc_pcpu_info( + int handle, int max_cpus, xen_sysctl_cpuinfo_t *info, int *nr_cpus) { DECLARE_SYSCTL(XEN_SYSCTL_getcpuinfo); int ret; diff -r 269d1e73facc -r 692f5c949d57 tools/ocaml/libs/xc/xc_stubs.c --- a/tools/ocaml/libs/xc/xc_stubs.c Fri May 07 08:55:12 2010 +0100 +++ b/tools/ocaml/libs/xc/xc_stubs.c Fri May 07 09:13:59 2010 +0100 @@ -395,12 +395,12 @@ CAMLprim value stub_xc_vcpu_context_get( CAMLparam3(xc_handle, domid, cpu); CAMLlocal1(context); int ret; - struct vcpu_guest_context ctxt; + vcpu_guest_context_any_t ctxt; ret = xc_vcpu_getcontext(_H(xc_handle), _D(domid), Int_val(cpu), &ctxt); context = caml_alloc_string(sizeof(ctxt)); - memcpy(String_val(context), (char *) &ctxt, sizeof(ctxt)); + memcpy(String_val(context), (char *) &ctxt.c, sizeof(ctxt.c)); CAMLreturn(context); } @@ -552,13 +552,13 @@ CAMLprim value stub_xc_pcpu_info(value x { CAMLparam2(xc_handle, nr_cpus); CAMLlocal2(pcpus, v); - uint64_t *info; + xen_sysctl_cpuinfo_t *info; int r, size; if (Int_val(nr_cpus) < 1) caml_invalid_argument("nr_cpus"); - info = calloc(Int_val(nr_cpus) + 1, sizeof(uint64_t)); + info = calloc(Int_val(nr_cpus) + 1, sizeof(*info)); if (!info) caml_raise_out_of_memory(); @@ -575,7 +575,7 @@ CAMLprim value stub_xc_pcpu_info(value x int i; pcpus = caml_alloc(size, 0); for (i = 0; i < size; i++) { - v = caml_copy_int64(info[i]); + v = caml_copy_int64(info[i].idletime); caml_modify(&Field(pcpus, i), v); } } else _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |