Skip to contentSkip to conversation

merge ocaml xenstored and dependencies

RFC PATCH Superseded Vincent Hanquez 1 participant 11 messages Mar 9, 2010

lore
Share & tools
lore
#0 lore raw

v2 cover merge ocaml xenstored and dependencies

Add ocaml xenstored into xen as an alternative to C xenstored.
The goal is to choose it as the default xenstored on the target machine when it has been built.

build hook mechanism is not ideal, but should be safe for platform that cannot build ocaml and/or would have some portability issues.

This is RFC, although the first 5 patches are completly safe since they just introduce new files and hook with default =n the new files. only the 6th patch make the default to build ocaml tools with fallback if not available.

since v1:
* rebased to latest xen-unstable
* remove stdext ocaml library and folded dependencies into xenstored
* split dependencies in smaller patches

Vincent Hanquez (10):
add ocaml mmap bindings implementation. add ocaml XC bindings.
add XS ocaml bindings.
add uuid ocaml bindings
add logs ocaml bindings
add ocaml xenstored
add compilation makefile to ocaml directory remove hook from external ocaml repository add ocaml tools to build if defined. default to n default ocaml tools config variable to y

 Config.mk                                  |   15 +-
 tools/Makefile                             |   23 +-
 tools/ocaml/Makefile                       |   36 +
 tools/ocaml/Makefile.rules                 |   93 ++
 tools/ocaml/common.make                    |   28 +
 tools/ocaml/libs/eventchn/META.in          |    4 +
 tools/ocaml/libs/eventchn/Makefile         |   28 +
 tools/ocaml/libs/eventchn/eventchn.ml      |   27 +
 tools/ocaml/libs/eventchn/eventchn.mli     |   26 +
 tools/ocaml/libs/eventchn/eventchn_stubs.c |  173 ++++
 tools/ocaml/libs/log/META.in               |    4 +
 tools/ocaml/libs/log/Makefile              |   41 +
 tools/ocaml/libs/log/log.ml                |  258 +++++
 tools/ocaml/libs/log/log.mli               |   55 +
 tools/ocaml/libs/log/logs.ml               |  197 ++++
 tools/ocaml/libs/log/logs.mli              |   46 +
 tools/ocaml/libs/log/syslog.ml             |   26 +
 tools/ocaml/libs/log/syslog.mli            |   41 +
 tools/ocaml/libs/log/syslog_stubs.c        |   73 ++
 tools/ocaml/libs/mmap/META.in              |    4 +
 tools/ocaml/libs/mmap/Makefile             |   27 +
 tools/ocaml/libs/mmap/mmap.ml              |   31 +
 tools/ocaml/libs/mmap/mmap.mli             |   28 +
 tools/ocaml/libs/mmap/mmap_stubs.c         |  136 +++
 tools/ocaml/libs/mmap/mmap_stubs.h         |   33 +
 tools/ocaml/libs/uuid/META.in              |    4 +
 tools/ocaml/libs/uuid/Makefile             |   26 +
 tools/ocaml/libs/uuid/uuid.ml              |   88 ++
 tools/ocaml/libs/uuid/uuid.mli             |   53 +
 tools/ocaml/libs/xb/META.in                |    4 +
 tools/ocaml/libs/xb/Makefile               |   41 +
 tools/ocaml/libs/xb/op.ml                  |   84 ++
 tools/ocaml/libs/xb/packet.ml              |   50 +
 tools/ocaml/libs/xb/partial.ml             |   44 +
 tools/ocaml/libs/xb/xb.ml                  |  189 ++++
 tools/ocaml/libs/xb/xb.mli                 |   83 ++
 tools/ocaml/libs/xb/xb_stubs.c             |   74 ++
 tools/ocaml/libs/xb/xs_ring.ml             |   18 +
 tools/ocaml/libs/xb/xs_ring_stubs.c        |  117 +++
 tools/ocaml/libs/xc/META.in                |    4 +
 tools/ocaml/libs/xc/Makefile               |   28 +
 tools/ocaml/libs/xc/xc.h                   |  191 ++++
 tools/ocaml/libs/xc/xc.ml                  |  340 +++++++
 tools/ocaml/libs/xc/xc.mli                 |  196 ++++
 tools/ocaml/libs/xc/xc_cpufeature.h        |  116 +++
 tools/ocaml/libs/xc/xc_cpuid.h             |  285 ++++++
 tools/ocaml/libs/xc/xc_e820.h              |   20 +
 tools/ocaml/libs/xc/xc_lib.c               | 1502 ++++++++++++++++++++++++++++
 tools/ocaml/libs/xc/xc_stubs.c             | 1170 ++++++++++++++++++++++
 tools/ocaml/libs/xs/META.in                |    4 +
 tools/ocaml/libs/xs/Makefile               |   42 +
 tools/ocaml/libs/xs/queueop.ml             |   73 ++
 tools/ocaml/libs/xs/xs.ml                  |  170 ++++
 tools/ocaml/libs/xs/xs.mli                 |   90 ++
 tools/ocaml/libs/xs/xsraw.ml               |  265 +++++
 tools/ocaml/libs/xs/xsraw.mli              |   60 ++
 tools/ocaml/libs/xs/xst.ml                 |   61 ++
 tools/ocaml/libs/xs/xst.mli                |   30 +
 tools/ocaml/xenstored/Makefile             |   54 +
 tools/ocaml/xenstored/config.ml            |  112 ++
 tools/ocaml/xenstored/connection.ml        |  234 +++++
 tools/ocaml/xenstored/connections.ml       |  167 +++
 tools/ocaml/xenstored/define.ml            |   40 +
 tools/ocaml/xenstored/disk.ml              |  157 +++
 tools/ocaml/xenstored/domain.ml            |   62 ++
 tools/ocaml/xenstored/domains.ml           |   84 ++
 tools/ocaml/xenstored/event.ml             |   29 +
 tools/ocaml/xenstored/logging.ml           |  239 +++++
 tools/ocaml/xenstored/parse_arg.ml         |   68 ++
 tools/ocaml/xenstored/perms.ml             |  167 +++
 tools/ocaml/xenstored/process.ml           |  396 ++++++++
 tools/ocaml/xenstored/quota.ml             |   83 ++
 tools/ocaml/xenstored/store.ml             |  461 +++++++++
 tools/ocaml/xenstored/symbol.ml            |   76 ++
 tools/ocaml/xenstored/symbol.mli           |   52 +
 tools/ocaml/xenstored/transaction.ml       |  198 ++++
 tools/ocaml/xenstored/utils.ml             |  107 ++
 tools/ocaml/xenstored/xenstored.conf       |   30 +
 tools/ocaml/xenstored/xenstored.ml         |  404 ++++++++
 tools/xenstore/Makefile                    |    5 -
 80 files changed, 10168 insertions(+), 32 deletions(-)
 create mode 100644 tools/ocaml/Makefile
 create mode 100644 tools/ocaml/Makefile.rules
 create mode 100644 tools/ocaml/common.make
 create mode 100644 tools/ocaml/libs/eventchn/META.in
 create mode 100644 tools/ocaml/libs/eventchn/Makefile
 create mode 100644 tools/ocaml/libs/eventchn/eventchn.ml
 create mode 100644 tools/ocaml/libs/eventchn/eventchn.mli
 create mode 100644 tools/ocaml/libs/eventchn/eventchn_stubs.c
 create mode 100644 tools/ocaml/libs/log/META.in
 create mode 100644 tools/ocaml/libs/log/Makefile
 create mode 100644 tools/ocaml/libs/log/log.ml
 create mode 100644 tools/ocaml/libs/log/log.mli
 create mode 100644 tools/ocaml/libs/log/logs.ml
 create mode 100644 tools/ocaml/libs/log/logs.mli
 create mode 100644 tools/ocaml/libs/log/syslog.ml
 create mode 100644 tools/ocaml/libs/log/syslog.mli
 create mode 100644 tools/ocaml/libs/log/syslog_stubs.c
 create mode 100644 tools/ocaml/libs/mmap/META.in
 create mode 100644 tools/ocaml/libs/mmap/Makefile
 create mode 100644 tools/ocaml/libs/mmap/mmap.ml
 create mode 100644 tools/ocaml/libs/mmap/mmap.mli
 create mode 100644 tools/ocaml/libs/mmap/mmap_stubs.c
 create mode 100644 tools/ocaml/libs/mmap/mmap_stubs.h
 create mode 100644 tools/ocaml/libs/uuid/META.in
 create mode 100644 tools/ocaml/libs/uuid/Makefile
 create mode 100644 tools/ocaml/libs/uuid/uuid.ml
 create mode 100644 tools/ocaml/libs/uuid/uuid.mli
 create mode 100644 tools/ocaml/libs/xb/META.in
 create mode 100644 tools/ocaml/libs/xb/Makefile
 create mode 100644 tools/ocaml/libs/xb/op.ml
 create mode 100644 tools/ocaml/libs/xb/packet.ml
 create mode 100644 tools/ocaml/libs/xb/partial.ml
 create mode 100644 tools/ocaml/libs/xb/xb.ml
 create mode 100644 tools/ocaml/libs/xb/xb.mli
 create mode 100644 tools/ocaml/libs/xb/xb_stubs.c
 create mode 100644 tools/ocaml/libs/xb/xs_ring.ml
 create mode 100644 tools/ocaml/libs/xb/xs_ring_stubs.c
 create mode 100644 tools/ocaml/libs/xc/META.in
 create mode 100644 tools/ocaml/libs/xc/Makefile
 create mode 100644 tools/ocaml/libs/xc/xc.h
 create mode 100644 tools/ocaml/libs/xc/xc.ml
 create mode 100644 tools/ocaml/libs/xc/xc.mli
 create mode 100644 tools/ocaml/libs/xc/xc_cpufeature.h
 create mode 100644 tools/ocaml/libs/xc/xc_cpuid.h
 create mode 100644 tools/ocaml/libs/xc/xc_e820.h
 create mode 100644 tools/ocaml/libs/xc/xc_lib.c
 create mode 100644 tools/ocaml/libs/xc/xc_stubs.c
 create mode 100644 tools/ocaml/libs/xs/META.in
 create mode 100644 tools/ocaml/libs/xs/Makefile
 create mode 100644 tools/ocaml/libs/xs/queueop.ml
 create mode 100644 tools/ocaml/libs/xs/xs.ml
 create mode 100644 tools/ocaml/libs/xs/xs.mli
 create mode 100644 tools/ocaml/libs/xs/xsraw.ml
 create mode 100644 tools/ocaml/libs/xs/xsraw.mli
 create mode 100644 tools/ocaml/libs/xs/xst.ml
 create mode 100644 tools/ocaml/libs/xs/xst.mli
 create mode 100644 tools/ocaml/xenstored/Makefile
 create mode 100644 tools/ocaml/xenstored/config.ml
 create mode 100644 tools/ocaml/xenstored/connection.ml
 create mode 100644 tools/ocaml/xenstored/connections.ml
 create mode 100644 tools/ocaml/xenstored/define.ml
 create mode 100644 tools/ocaml/xenstored/disk.ml
 create mode 100644 tools/ocaml/xenstored/domain.ml
 create mode 100644 tools/ocaml/xenstored/domains.ml
 create mode 100644 tools/ocaml/xenstored/event.ml
 create mode 100644 tools/ocaml/xenstored/logging.ml
 create mode 100644 tools/ocaml/xenstored/parse_arg.ml
 create mode 100644 tools/ocaml/xenstored/perms.ml
 create mode 100644 tools/ocaml/xenstored/process.ml
 create mode 100644 tools/ocaml/xenstored/quota.ml
 create mode 100644 tools/ocaml/xenstored/store.ml
 create mode 100644 tools/ocaml/xenstored/symbol.ml
 create mode 100644 tools/ocaml/xenstored/symbol.mli
 create mode 100644 tools/ocaml/xenstored/transaction.ml
 create mode 100644 tools/ocaml/xenstored/utils.ml
 create mode 100644 tools/ocaml/xenstored/xenstored.conf
 create mode 100644 tools/ocaml/xenstored/xenstored.ml

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

