[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] ocaml: NetBSD support and general CFLAGS cleanup



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273255735 -3600
# Node ID 56d52312c5cd1c885eb1156ca39f8447d3d167dd
# Parent  0f6c6c0123dad011bf6b5b391fad75cc41e4ec46
ocaml: NetBSD support and general CFLAGS cleanup

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 Config.mk                                  |    4 ---
 tools/ocaml/common.make                    |    8 ++++---
 tools/ocaml/libs/eventchn/Makefile         |    1 
 tools/ocaml/libs/eventchn/eventchn_stubs.c |   10 ---------
 tools/ocaml/libs/log/Makefile              |    1 
 tools/ocaml/libs/mmap/Makefile             |    1 
 tools/ocaml/libs/uuid/Makefile             |    1 
 tools/ocaml/libs/xb/Makefile               |    1 
 tools/ocaml/libs/xb/xb_stubs.c             |    3 --
 tools/ocaml/libs/xb/xs_ring_stubs.c        |    3 --
 tools/ocaml/libs/xc/Makefile               |    1 
 tools/ocaml/libs/xc/xc.h                   |    6 -----
 tools/ocaml/libs/xc/xc_lib.c               |    8 +++----
 tools/ocaml/libs/xc/xc_stubs.c             |   31 ++++++++++++++++-------------
 tools/ocaml/libs/xs/Makefile               |    1 
 tools/ocaml/xenstored/Makefile             |    1 
 16 files changed, 35 insertions(+), 46 deletions(-)

diff -r 0f6c6c0123da -r 56d52312c5cd Config.mk
--- a/Config.mk Fri May 07 18:57:30 2010 +0100
+++ b/Config.mk Fri May 07 19:08:55 2010 +0100
@@ -168,11 +168,7 @@ CONFIG_LOMOUNT     ?= n
 CONFIG_LOMOUNT     ?= n
 
 ifeq ($(OCAML_TOOLS),y)
-ifeq ($(CONFIG_Linux),y)
 OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
-else
-OCAML_TOOLS := n
-endif
 endif
 
 -include $(XEN_ROOT)/.config
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/common.make
--- a/tools/ocaml/common.make   Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/common.make   Fri May 07 19:08:55 2010 +0100
@@ -1,3 +1,5 @@ CC ?= gcc
+include $(XEN_ROOT)/tools/Rules.mk
+
 CC ?= gcc
 OCAMLOPT ?= ocamlopt
 OCAMLC ?= ocamlc
@@ -6,10 +8,10 @@ OCAMLLEX ?= ocamllex
 OCAMLLEX ?= ocamllex
 OCAMLYACC ?= ocamlyacc
 
-CFLAGS ?= -Wall -fPIC -O2 -Werror
-
+CFLAGS += -fPIC -Werror
 CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc
-CFLAGS += -I/usr/lib64/ocaml -I/usr/lib/ocaml
+CFLAGS-$(CONFIG_Linux) += -I/usr/lib64/ocaml -I/usr/lib/ocaml
+CFLAGS-$(CONFIG_NetBSD) += -I/usr/pkg/lib/ocaml -fPIC
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) 
-cc $(CC) -w F -warn-error F
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/eventchn/Makefile
--- a/tools/ocaml/libs/eventchn/Makefile        Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/eventchn/Makefile        Fri May 07 19:08:55 2010 +0100
@@ -1,4 +1,5 @@ TOPLEVEL=../..
 TOPLEVEL=../..
+XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
 OBJS = eventchn
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/eventchn/eventchn_stubs.c
--- a/tools/ocaml/libs/eventchn/eventchn_stubs.c        Fri May 07 18:57:30 
2010 +0100
+++ b/tools/ocaml/libs/eventchn/eventchn_stubs.c        Fri May 07 19:08:55 
2010 +0100
@@ -20,20 +20,10 @@
 #include <unistd.h>
 #include <errno.h>
 #include <stdint.h>
-
 #include <sys/ioctl.h>
-
-#define __XEN_TOOLS__
-
 #include <xen/sysctl.h>
-
-#if XEN_SYSCTL_INTERFACE_VERSION < 4
-#include <xen/linux/evtchn.h>
-#else
 #include <xen/xen.h>
 #include <xen/sys/evtchn.h>
-#endif
-
 #include <xenctrl.h>
 
 #define CAML_NAME_SPACE
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/log/Makefile
--- a/tools/ocaml/libs/log/Makefile     Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/log/Makefile     Fri May 07 19:08:55 2010 +0100
@@ -1,4 +1,5 @@ TOPLEVEL=../..
 TOPLEVEL=../..
+XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
 OBJS = syslog log logs
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/mmap/Makefile
--- a/tools/ocaml/libs/mmap/Makefile    Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/mmap/Makefile    Fri May 07 19:08:55 2010 +0100
@@ -1,4 +1,5 @@ TOPLEVEL=../..
 TOPLEVEL=../..
+XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
 OBJS = mmap
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/uuid/Makefile
--- a/tools/ocaml/libs/uuid/Makefile    Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/uuid/Makefile    Fri May 07 19:08:55 2010 +0100
@@ -1,4 +1,5 @@ TOPLEVEL=../..
 TOPLEVEL=../..
+XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
 OBJS = uuid
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xb/Makefile
--- a/tools/ocaml/libs/xb/Makefile      Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xb/Makefile      Fri May 07 19:08:55 2010 +0100
@@ -1,4 +1,5 @@ TOPLEVEL=../..
 TOPLEVEL=../..
+XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
 CFLAGS += -I../mmap
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xb/xb_stubs.c
--- a/tools/ocaml/libs/xb/xb_stubs.c    Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xb/xb_stubs.c    Fri May 07 19:08:55 2010 +0100
@@ -27,10 +27,7 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
-#define __XEN_TOOLS__
-
 #include <xenctrl.h>
-#define u32 uint32_t
 #include <xen/io/xs_wire.h>
 
 CAMLprim value stub_header_size(void)
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xb/xs_ring_stubs.c
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c       Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c       Fri May 07 19:08:55 2010 +0100
@@ -21,10 +21,7 @@
 #include <errno.h>
 #include <string.h>
 
-#define __XEN_TOOLS__
-
 #include <xenctrl.h>
-#define u32 uint32_t
 #include <xen/io/xs_wire.h>
 
 #include <caml/mlvalues.h>
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xc/Makefile
--- a/tools/ocaml/libs/xc/Makefile      Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xc/Makefile      Fri May 07 19:08:55 2010 +0100
@@ -1,4 +1,5 @@ TOPLEVEL=../..
 TOPLEVEL=../..
+XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
 CFLAGS += -I../mmap -I./
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xc/xc.h
--- a/tools/ocaml/libs/xc/xc.h  Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xc/xc.h  Fri May 07 19:08:55 2010 +0100
@@ -14,19 +14,13 @@
  * GNU Lesser General Public License for more details.
  */
 
-#define __XEN_TOOLS__
-
 #include <xen/xen.h>
 #include <xen/memory.h>
 #include <xen/sysctl.h>
 #include <xen/domctl.h>
 #include <xen/sched.h>
 #include <xen/sysctl.h>
-#if XEN_SYSCTL_INTERFACE_VERSION < 4
-#include <xen/linux/privcmd.h>
-#else
 #include <xen/sys/privcmd.h>