PATCH v2 1/10 add ocaml mmap bindings implementation.

this is quite similar to the mmap functionality available in bigarray but it's less complicated.

---
 tools/ocaml/libs/mmap/META.in      |    4 +
 tools/ocaml/libs/mmap/Makefile     |   27 +++++++
 tools/ocaml/libs/mmap/mmap.ml      |   31 ++++++++
 tools/ocaml/libs/mmap/mmap.mli     |   28 ++++++++
 tools/ocaml/libs/mmap/mmap_stubs.c |  136 ++++++++++++++++++++++++++++++++++++
 tools/ocaml/libs/mmap/mmap_stubs.h |   33 +++++++++
 6 files changed, 259 insertions(+), 0 deletions(-)
 create mode 100644 tools/ocaml/libs/mmap/META.in
 create mode 100644 tools/ocaml/libs/mmap/Makefile
 create mode 100644 tools/ocaml/libs/mmap/mmap.ml
 create mode 100644 tools/ocaml/libs/mmap/mmap.mli
 create mode 100644 tools/ocaml/libs/mmap/mmap_stubs.c
 create mode 100644 tools/ocaml/libs/mmap/mmap_stubs.h
tools/ocaml/libs/mmap/META.in new file +4 -0
new file mode 100644
index 0000000..1d71548
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "Mmap interface extension"
+archive(byte) = "mmap.cma"
+archive(native) = "mmap.cmxa"
tools/ocaml/libs/mmap/Makefile new file +27 -0
new file mode 100644
index 0000000..bd8ab43
@@ -0,0 +1,27 @@
+TOPLEVEL=../..
+include $(TOPLEVEL)/common.make
+
+OBJS = mmap
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = mmap.cma mmap.cmxa
+
+all: $(INTF) $(LIBS) $(PROGRAMS)
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+mmap_OBJS = $(OBJS)
+mmap_C_OBJS = mmap_stubs
+OCAML_LIBRARY = mmap
+
+.PHONY: install
+install: $(LIBS) META
+	ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore mmap META $(INTF) $(LIBS) *.a *.so *.cmx
+
+.PHONY: uninstall
+uninstall:
+	ocamlfind remove mmap
+
+include $(TOPLEVEL)/Makefile.rules
+
tools/ocaml/libs/mmap/mmap.ml new file +31 -0
new file mode 100644
index 0000000..44b67c8
@@ -0,0 +1,31 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+type mmap_interface
+
+type mmap_prot_flag = RDONLY | WRONLY | RDWR
+type mmap_map_flag = SHARED | PRIVATE
+
+(* mmap: fd -> prot_flag -> map_flag -> length -> offset -> interface *)
+external mmap: Unix.file_descr -> mmap_prot_flag -> mmap_map_flag
+		-> int -> int -> mmap_interface = "stub_mmap_init"
+external unmap: mmap_interface -> unit = "stub_mmap_final"
+(* read: interface -> start -> length -> data *)
+external read: mmap_interface -> int -> int -> string = "stub_mmap_read"
+(* write: interface -> data -> start -> length -> unit *)
+external write: mmap_interface -> string -> int -> int -> unit = "stub_mmap_write"
+(* getpagesize: unit -> size of page *)
+external getpagesize: unit -> int = "stub_mmap_getpagesize"
tools/ocaml/libs/mmap/mmap.mli new file +28 -0
new file mode 100644
index 0000000..8f92ed6
@@ -0,0 +1,28 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+type mmap_interface
+type mmap_prot_flag = RDONLY | WRONLY | RDWR
+type mmap_map_flag = SHARED | PRIVATE
+
+external mmap : Unix.file_descr -> mmap_prot_flag -> mmap_map_flag -> int -> int
+             -> mmap_interface = "stub_mmap_init"
+external unmap : mmap_interface -> unit = "stub_mmap_final"
+external read : mmap_interface -> int -> int -> string = "stub_mmap_read"
+external write : mmap_interface -> string -> int -> int -> unit
+               = "stub_mmap_write"
+
+external getpagesize : unit -> int = "stub_mmap_getpagesize"
tools/ocaml/libs/mmap/mmap_stubs.c new file +136 -0

136 lines not on this page · raw message

tools/ocaml/libs/mmap/mmap_stubs.h new file +33 -0
new file mode 100644
index 0000000..65e4239
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#ifndef C_MMAP_H
+#define C_MMAP_H
+
+#include <caml/mlvalues.h>
+#include <caml/memory.h>
+#include <caml/alloc.h>
+#include <caml/custom.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+
+struct mmap_interface
+{
+	void *addr;
+	int len;
+};
+
+#endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

PATCH v2 2/10 add ocaml XC bindings.

In reply to Vincent Hanquez

this include a small and simpler reimplementation of libxc.

---
 tools/ocaml/libs/xc/META.in         |    4 +
 tools/ocaml/libs/xc/Makefile        |   28 +
 tools/ocaml/libs/xc/xc.h            |  191 +++++
 tools/ocaml/libs/xc/xc.ml           |  340 ++++++++
 tools/ocaml/libs/xc/xc.mli          |  196 +++++
 tools/ocaml/libs/xc/xc_cpufeature.h |  116 +++
 tools/ocaml/libs/xc/xc_cpuid.h      |  285 +++++++
 tools/ocaml/libs/xc/xc_e820.h       |   20 +
 tools/ocaml/libs/xc/xc_lib.c        | 1502 +++++++++++++++++++++++++++++++++++
 tools/ocaml/libs/xc/xc_stubs.c      | 1170 +++++++++++++++++++++++++++
 10 files changed, 3852 insertions(+), 0 deletions(-)
 create mode 100644 tools/ocaml/libs/xc/META.in
 create mode 100644 tools/ocaml/libs/xc/Makefile
 create mode 100644 tools/ocaml/libs/xc/xc.h
 create mode 100644 tools/ocaml/libs/xc/xc.ml
 create mode 100644 tools/ocaml/libs/xc/xc.mli
 create mode 100644 tools/ocaml/libs/xc/xc_cpufeature.h
 create mode 100644 tools/ocaml/libs/xc/xc_cpuid.h
 create mode 100644 tools/ocaml/libs/xc/xc_e820.h
 create mode 100644 tools/ocaml/libs/xc/xc_lib.c
 create mode 100644 tools/ocaml/libs/xc/xc_stubs.c
tools/ocaml/libs/xc/META.in new file +4 -0
new file mode 100644
index 0000000..e46d7dd
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "Xen Control Interface"
+archive(byte) = "xc.cma"
+archive(native) = "xc.cmxa"
tools/ocaml/libs/xc/Makefile new file +28 -0
new file mode 100644
index 0000000..9e361b5
@@ -0,0 +1,28 @@
+TOPLEVEL=../..
+include $(TOPLEVEL)/common.make
+
+CFLAGS += -I../mmap -I./
+OCAMLINCLUDE += -I ../mmap -I ../uuid
+
+OBJS = xc
+INTF = xc.cmi
+LIBS = xc.cma xc.cmxa
+
+xc_OBJS = $(OBJS)
+xc_C_OBJS = xc_lib xc_stubs
+
+OCAML_LIBRARY = xc
+
+all: $(INTF) $(LIBS)
+
+libs: $(LIBS)
+
+.PHONY: install
+install: $(LIBS) META
+	ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore xc META $(INTF) $(LIBS) *.a *.so *.cmx
+
+.PHONY: uninstall
+uninstall:
+	ocamlfind remove xc
+
+include $(TOPLEVEL)/Makefile.rules
tools/ocaml/libs/xc/xc.h new file +191 -0

191 lines not on this page · raw message

tools/ocaml/libs/xc/xc.ml new file +340 -0

340 lines not on this page · raw message

tools/ocaml/libs/xc/xc.mli new file +196 -0

196 lines not on this page · raw message