-#endif
 #include <xen/version.h>
 #include <xen/foreign/x86_32.h>
 #include <xen/foreign/x86_64.h>
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xc/xc_lib.c
--- a/tools/ocaml/libs/xc/xc_lib.c      Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xc/xc_lib.c      Fri May 07 19:08:55 2010 +0100
@@ -631,9 +631,9 @@ int xc_domain_getinfo(int handle, unsign
 
 int xc_domain_setmaxmem(int handle, unsigned int domid, unsigned int max_memkb)
 {
+       int ret;
        DECLARE_DOMCTL(XEN_DOMCTL_max_mem, domid);
        domctl.u.max_mem.max_memkb = max_memkb;
-       int ret;
 
        ret = do_domctl(handle, &domctl);
        if (ret < 0)
@@ -682,9 +682,9 @@ int xc_domain_set_memmap_limit(int handl
 
 int xc_domain_set_time_offset(int handle, unsigned int domid, int time_offset)
 {
+       int ret;
        DECLARE_DOMCTL(XEN_DOMCTL_settimeoffset, domid);
        domctl.u.settimeoffset.time_offset_seconds = time_offset;
-       int ret;
 
        ret = do_domctl(handle, &domctl);
        if (ret < 0)
@@ -884,10 +884,10 @@ int xc_domain_irq_permission(int handle,
 int xc_domain_irq_permission(int handle, unsigned int domid,
                              unsigned char pirq, unsigned char allow_access)
 {
+       int ret;
        DECLARE_DOMCTL(XEN_DOMCTL_irq_permission, domid);
        domctl.u.irq_permission.pirq = pirq;
        domctl.u.irq_permission.allow_access = allow_access;
-       int ret;
 
        ret = do_domctl(handle, &domctl);
        if (ret)
@@ -900,11 +900,11 @@ int xc_domain_iomem_permission(int handl
                                unsigned long first_mfn, unsigned long nr_mfns,
                                unsigned char allow_access)
 {
+       int ret;
        DECLARE_DOMCTL(XEN_DOMCTL_iomem_permission, domid);
        domctl.u.iomem_permission.first_mfn = first_mfn;
        domctl.u.iomem_permission.nr_mfns = nr_mfns;
        domctl.u.iomem_permission.allow_access = allow_access;
-       int ret;
 
        ret = do_domctl(handle, &domctl);
        if (ret)
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xc/xc_stubs.c
--- a/tools/ocaml/libs/xc/xc_stubs.c    Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xc/xc_stubs.c    Fri May 07 19:08:55 2010 +0100
@@ -99,7 +99,7 @@ CAMLprim value stub_marshall_core_header
        CAMLreturn(s);
 }
 
-CAMLprim value stub_xc_interface_open()
+CAMLprim value stub_xc_interface_open(void)
 {
         int handle;
         handle = xc_interface_open();
@@ -109,12 +109,12 @@ CAMLprim value stub_xc_interface_open()
 }
 
 
-CAMLprim value stub_xc_interface_open_fake()
+CAMLprim value stub_xc_interface_open_fake(void)
 {
        return Val_int(-1);
 }
 
-CAMLprim value stub_xc_using_injection()
+CAMLprim value stub_xc_using_injection(void)
 {
        if (xc_using_injection ()){
                return Val_int(1);
@@ -312,7 +312,9 @@ CAMLprim value stub_xc_domain_getinfolis
        CAMLparam3(xc_handle, first_domain, nb);
        CAMLlocal2(result, temp);
        xc_domaininfo_t * info;
-       int i, ret, toalloc;
+       int i, ret, toalloc, c_xc_handle, retval;
+       unsigned int c_max_domains;
+       uint32_t c_first_domain;
 
        /* get the minimum number of allocate byte we need and bump it up to 
page boundary */
        toalloc = (sizeof(xc_domaininfo_t) * Int_val(nb)) | 0xfff;
@@ -322,12 +324,12 @@ CAMLprim value stub_xc_domain_getinfolis
 
        result = temp = Val_emptylist;
 
-       int c_xc_handle = _H(xc_handle);
-       uint32_t c_first_domain = _D(first_domain);
-       unsigned int c_max_domains = Int_val(nb);
-       // caml_enter_blocking_section();
-       int retval = xc_domain_getinfolist(c_xc_handle, c_first_domain,
-                                          c_max_domains, info);
+       c_xc_handle = _H(xc_handle);
+       c_first_domain = _D(first_domain);
+       c_max_domains = Int_val(nb);
+       // caml_enter_blocking_section();
+       retval = xc_domain_getinfolist(c_xc_handle, c_first_domain,
+                                      c_max_domains, info);
        // caml_leave_blocking_section();
 
        if (retval < 0) {
@@ -849,15 +851,18 @@ CAMLprim value stub_map_foreign_range(va
        CAMLparam4(xc_handle, dom, size, mfn);
        CAMLlocal1(result);
        struct mmap_interface *intf;
+       int c_xc_handle;
+       uint32_t c_dom;
+       unsigned long c_mfn;
 
        result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
        intf = (struct mmap_interface *) result;
 
        intf->len = Int_val(size);
 
-       int c_xc_handle = _H(xc_handle);
-       uint32_t c_dom = _D(dom);
-       unsigned long c_mfn = Nativeint_val(mfn);
+       c_xc_handle = _H(xc_handle);
+       c_dom = _D(dom);
+       c_mfn = Nativeint_val(mfn);
        // caml_enter_blocking_section();
        intf->addr = xc_map_foreign_range(c_xc_handle, c_dom,
                                          intf->len, PROT_READ|PROT_WRITE,
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/libs/xs/Makefile
--- a/tools/ocaml/libs/xs/Makefile      Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/libs/xs/Makefile      Fri May 07 19:08:55 2010 +0100
@@ -1,4 +1,5 @@ TOPLEVEL=../..
 TOPLEVEL=../..
+XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
 OCAMLINCLUDE += -I ../xb/
diff -r 0f6c6c0123da -r 56d52312c5cd tools/ocaml/xenstored/Makefile
--- a/tools/ocaml/xenstored/Makefile    Fri May 07 18:57:30 2010 +0100
+++ b/tools/ocaml/xenstored/Makefile    Fri May 07 19:08:55 2010 +0100
@@ -1,3 +1,4 @@ OCAML_TOPLEVEL = ..
+XEN_ROOT = ../../..
 OCAML_TOPLEVEL = ..
 include $(OCAML_TOPLEVEL)/common.make
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.