tools/ocaml/libs/xc/xc_cpufeature.h new file +116 -0

116 lines not on this page · raw message

tools/ocaml/libs/xc/xc_cpuid.h new file +285 -0

285 lines not on this page · raw message

tools/ocaml/libs/xc/xc_e820.h new file +20 -0
new file mode 100644
index 0000000..52bbb0f
@@ -0,0 +1,20 @@
+#ifndef __XC_E820_H__
+#define __XC_E820_H__
+
+#include <xen/hvm/e820.h>
+
+/*
+ * PC BIOS standard E820 types and structure.
+ */
+#define E820_RAM          1
+#define E820_RESERVED     2
+#define E820_ACPI         3
+#define E820_NVS          4
+
+struct e820entry {
+    uint64_t addr;
+    uint64_t size;
+    uint32_t type;
+} __attribute__((packed));
+
+#endif /* __XC_E820_H__ */
tools/ocaml/libs/xc/xc_lib.c new file +1502 -0

1,502 lines not on this page · raw message

tools/ocaml/libs/xc/xc_stubs.c new file +1170 -0

318 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#3 lore raw

PATCH v2 3/10 add XS ocaml bindings.

In reply to Vincent Hanquez
---
 tools/ocaml/libs/eventchn/META.in          |    4 +
 tools/ocaml/libs/eventchn/Makefile         |   28 +++
 tools/ocaml/libs/eventchn/eventchn.ml      |   27 +++
 tools/ocaml/libs/eventchn/eventchn.mli     |   26 +++
 tools/ocaml/libs/eventchn/eventchn_stubs.c |  173 ++++++++++++++++++
 tools/ocaml/libs/xb/META.in                |    4 +
 tools/ocaml/libs/xb/Makefile               |   41 +++++
 tools/ocaml/libs/xb/op.ml                  |   84 +++++++++
 tools/ocaml/libs/xb/packet.ml              |   50 ++++++
 tools/ocaml/libs/xb/partial.ml             |   44 +++++
 tools/ocaml/libs/xb/xb.ml                  |  189 ++++++++++++++++++++
 tools/ocaml/libs/xb/xb.mli                 |   83 +++++++++
 tools/ocaml/libs/xb/xb_stubs.c             |   74 ++++++++
 tools/ocaml/libs/xb/xs_ring.ml             |   18 ++
 tools/ocaml/libs/xb/xs_ring_stubs.c        |  117 ++++++++++++
 tools/ocaml/libs/xs/META.in                |    4 +
 tools/ocaml/libs/xs/Makefile               |   42 +++++
 tools/ocaml/libs/xs/queueop.ml             |   73 ++++++++
 tools/ocaml/libs/xs/xs.ml                  |  170 ++++++++++++++++++
 tools/ocaml/libs/xs/xs.mli                 |   90 ++++++++++
 tools/ocaml/libs/xs/xsraw.ml               |  265 ++++++++++++++++++++++++++++
 tools/ocaml/libs/xs/xsraw.mli              |   60 +++++++
 tools/ocaml/libs/xs/xst.ml                 |   61 +++++++
 tools/ocaml/libs/xs/xst.mli                |   30 +++
 24 files changed, 1757 insertions(+), 0 deletions(-)
 create mode 100644 tools/ocaml/libs/eventchn/META.in
 create mode 100644 tools/ocaml/libs/eventchn/Makefile
 create mode 100644 tools/ocaml/libs/eventchn/eventchn.ml
 create mode 100644 tools/ocaml/libs/eventchn/eventchn.mli
 create mode 100644 tools/ocaml/libs/eventchn/eventchn_stubs.c
 create mode 100644 tools/ocaml/libs/xb/META.in
 create mode 100644 tools/ocaml/libs/xb/Makefile
 create mode 100644 tools/ocaml/libs/xb/op.ml
 create mode 100644 tools/ocaml/libs/xb/packet.ml
 create mode 100644 tools/ocaml/libs/xb/partial.ml
 create mode 100644 tools/ocaml/libs/xb/xb.ml
 create mode 100644 tools/ocaml/libs/xb/xb.mli
 create mode 100644 tools/ocaml/libs/xb/xb_stubs.c
 create mode 100644 tools/ocaml/libs/xb/xs_ring.ml
 create mode 100644 tools/ocaml/libs/xb/xs_ring_stubs.c
 create mode 100644 tools/ocaml/libs/xs/META.in
 create mode 100644 tools/ocaml/libs/xs/Makefile
 create mode 100644 tools/ocaml/libs/xs/queueop.ml
 create mode 100644 tools/ocaml/libs/xs/xs.ml
 create mode 100644 tools/ocaml/libs/xs/xs.mli
 create mode 100644 tools/ocaml/libs/xs/xsraw.ml
 create mode 100644 tools/ocaml/libs/xs/xsraw.mli
 create mode 100644 tools/ocaml/libs/xs/xst.ml
 create mode 100644 tools/ocaml/libs/xs/xst.mli
tools/ocaml/libs/eventchn/META.in new file +4 -0
new file mode 100644
index 0000000..f3e01aa
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "Eventchn interface extension"
+archive(byte) = "eventchn.cma"
+archive(native) = "eventchn.cmxa"
tools/ocaml/libs/eventchn/Makefile new file +28 -0
new file mode 100644
index 0000000..9d6ef31
@@ -0,0 +1,28 @@
+TOPLEVEL=../..
+include $(TOPLEVEL)/common.make
+
+OBJS = eventchn
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = eventchn.cma eventchn.cmxa
+
+all: $(INTF) $(LIBS) $(PROGRAMS)
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+eventchn_OBJS = $(OBJS)
+eventchn_C_OBJS = eventchn_stubs
+
+OCAML_LIBRARY = eventchn
+
+.PHONY: install
+install: $(LIBS) META
+	ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore eventchn META $(INTF) $(LIBS) *.a *.so *.cmx
+
+.PHONY: uninstall
+uninstall:
+	ocamlfind remove eventchn
+
+include $(TOPLEVEL)/Makefile.rules
+
tools/ocaml/libs/eventchn/eventchn.ml new file +27 -0
new file mode 100644
index 0000000..c4a7fa3
@@ -0,0 +1,27 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+exception Error of string
+
+external init: unit -> Unix.file_descr = "stub_eventchn_init"
+external notify: Unix.file_descr -> int -> unit = "stub_eventchn_notify"
+external bind_interdomain: Unix.file_descr -> int -> int -> int = "stub_eventchn_bind_interdomain"
+external bind_virq: Unix.file_descr -> int = "stub_eventchn_bind_virq"
+external unbind: Unix.file_descr -> int -> unit = "stub_eventchn_unbind"
+external read_port: Unix.file_descr -> int = "stub_eventchn_read_port"
+external write_port: Unix.file_descr -> int -> unit = "stub_eventchn_write_port"
+
+let _ = Callback.register_exception "eventchn.error" (Error "register_callback")
tools/ocaml/libs/eventchn/eventchn.mli new file +26 -0
new file mode 100644
index 0000000..7088700
@@ -0,0 +1,26 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+exception Error of string
+external init : unit -> Unix.file_descr = "stub_eventchn_init"
+external notify : Unix.file_descr -> int -> unit = "stub_eventchn_notify"
+external bind_interdomain : Unix.file_descr -> int -> int -> int
+  = "stub_eventchn_bind_interdomain"
+external bind_virq : Unix.file_descr -> int = "stub_eventchn_bind_virq"
+external unbind : Unix.file_descr -> int -> unit = "stub_eventchn_unbind"
+external read_port : Unix.file_descr -> int = "stub_eventchn_read_port"
+external write_port : Unix.file_descr -> int -> unit
+  = "stub_eventchn_write_port"
tools/ocaml/libs/eventchn/eventchn_stubs.c new file +173 -0

173 lines not on this page · raw message

tools/ocaml/libs/xb/META.in new file +4 -0
new file mode 100644
index 0000000..c041010
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "XenBus Interface"
+archive(byte) = "xb.cma"
+archive(native) = "xb.cmxa"
tools/ocaml/libs/xb/Makefile new file +41 -0

41 lines not on this page · raw message

tools/ocaml/libs/xb/op.ml new file +84 -0

84 lines not on this page · raw message

tools/ocaml/libs/xb/packet.ml new file +50 -0

51 lines not on this page · raw message

tools/ocaml/libs/xb/partial.ml new file +44 -0

44 lines not on this page · raw message

tools/ocaml/libs/xb/xb.ml new file +189 -0

189 lines not on this page · raw message

tools/ocaml/libs/xb/xb.mli new file +83 -0

83 lines not on this page · raw message

tools/ocaml/libs/xb/xb_stubs.c new file +74 -0

74 lines not on this page · raw message

tools/ocaml/libs/xb/xs_ring.ml new file +18 -0
new file mode 100644
index 0000000..00c18d5
@@ -0,0 +1,18 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+external read: Mmap.mmap_interface -> string -> int -> int = "ml_interface_read"
+external write: Mmap.mmap_interface -> string -> int -> int = "ml_interface_write"
tools/ocaml/libs/xb/xs_ring_stubs.c new file +117 -0

117 lines not on this page · raw message

tools/ocaml/libs/xs/META.in new file +4 -0
new file mode 100644
index 0000000..77d93b5
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "XenStore Interface"
+archive(byte) = "xs.cma"
+archive(native) = "xs.cmxa"
tools/ocaml/libs/xs/Makefile new file +42 -0

42 lines not on this page · raw message

tools/ocaml/libs/xs/queueop.ml new file +73 -0

73 lines not on this page · raw message

tools/ocaml/libs/xs/xs.ml new file +170 -0

170 lines not on this page · raw message

tools/ocaml/libs/xs/xs.mli new file +90 -0

90 lines not on this page · raw message

tools/ocaml/libs/xs/xsraw.ml new file +265 -0

265 lines not on this page · raw message

tools/ocaml/libs/xs/xsraw.mli new file +60 -0

60 lines not on this page · raw message

tools/ocaml/libs/xs/xst.ml new file +61 -0

61 lines not on this page · raw message

tools/ocaml/libs/xs/xst.mli new file +30 -0
new file mode 100644
index 0000000..5ae5604
@@ -0,0 +1,30 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+type ops = {
+	directory : string -> string list;
+	read : string -> string;
+	readv : string -> string list -> string list;
+	write : string -> string -> unit;
+	writev : string -> (string * string) list -> unit;
+	mkdir : string -> unit;
+	rm : string -> unit;
+	getperms : string -> Xsraw.perms;
+	setperms : string -> Xsraw.perms -> unit;
+	setpermsv : string -> string list -> Xsraw.perms -> unit;
+}
+
+val get_operations : int -> Xsraw.con -> ops
+val transaction : Xsraw.con -> (ops -> 'a) -> 'a

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

PATCH v2 4/10 add uuid ocaml bindings

In reply to Vincent Hanquez
---
 tools/ocaml/libs/uuid/META.in  |    4 ++
 tools/ocaml/libs/uuid/Makefile |   26 ++++++++++++
 tools/ocaml/libs/uuid/uuid.ml  |   88 ++++++++++++++++++++++++++++++++++++++++
 tools/ocaml/libs/uuid/uuid.mli |   53 ++++++++++++++++++++++++
 4 files changed, 171 insertions(+), 0 deletions(-)
 create mode 100644 tools/ocaml/libs/uuid/META.in
 create mode 100644 tools/ocaml/libs/uuid/Makefile
 create mode 100644 tools/ocaml/libs/uuid/uuid.ml
 create mode 100644 tools/ocaml/libs/uuid/uuid.mli
tools/ocaml/libs/uuid/META.in new file +4 -0
new file mode 100644
index 0000000..f33c980
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "Uuid - universal identifer"
+archive(byte) = "uuid.cma"
+archive(native) = "uuid.cmxa"
tools/ocaml/libs/uuid/Makefile new file +26 -0
new file mode 100644
index 0000000..8ddb0e2
@@ -0,0 +1,26 @@
+TOPLEVEL=../..
+include $(TOPLEVEL)/common.make
+
+OBJS = uuid
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = uuid.cma uuid.cmxa
+
+all: $(INTF) $(LIBS) $(PROGRAMS)
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+uuid_OBJS = $(OBJS)
+OCAML_NOC_LIBRARY = uuid
+
+.PHONY: install
+install: $(LIBS) META
+	ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore uuid META $(INTF) $(LIBS) *.a *.cmx
+
+.PHONY: uninstall
+uninstall:
+	ocamlfind remove uuid
+
+include $(TOPLEVEL)/Makefile.rules
+
tools/ocaml/libs/uuid/uuid.ml new file +88 -0

88 lines not on this page · raw message

tools/ocaml/libs/uuid/uuid.mli new file +53 -0

53 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw

PATCH v2 5/10 add logs ocaml bindings

In reply to Vincent Hanquez
---
 tools/ocaml/libs/log/META.in        |    4 +
 tools/ocaml/libs/log/Makefile       |   41 ++++++
 tools/ocaml/libs/log/log.ml         |  258 +++++++++++++++++++++++++++++++++++
 tools/ocaml/libs/log/log.mli        |   55 ++++++++
 tools/ocaml/libs/log/logs.ml        |  197 ++++++++++++++++++++++++++
 tools/ocaml/libs/log/logs.mli       |   46 ++++++
 tools/ocaml/libs/log/syslog.ml      |   26 ++++
 tools/ocaml/libs/log/syslog.mli     |   41 ++++++
 tools/ocaml/libs/log/syslog_stubs.c |   73 ++++++++++
 9 files changed, 741 insertions(+), 0 deletions(-)
 create mode 100644 tools/ocaml/libs/log/META.in
 create mode 100644 tools/ocaml/libs/log/Makefile
 create mode 100644 tools/ocaml/libs/log/log.ml
 create mode 100644 tools/ocaml/libs/log/log.mli
 create mode 100644 tools/ocaml/libs/log/logs.ml
 create mode 100644 tools/ocaml/libs/log/logs.mli
 create mode 100644 tools/ocaml/libs/log/syslog.ml
 create mode 100644 tools/ocaml/libs/log/syslog.mli
 create mode 100644 tools/ocaml/libs/log/syslog_stubs.c
tools/ocaml/libs/log/META.in new file +4 -0
new file mode 100644
index 0000000..5c3646a
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "Log - logging library"
+archive(byte) = "log.cma"
+archive(native) = "log.cmxa"
tools/ocaml/libs/log/Makefile new file +41 -0

41 lines not on this page · raw message

tools/ocaml/libs/log/log.ml new file +258 -0

258 lines not on this page · raw message

tools/ocaml/libs/log/log.mli new file +55 -0

55 lines not on this page · raw message

tools/ocaml/libs/log/logs.ml new file +197 -0

197 lines not on this page · raw message

tools/ocaml/libs/log/logs.mli new file +46 -0

46 lines not on this page · raw message

tools/ocaml/libs/log/syslog.ml new file +26 -0
new file mode 100644
index 0000000..2b417da
@@ -0,0 +1,26 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+type level = Emerg | Alert | Crit | Err | Warning | Notice | Info | Debug
+type options = Cons | Ndelay | Nowait | Odelay | Perror | Pid
+type facility = Auth | Authpriv | Cron | Daemon | Ftp | Kern
+              | Local0 | Local1 | Local2 | Local3
+	      | Local4 | Local5 | Local6 | Local7
+	      | Lpr | Mail | News | Syslog | User | Uucp
+
+(* external init : string -> options list -> facility -> unit = "stub_openlog" *)
+external log : facility -> level -> string -> unit = "stub_syslog"
+external close : unit -> unit = "stub_closelog"
tools/ocaml/libs/log/syslog.mli new file +41 -0

41 lines not on this page · raw message

tools/ocaml/libs/log/syslog_stubs.c new file +73 -0

73 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw

PATCH v2 6/10 add ocaml xenstored

In reply to Vincent Hanquez
---
 tools/ocaml/xenstored/Makefile       |   54 ++++
 tools/ocaml/xenstored/config.ml      |  112 ++++++++
 tools/ocaml/xenstored/connection.ml  |  234 +++++++++++++++++
 tools/ocaml/xenstored/connections.ml |  167 ++++++++++++
 tools/ocaml/xenstored/define.ml      |   40 +++
 tools/ocaml/xenstored/disk.ml        |  157 ++++++++++++
 tools/ocaml/xenstored/domain.ml      |   62 +++++
 tools/ocaml/xenstored/domains.ml     |   84 ++++++
 tools/ocaml/xenstored/event.ml       |   29 +++
 tools/ocaml/xenstored/logging.ml     |  239 ++++++++++++++++++
 tools/ocaml/xenstored/parse_arg.ml   |   68 +++++
 tools/ocaml/xenstored/perms.ml       |  167 ++++++++++++
 tools/ocaml/xenstored/process.ml     |  396 +++++++++++++++++++++++++++++
 tools/ocaml/xenstored/quota.ml       |   83 ++++++
 tools/ocaml/xenstored/store.ml       |  461 ++++++++++++++++++++++++++++++++++
 tools/ocaml/xenstored/symbol.ml      |   76 ++++++
 tools/ocaml/xenstored/symbol.mli     |   52 ++++
 tools/ocaml/xenstored/transaction.ml |  198 +++++++++++++++
 tools/ocaml/xenstored/utils.ml       |  107 ++++++++
 tools/ocaml/xenstored/xenstored.conf |   30 +++
 tools/ocaml/xenstored/xenstored.ml   |  404 +++++++++++++++++++++++++++++
 21 files changed, 3220 insertions(+), 0 deletions(-)
 create mode 100644 tools/ocaml/xenstored/Makefile
 create mode 100644 tools/ocaml/xenstored/config.ml
 create mode 100644 tools/ocaml/xenstored/connection.ml
 create mode 100644 tools/ocaml/xenstored/connections.ml
 create mode 100644 tools/ocaml/xenstored/define.ml
 create mode 100644 tools/ocaml/xenstored/disk.ml
 create mode 100644 tools/ocaml/xenstored/domain.ml
 create mode 100644 tools/ocaml/xenstored/domains.ml
 create mode 100644 tools/ocaml/xenstored/event.ml
 create mode 100644 tools/ocaml/xenstored/logging.ml
 create mode 100644 tools/ocaml/xenstored/parse_arg.ml
 create mode 100644 tools/ocaml/xenstored/perms.ml
 create mode 100644 tools/ocaml/xenstored/process.ml
 create mode 100644 tools/ocaml/xenstored/quota.ml
 create mode 100644 tools/ocaml/xenstored/store.ml
 create mode 100644 tools/ocaml/xenstored/symbol.ml
 create mode 100644 tools/ocaml/xenstored/symbol.mli
 create mode 100644 tools/ocaml/xenstored/transaction.ml
 create mode 100644 tools/ocaml/xenstored/utils.ml
 create mode 100644 tools/ocaml/xenstored/xenstored.conf
 create mode 100644 tools/ocaml/xenstored/xenstored.ml
tools/ocaml/xenstored/Makefile new file +54 -0
new file mode 100644
index 0000000..1af6368
@@ -0,0 +1,54 @@
+OCAML_TOPLEVEL = ..
+include $(OCAML_TOPLEVEL)/common.make
+
+OCAMLINCLUDE += \
+	-I $(OCAML_TOPLEVEL)/libs/log \
+	-I $(OCAML_TOPLEVEL)/libs/xb \
+	-I $(OCAML_TOPLEVEL)/libs/uuid \
+	-I $(OCAML_TOPLEVEL)/libs/mmap \
+	-I $(OCAML_TOPLEVEL)/libs/xc \
+	-I $(OCAML_TOPLEVEL)/libs/eventchn
+
+OBJS = define \
+	stdext \
+	trie \
+	config \
+	logging \
+	quota \
+	perms \
+	symbol \
+	utils \
+	store \
+	disk \
+	transaction \
+	event \
+	domain \
+	domains \
+	connection \
+	connections \
+	parse_arg \
+	process \
+	xenstored
+
+INTF = symbol.cmi trie.cmi
+XENSTOREDLIBS = \
+	unix.cmxa \
+	$(OCAML_TOPLEVEL)/libs/uuid/uuid.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/mmap.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/log $(OCAML_TOPLEVEL)/libs/log/log.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/eventchn.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xc.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xb.cmxa
+
+PROGRAMS = oxenstored
+
+oxenstored_LIBS = $(XENSTOREDLIBS)
+oxenstored_OBJS = $(OBJS)
+
+OCAML_PROGRAM = oxenstored
+
+all: $(INTF) $(PROGRAMS)
+
+bins: $(PROGRAMS)
+
+include $(OCAML_TOPLEVEL)/Makefile.rules
tools/ocaml/xenstored/config.ml new file +112 -0

112 lines not on this page · raw message

tools/ocaml/xenstored/connection.ml new file +234 -0

234 lines not on this page · raw message

tools/ocaml/xenstored/connections.ml new file +167 -0

167 lines not on this page · raw message

tools/ocaml/xenstored/define.ml new file +40 -0
new file mode 100644
index 0000000..19a699f
@@ -0,0 +1,40 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+let xenstored_major = 1
+let xenstored_minor = 0
+
+let xenstored_proc_kva = "/proc/xen/xsd_kva"
+let xenstored_proc_port = "/proc/xen/xsd_port"
+
+let xs_daemon_socket = "/var/run/xenstored/socket"
+let xs_daemon_socket_ro = "/var/run/xenstored/socket_ro"
+
+let default_config_dir = "/etc/xensource"
+
+let maxwatch = ref (50)
+let maxtransaction = ref (20)
+
+let domid_self = 0x7FF0
+
+exception Not_a_directory of string
+exception Not_a_value of string
+exception Already_exist
+exception Doesnt_exist
+exception Lookup_Doesnt_exist of string
+exception Invalid_path
+exception Permission_denied
+exception Unknown_operation
tools/ocaml/xenstored/disk.ml new file +157 -0

157 lines not on this page · raw message

tools/ocaml/xenstored/domain.ml new file +62 -0

62 lines not on this page · raw message

tools/ocaml/xenstored/domains.ml new file +84 -0

84 lines not on this page · raw message

tools/ocaml/xenstored/event.ml new file +29 -0
new file mode 100644
index 0000000..5cbdccf
@@ -0,0 +1,29 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+(**************** high level binding ****************)
+type t = {
+	fd: Unix.file_descr;
+	mutable virq_port: int;
+}
+
+let init () = { fd = Eventchn.init (); virq_port = -1; }
+let bind_virq eventchn = eventchn.virq_port <- Eventchn.bind_virq eventchn.fd
+let bind_interdomain eventchn domid port = Eventchn.bind_interdomain eventchn.fd domid port
+let unbind eventchn port = Eventchn.unbind eventchn.fd port
+let notify eventchn port = Eventchn.notify eventchn.fd port
+let read_port eventchn = Eventchn.read_port eventchn.fd
+let write_port eventchn port = Eventchn.write_port eventchn.fd port
tools/ocaml/xenstored/logging.ml new file +239 -0

239 lines not on this page · raw message

tools/ocaml/xenstored/parse_arg.ml new file +68 -0

68 lines not on this page · raw message

tools/ocaml/xenstored/perms.ml new file +167 -0

167 lines not on this page · raw message

tools/ocaml/xenstored/process.ml new file +396 -0

396 lines not on this page · raw message

tools/ocaml/xenstored/quota.ml new file +83 -0

83 lines not on this page · raw message

tools/ocaml/xenstored/store.ml new file +461 -0

461 lines not on this page · raw message

tools/ocaml/xenstored/symbol.ml new file +76 -0

76 lines not on this page · raw message

tools/ocaml/xenstored/symbol.mli new file +52 -0

52 lines not on this page · raw message

tools/ocaml/xenstored/transaction.ml new file +198 -0

198 lines not on this page · raw message

tools/ocaml/xenstored/utils.ml new file +107 -0

107 lines not on this page · raw message

tools/ocaml/xenstored/xenstored.conf new file +30 -0
new file mode 100644
index 0000000..0e0e5fb
@@ -0,0 +1,30 @@
+# default xenstored config
+
+# Where the pid file is stored
+pid-file = /var/run/xensource/xenstored.pid
+
+# Randomly failed a transaction with EAGAIN. Used for testing Xs user
+test-eagain = true
+
+# Activate transaction merge support
+merge-activate = true
+
+# Activate node permission system
+perms-activate = true
+
+# Activate quota
+quota-activate = true
+quota-maxentity = 1000
+quota-maxsize = 2048
+quota-maxwatch = 100
+quota-transaction = 10
+
+# Activate filed base backend
+persistant = false
+
+# Logs
+log = error;general;file:/var/log/xenstored.log
+log = warn;general;file:/var/log/xenstored.log
+log = info;general;file:/var/log/xenstored.log
+
+# log = debug;io;file:/var/log/xenstored-io.log
tools/ocaml/xenstored/xenstored.ml new file +404 -0

184 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#7 lore raw

PATCH v2 7/10 add compilation makefile to ocaml directory

In reply to Vincent Hanquez
---
 tools/ocaml/Makefile       |   36 +++++++++++++++++
 tools/ocaml/Makefile.rules |   93 ++++++++++++++++++++++++++++++++++++++++++++
 tools/ocaml/common.make    |   28 +++++++++++++
 3 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100644 tools/ocaml/Makefile
 create mode 100644 tools/ocaml/Makefile.rules
 create mode 100644 tools/ocaml/common.make
tools/ocaml/Makefile new file +36 -0
new file mode 100644
index 0000000..73c2988
@@ -0,0 +1,36 @@
+XEN_ROOT = ../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+SUBDIRS_LIBS = \
+	libs/uuid libs/mmap \
+	libs/log libs/xc libs/eventchn \
+	libs/xb libs/xs
+
+SUBDIRS_PROGRAMS = xenstored
+
+SUBDIRS = $(SUBDIRS_LIBS) $(SUBDIRS_PROGRAMS)
+
+.PHONY: all
+all: build
+
+.PHONY: build $(SUBDIRS)
+build: $(SUBDIRS)
+
+$(SUBDIRS):
+	@echo " === building $@"
+	@$(MAKE) --no-print-directory -C $@
+
+.PHONY: install install-libs install-program
+install: install-libs install-program
+
+install-program: $(SUBDIRS_PROGRAMS)
+	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
+	$(INSTALL_PROG) xenstored/oxenstored $(DESTDIR)$(SBINDIR)
+
+install-libs: $(SUBDIRS_LIBS)
+
+.PHONY: clean
+clean:
+	@for dir in $(SUBDIRS); do \
+		$(MAKE) --no-print-directory -C $$dir clean; \
+	done
tools/ocaml/Makefile.rules new file +93 -0

93 lines not on this page · raw message

tools/ocaml/common.make new file +28 -0
new file mode 100644
index 0000000..3b14dfb
@@ -0,0 +1,28 @@
+CC ?= gcc
+OCAMLOPT ?= ocamlopt
+OCAMLC ?= ocamlc
+OCAMLMKLIB ?= ocamlmklib
+OCAMLDEP ?= ocamldep
+OCAMLLEX ?= ocamllex
+OCAMLYACC ?= ocamlyacc
+
+CFLAGS ?= -Wall -fPIC -O2
+
+XEN_ROOT ?= $(TOPLEVEL)/../xen-unstable.hg
+XEN_DIST_ROOT ?= $(XEN_ROOT)/dist/install
+CFLAGS += -I$(XEN_DIST_ROOT)/usr/include
+
+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
+OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
+
+#LDFLAGS = -cclib -L./
+
+DESTDIR ?= /
+VERSION := echo 0.0
+
+OCAMLABI = $(shell $(OCAMLC) -version)
+OCAMLLIBDIR = $(shell $(OCAMLC) -where)
+OCAMLDESTDIR ?= $(OCAMLLIBDIR)
+
+o= >[email protected] && mv -f [email protected] $@

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw

PATCH v2 8/10 remove hook from external ocaml repository

In reply to Vincent Hanquez
---
 Config.mk               |    6 ------
 tools/Makefile          |   21 ---------------------
 tools/xenstore/Makefile |    5 -----
 3 files changed, 0 insertions(+), 32 deletions(-)
Config.mk +0 -6
index a0dc40e..364a714 100644
@@ -158,12 +158,6 @@ QEMU_TAG := xen-4.0.0-rc5
 # Thu Feb 18 15:36:29 2010 +0000
 # When xen_platform_pci=0 also disable fixed Xen platform ioports
 
-OCAML_XENSTORED_REPO=http://xenbits.xensource.com/ext/xen-ocaml-tools.hg
-
-# Build OCAML version of xenstored instead of the in-tree C version?
-# This will cause $(OCAML_XENSTORED_REPO) to be cloned.
-CONFIG_OCAML_XENSTORED ?= n
-
 # Optional components
 XENSTAT_XENTOP     ?= y
 VTPM_TOOLS         ?= n
tools/Makefile +0 -21
index 48c9802..c34dc86 100644
@@ -6,7 +6,6 @@ SUBDIRS-y += check
 SUBDIRS-y += include
 SUBDIRS-y += libxc
 SUBDIRS-y += flask
-SUBDIRS-$(CONFIG_OCAML_XENSTORED) += ocaml-xenstored
 SUBDIRS-y += xenstore
 SUBDIRS-y += misc
 SUBDIRS-y += examples
@@ -114,23 +113,3 @@ subdir-clean-ioemu-dir:
 		$(buildmakevars2shellvars); \
 		$(MAKE) -C ioemu-dir clean; \
 	fi
-
-ocaml-xenstored:
-	set -ex; \
-	rm -rf ocaml-xenstored.tmp; \
-	hg clone $(OCAML_XENSTORED_REPO) ocaml-xenstored.tmp; \
-	if [ "$(OCAML_XENSTORED_TAG)" ]; then \
-		hg -R ocaml-xenstored.tmp update -r $(OCAML_XENSTORED_TAG) ;\
-		hg -R ocaml-xenstored.tmp branch mybranch ;\
-	fi;						\
-	mv ocaml-xenstored.tmp ocaml-xenstored; \
-
-subdir-all-ocaml-xenstored subdir-install-ocaml-xenstored: ocaml-xenstored
-	$(absolutify_xen_root); \
-	$(MAKE) -C ocaml-xenstored $(patsubst subdir-%-ocaml-xenstored,%,$@);
-
-subdir-clean-ocaml-xenstored:
-	set -e; if test -d ocaml-xenstored; then \
-		$(MAKE) -C ocaml-xenstored clean; \
-	fi
-
tools/xenstore/Makefile +0 -5
index f64ba9f..6ef6ff0 100644
@@ -95,11 +95,6 @@ tarball: clean
 
 .PHONY: install
 install: all
-ifneq ($(CONFIG_OCAML_XENSTORED),y)
-	$(INSTALL_DIR) $(DESTDIR)/var/run/xenstored
-	$(INSTALL_DIR) $(DESTDIR)/var/lib/xenstored
-	$(INSTALL_PROG) xenstored $(DESTDIR)$(SBINDIR)
-endif
 	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#9 lore raw

PATCH v2 9/10 add ocaml tools to build if defined. default to n

In reply to Vincent Hanquez
---
 Config.mk      |    1 +
 tools/Makefile |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
Config.mk +1 -0
index 364a714..88ae9ff 100644
@@ -163,6 +163,7 @@ XENSTAT_XENTOP     ?= y
 VTPM_TOOLS         ?= n
 LIBXENAPI_BINDINGS ?= n
 PYTHON_TOOLS       ?= y
+OCAML_TOOLS        ?= n
 CONFIG_MINITERM    ?= n
 CONFIG_LOMOUNT     ?= n
 
tools/Makefile +2 -0
index c34dc86..58058f9 100644
@@ -40,6 +40,8 @@ SUBDIRS-$(CONFIG_X86) += xenpaging
 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 SUBDIRS-$(PYTHON_TOOLS) += python
 SUBDIRS-$(PYTHON_TOOLS) += pygrub
+
+SUBDIRS-$(OCAML_TOOLS) += ocaml
 endif
 
 # For the sake of linking, set the sys-root

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#10 lore raw

PATCH v2 10/10 default ocaml tools config variable to y

In reply to Vincent Hanquez

fallback mechanism if ocamlopt is not available or if we don't compile on a linux system (probably need portability fixes for solaris/netbsd/etc).

---
 Config.mk |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
Config.mk +9 -1
index 88ae9ff..a36c920 100644
@@ -163,8 +163,16 @@ XENSTAT_XENTOP     ?= y
 VTPM_TOOLS         ?= n
 LIBXENAPI_BINDINGS ?= n
 PYTHON_TOOLS       ?= y
-OCAML_TOOLS        ?= n
+OCAML_TOOLS        ?= y
 CONFIG_MINITERM    ?= 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

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel