Skip to contentSkip to conversation

Rename the ocamlfind packages

PATCH New Jon Ludlam 1 participant 8 messages Oct 4, 2011 – Oct 5, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jon Ludlam

author
#1 lore raw

PATCH 1/1 Rename the ocamlfind packages

ocamlfind does not support namespaces, so to avoid name clashes the ocamlfind package names have been changed. Note that this does not change the names of the actual modules themselves.

xb becomes xenbus, xc becomes xenctrl, xl becomes xenlight, xs becomes xenstore, eventchn becomes xeneventchn.

tools/ocaml/libs/eventchn/Makefile +3 -3
diff -r 3d1664cc9e45 -r ad1b4634d0d0 tools/ocaml/libs/eventchn/Makefile
@@ -24,12 +24,12 @@
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) eventchn
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore eventchn META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xeneventchn
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xeneventchn META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) eventchn
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xeneventchn
 
 include $(TOPLEVEL)/Makefile.rules
 
tools/ocaml/libs/xb/Makefile +3 -3
diff -r 3d1664cc9e45 -r ad1b4634d0d0 tools/ocaml/libs/xb/Makefile
@@ -36,11 +36,11 @@
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xb
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xb META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenbus
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenbus META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xb
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenbus
 
 include $(TOPLEVEL)/Makefile.rules
tools/ocaml/libs/xc/Makefile +3 -3
diff -r 3d1664cc9e45 -r ad1b4634d0d0 tools/ocaml/libs/xc/Makefile
@@ -23,11 +23,11 @@
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xc
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xc META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenctrl
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenctrl META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xc
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenctrl
 
 include $(TOPLEVEL)/Makefile.rules
tools/ocaml/libs/xl/Makefile +3 -3
diff -r 3d1664cc9e45 -r ad1b4634d0d0 tools/ocaml/libs/xl/Makefile
@@ -56,11 +56,11 @@
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xl
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xl META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenlight
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenlight META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xl
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenlight
 
 include $(TOPLEVEL)/Makefile.rules
tools/ocaml/libs/xs/META.in +1 -1
diff -r 3d1664cc9e45 -r ad1b4634d0d0 tools/ocaml/libs/xs/META.in
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "XenStore Interface"
-requires = "unix,xb"
+requires = "unix,xenbus"
 archive(byte) = "xs.cma"
 archive(native) = "xs.cmxa"
tools/ocaml/libs/xs/Makefile +3 -3
diff -r 3d1664cc9e45 -r ad1b4634d0d0 tools/ocaml/libs/xs/Makefile
@@ -26,12 +26,12 @@
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xs
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xs META $(INTF) xs.mli xst.mli xsraw.mli $(LIBS) *.a *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenstore
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenstore META $(INTF) xs.mli xst.mli xsraw.mli $(LIBS) *.a *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xs
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenstore
 
 include $(TOPLEVEL)/Makefile.rules
author
#2 lore raw

PATCH 1/1 Add a missing dependency to the xenctrl ocaml package

In reply to a message not in the archive
tools/ocaml/libs/xc/META.in +1 -1
diff -r ad1b4634d0d0 -r d94a733c3a92 tools/ocaml/libs/xc/META.in
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "Xen Control Interface"
-requires = "mmap,uuid"
+requires = "unix,mmap,uuid"
 archive(byte) = "xc.cma"
 archive(native) = "xc.cmxa"
author
#3 lore raw

PATCH 1/1 Remove the uuid library

In reply to a message not in the archive

The library was only minimally used, and was really rather redundant.

tools/ocaml/libs/Makefile +1 -1
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/Makefile
@@ -2,7 +2,7 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS= \
-	uuid mmap \
+	mmap \
 	log xc eventchn \
 	xb xs xl
 
tools/ocaml/libs/uuid/META.in deleted +0 -4
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/uuid/META.in
@@ -1,4 +0,0 @@
-version = "@VERSION@"
-description = "Uuid - universal identifer"
-archive(byte) = "uuid.cma"
-archive(native) = "uuid.cmxa"
tools/ocaml/libs/uuid/Makefile deleted +0 -29
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/uuid/Makefile
@@ -1,29 +0,0 @@
-TOPLEVEL=$(CURDIR)/../..
-XEN_ROOT=$(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
-	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) uuid
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore uuid META $(INTF) $(LIBS) *.a *.cmx
-
-.PHONY: uninstall
-uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) uuid
-
-include $(TOPLEVEL)/Makefile.rules
-
tools/ocaml/libs/uuid/uuid.ml deleted +0 -100

100 lines not on this page · raw message

tools/ocaml/libs/uuid/uuid.mli deleted +0 -67

67 lines not on this page · raw message

tools/ocaml/libs/xb/Makefile +1 -1
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/xb/Makefile
@@ -31,7 +31,7 @@
 
 %.mli: %.ml
 	$(E) " MLI       $@"
-	$(Q)$(OCAMLC) -i $< $o
+	$(Q)$(OCAMLC) $(OCAMLCFLAGS) -i $< $o
 
 .PHONY: install
 install: $(LIBS) META
tools/ocaml/libs/xc/META.in +1 -1
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/xc/META.in
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "Xen Control Interface"
-requires = "unix,mmap,uuid"
+requires = "unix,mmap"
 archive(byte) = "xc.cma"
 archive(native) = "xc.cmxa"
tools/ocaml/libs/xc/Makefile +1 -1
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/xc/Makefile
@@ -3,7 +3,7 @@
 include $(TOPLEVEL)/common.make
 
 CFLAGS += -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
-OCAMLINCLUDE += -I ../mmap -I ../uuid
+OCAMLINCLUDE += -I ../mmap
 
 OBJS = xc
 INTF = xc.cmi
tools/ocaml/libs/xc/xc.ml +11 -2
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/xc/xc.ml
@@ -118,14 +118,23 @@
 external _domain_create: handle -> int32 -> domain_create_flag list -> int array -> domid
        = "stub_xc_domain_create"
 
+let int_array_of_uuid_string s =
+	try
+		Scanf.sscanf s
+			"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+			(fun a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 ->
+				[| a0; a1; a2; a3; a4; a5; a6; a7;
+				   a8; a9; a10; a11; a12; a13; a14; a15 |])
+	with _ -> invalid_arg ("Xc.int_array_of_uuid_string: " ^ s)
+
 let domain_create handle n flags uuid =
-	_domain_create handle n flags (Uuid.int_array_of_uuid uuid)
+	_domain_create handle n flags (int_array_of_uuid_string uuid)
 
 external _domain_sethandle: handle -> domid -> int array -> unit
                           = "stub_xc_domain_sethandle"
 
 let domain_sethandle handle n uuid =
-	_domain_sethandle handle n (Uuid.int_array_of_uuid uuid)
+	_domain_sethandle handle n (int_array_of_uuid_string uuid)
 
 external domain_max_vcpus: handle -> domid -> int -> unit
        = "stub_xc_domain_max_vcpus"
tools/ocaml/libs/xc/xc.mli +2 -6
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/libs/xc/xc.mli
@@ -74,12 +74,8 @@
 external is_fake : unit -> bool = "stub_xc_interface_is_fake"
 external interface_close : handle -> unit = "stub_xc_interface_close"
 val with_intf : (handle -> 'a) -> 'a
-external _domain_create : handle -> int32 -> domain_create_flag list -> int array -> domid
-  = "stub_xc_domain_create"
-val domain_create : handle -> int32 -> domain_create_flag list -> 'a Uuid.t -> domid
-external _domain_sethandle : handle -> domid -> int array -> unit
-  = "stub_xc_domain_sethandle"
-val domain_sethandle : handle -> domid -> 'a Uuid.t -> unit
+val domain_create : handle -> int32 -> domain_create_flag list -> string -> domid
+val domain_sethandle : handle -> domid -> string -> unit
 external domain_max_vcpus : handle -> domid -> int -> unit
   = "stub_xc_domain_max_vcpus"
 external domain_pause : handle -> domid -> unit = "stub_xc_domain_pause"
tools/ocaml/xenstored/Makefile +0 -2
diff -r d94a733c3a92 -r 3cb878660928 tools/ocaml/xenstored/Makefile
@@ -5,7 +5,6 @@
 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
@@ -34,7 +33,6 @@
 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 \
author
#4 lore raw

PATCH 1/1 Remove log library from tools/ocaml/libs

In reply to a message not in the archive

The only user was oxenstored, which has had the relevant bits merged in.

tools/ocaml/libs/Makefile +1 -1
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/libs/Makefile
@@ -3,7 +3,7 @@
 
 SUBDIRS= \
 	mmap \
-	log xc eventchn \
+	xc eventchn \
 	xb xs xl
 
 .PHONY: all
tools/ocaml/libs/log/META.in deleted +0 -5
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/libs/log/META.in
@@ -1,5 +0,0 @@
-version = "@VERSION@"
-description = "Log - logging library"
-requires = "unix"
-archive(byte) = "log.cma"
-archive(native) = "log.cmxa"
tools/ocaml/libs/log/Makefile deleted +0 -44

44 lines not on this page · raw message

tools/ocaml/libs/log/log.ml deleted +0 -258

258 lines not on this page · raw message

tools/ocaml/libs/log/log.mli deleted +0 -55

55 lines not on this page · raw message

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

197 lines not on this page · raw message

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

46 lines not on this page · raw message

tools/ocaml/libs/log/syslog.ml deleted +0 -26
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/libs/log/syslog.ml
@@ -1,26 +0,0 @@
-(*
- * 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 deleted +0 -41

41 lines not on this page · raw message

tools/ocaml/libs/log/syslog_stubs.c deleted +0 -75

75 lines not on this page · raw message

tools/ocaml/xenstored/Makefile +0 -2
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/Makefile
@@ -3,7 +3,6 @@
 include $(OCAML_TOPLEVEL)/common.make
 
 OCAMLINCLUDE += \
-	-I $(OCAML_TOPLEVEL)/libs/log \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
 	-I $(OCAML_TOPLEVEL)/libs/mmap \
 	-I $(OCAML_TOPLEVEL)/libs/xc \
@@ -34,7 +33,6 @@
 XENSTOREDLIBS = \
 	unix.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 \
tools/ocaml/xenstored/connection.ml +5 -0
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/connection.ml
@@ -232,3 +232,8 @@
 			Printf.fprintf chan "watch,%d,%s,%s\n" domid (Utils.hexify path) (Utils.hexify token)
 			) (list_watches con);
 	| None -> ()
+
+let debug con =
+	let domid = get_domstr con in
+	let watches = List.map (fun (path, token) -> Printf.sprintf "watch %s: %s %s\n" domid path token) (list_watches con) in
+	String.concat "" watches
tools/ocaml/xenstored/connections.ml +6 -1
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/connections.ml
@@ -15,7 +15,7 @@
  * GNU Lesser General Public License for more details.
  *)
 
-let debug fmt = Logs.debug "general" fmt
+let debug fmt = Logging.debug "connections" fmt
 
 type t = {
 	mutable anonymous: Connection.t list;
@@ -165,3 +165,8 @@
 	);
 	(List.length cons.anonymous, !nb_ops_anon, !nb_watchs_anon,
 	 Hashtbl.length cons.domains, !nb_ops_dom, !nb_watchs_dom)
+
+let debug cons =
+	let anonymous = List.map Connection.debug cons.anonymous in
+	let domains = Hashtbl.fold (fun _ con accu -> Connection.debug con :: accu) cons.domains [] in
+	String.concat "" (domains @ anonymous)
tools/ocaml/xenstored/disk.ml +1 -1
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/disk.ml
@@ -17,7 +17,7 @@
 let enable = ref false
 let xs_daemon_database = "/var/run/xenstored/db"
 
-let error = Logs.error "general"
+let error fmt = Logging.error "disk" fmt
 
 (* unescape utils *)
 exception Bad_escape
tools/ocaml/xenstored/domain.ml +1 -1
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/domain.ml
@@ -16,7 +16,7 @@
 
 open Printf
 
-let debug fmt = Logs.debug "general" fmt
+let debug fmt = Logging.debug "domain" fmt
 
 type t =
 {
tools/ocaml/xenstored/domains.ml +4 -2
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/domains.ml
@@ -14,6 +14,8 @@
  * GNU Lesser General Public License for more details.
  *)
 
+let debug fmt = Logging.debug "domains" fmt
+
 type domains = {
 	eventchn: Event.t;
 	table: (Xc.domid, Domain.t) Hashtbl.t;
@@ -35,7 +37,7 @@
 		try
 			let info = Xc.domain_getinfo xc id in
 			if info.Xc.shutdown || info.Xc.dying then (
-				Logs.debug "general" "Domain %u died (dying=%b, shutdown %b -- code %d)"
+				debug "Domain %u died (dying=%b, shutdown %b -- code %d)"
 				                    id info.Xc.dying info.Xc.shutdown info.Xc.shutdown_code;
 				if info.Xc.dying then
 					dead_dom := id :: !dead_dom
@@ -43,7 +45,7 @@
 					notify := true;
 			)
 		with Xc.Error _ ->
-			Logs.debug "general" "Domain %u died -- no domain info" id;
+			debug "Domain %u died -- no domain info" id;
 			dead_dom := id :: !dead_dom;
 		) doms.table;
 	List.iter (fun id ->
tools/ocaml/xenstored/logging.ml +162 -140

348 lines not on this page · raw message

tools/ocaml/xenstored/perms.ml +5 -3
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/perms.ml
@@ -15,6 +15,8 @@
  * GNU Lesser General Public License for more details.
  *)
 
+let info fmt = Logging.info "perms" fmt
+
 open Stdext
 
 let activate = ref true
@@ -145,16 +147,16 @@
 		in
 		match perm, request with
 		| NONE, _ ->
-			Logs.info "io" "Permission denied: Domain %d has no permission" domainid;
+			info "Permission denied: Domain %d has no permission" domainid;
 			false
 		| RDWR, _ -> true
 		| READ, READ -> true
 		| WRITE, WRITE -> true
 		| READ, _ ->
-			Logs.info "io" "Permission denied: Domain %d has read only access" domainid;
+			info "Permission denied: Domain %d has read only access" domainid;
 			false
 		| WRITE, _ ->
-			Logs.info "io" "Permission denied: Domain %d has write only access" domainid;
+			info "Permission denied: Domain %d has write only access" domainid;
 			false
 	in
 	if !activate
tools/ocaml/xenstored/process.ml +10 -5
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/process.ml
@@ -14,6 +14,9 @@
  * GNU Lesser General Public License for more details.
  *)
 
+let error fmt = Logging.error "process" fmt
+let info fmt = Logging.info "process" fmt
+
 open Printf
 open Stdext
 
@@ -79,7 +82,7 @@
 
 (* packets *)
 let do_debug con t domains cons data =
-	if not !allow_debug
+	if not (Connection.is_dom0 con) && not !allow_debug
 	then None
 	else try match split None '\000' data with
 	| "print" :: msg :: _ ->
@@ -89,6 +92,9 @@
 		let domid = int_of_string domid in
 		let quota = (Store.get_quota t.Transaction.store) in
 		Some (Quota.to_string quota domid ^ "\000")
+	| "watches" :: _ ->
+		let watches = Connections.debug cons in
+		Some (watches ^ "\000")
 	| "mfn" :: domid :: _ ->
 		let domid = int_of_string domid in
 		let con = Connections.find_domain cons domid in
@@ -357,8 +363,7 @@
 			in
 		input_handle_error ~cons ~doms ~fct ~ty ~con ~t ~rid ~data;
 	with exn ->
-		Logs.error "general" "process packet: %s"
-		          (Printexc.to_string exn);
+		error "process packet: %s" (Printexc.to_string exn);
 		Connection.send_error con tid rid "EIO"
 
 let write_access_log ~ty ~tid ~con ~data =
@@ -372,7 +377,7 @@
 		let packet = Connection.pop_in con in
 		let tid, rid, ty, data = Xb.Packet.unpack packet in
 		(* As we don't log IO, do not call an unnecessary sanitize_data 
-		   Logs.info "io" "[%s] -> [%d] %s \"%s\""
+		   info "[%s] -> [%d] %s \"%s\""
 		         (Connection.get_domstr con) tid
 		         (Xb.Op.to_string ty) (sanitize_data data); *)
 		process_packet ~store ~cons ~doms ~con ~tid ~rid ~ty ~data;
@@ -386,7 +391,7 @@
 			let packet = Connection.peek_output con in
 			let tid, rid, ty, data = Xb.Packet.unpack packet in
 			(* As we don't log IO, do not call an unnecessary sanitize_data 
-			   Logs.info "io" "[%s] <- %s \"%s\""
+			   info "[%s] <- %s \"%s\""
 			         (Connection.get_domstr con)
 			         (Xb.Op.to_string ty) (sanitize_data data);*)
 			write_answer_log ~ty ~tid ~con ~data;
tools/ocaml/xenstored/quota.ml +1 -1
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/quota.ml
@@ -18,7 +18,7 @@
 exception Data_too_big
 exception Transaction_opened
 
-let warn fmt = Logs.warn "general" fmt
+let warn fmt = Logging.warn "quota" fmt
 let activate = ref true
 let maxent = ref (10000)
 let maxsize = ref (4096)
tools/ocaml/xenstored/store.ml +1 -1
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/store.ml
@@ -83,7 +83,7 @@
 let check_owner node connection =
 	if not (Perms.check_owner connection node.perms)
 	then begin
-		Logs.info "io" "Permission denied: Domain %d not owner" (get_owner node);
+		Logging.info "store|node" "Permission denied: Domain %d not owner" (get_owner node);
 		raise Define.Permission_denied;
 	end
 
tools/ocaml/xenstored/xenstored.conf +10 -5
diff -r 3cb878660928 -r b6d1deac6ca2 tools/ocaml/xenstored/xenstored.conf
@@ -22,9 +22,14 @@
 # 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
+# Xenstored logs
+# xenstored-log-file = /var/log/xenstored.log
+# xenstored-log-level = null
+# xenstored-log-nb-files = 10
 
-# log = debug;io;file:/var/log/xenstored-io.log
+# Xenstored access logs
+# access-log-file = /var/log/xenstored-access.log
+# access-log-nb-lines = 13215
+# acesss-log-nb-chars = 180
+# access-log-special-ops = false
+
tools/ocaml/xenstored/xenstored.ml +28 -34

111 lines not on this page · raw message

author
#5 lore raw

PATCH 1/1 Minor makefile cleanup

In reply to a message not in the archive
tools/ocaml/Makefile.rules +5 -5
diff -r b6d1deac6ca2 -r 875d9c54a1cd tools/ocaml/Makefile.rules
@@ -52,20 +52,20 @@
 mk-caml-lib-native = $(call quiet-command, $(OCAMLOPT) $(OCAMLOPTFLAGS) -a -o $1 $2 $3,MLA,$1)
 mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $2 $3,MLA,$1)
 
-mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
+mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) $(LIBS_$(1)) -o $(1)_stubs $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(AR) rcs $1 $2 && $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2,MKLIB,$1)
+	$(call quiet-command, $(AR) rcs lib$(1)_stubs.a $2 && $(OCAMLMKLIB) $(LIBS_$(1)) -o $(1)_stubs $2,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
  $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
 	$(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
  $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmo)
-	$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs, $$+)
+	$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $$+)
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-stubs,$$@, $$+)
+	$(call mk-caml-stubs,$(1), $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+)
+	$(call mk-caml-lib-stubs,$(1), $$+)
 endef
 
 define OCAML_NOC_LIBRARY_template
tools/ocaml/libs/eventchn/Makefile +1 -1
diff -r b6d1deac6ca2 -r 875d9c54a1cd tools/ocaml/libs/eventchn/Makefile
@@ -8,7 +8,7 @@
 INTF = $(foreach obj, $(OBJS),$(obj).cmi)
 LIBS = eventchn.cma eventchn.cmxa
 
-LIBS_evtchn = $(LDLIBS_libxenctrl)
+LIBS_eventchn = $(LDLIBS_libxenctrl)
 
 all: $(INTF) $(LIBS) $(PROGRAMS)
author
#6 lore raw

PATCH 1/1 Fix 2 bit-twiddling bugs and an off-by-one

In reply to a message not in the archive

The bit bugs are in ocaml vcpu affinity calls, and the off-by-one error is in the ocaml console ring code

tools/ocaml/libs/xc/xc_stubs.c +3 -3
diff -r 875d9c54a1cd -r 05f63323bbb5 tools/ocaml/libs/xc/xc_stubs.c
@@ -430,7 +430,7 @@
 
 	for (i=0; i<len; i++) {
 		if (Bool_val(Field(cpumap, i)))
-			c_cpumap[i/8] |= i << (i&7);
+			c_cpumap[i/8] |= 1 << (i&7);
 	}
 	retval = xc_vcpu_setaffinity(_H(xch), _D(domid),
 	                             Int_val(vcpu), c_cpumap);
@@ -466,7 +466,7 @@
 	ret = caml_alloc(len, 0);
 
 	for (i=0; i<len; i++) {
-		if (c_cpumap[i%8] & 1 << (i&7))
+		if (c_cpumap[i/8] & 1 << (i&7))
 			Store_field(ret, i, Val_true);
 		else
 			Store_field(ret, i, Val_false);
@@ -523,7 +523,7 @@
 
 CAMLprim value stub_xc_readconsolering(value xch)
 {
-	unsigned int size = RING_SIZE;
+	unsigned int size = RING_SIZE - 1;
 	char *ring_ptr = ring;
 
 	CAMLparam1(xch);
author
#7 lore raw

PATCH 1/1 Small improvement to the ocaml xenctrl library

In reply to a message not in the archive

Add a new field 'max_nr_cpus' to the physinfo type in the ocaml xc bindings

tools/ocaml/libs/xc/xc.ml +1 -0
diff -r 05f63323bbb5 -r 136274808a4d tools/ocaml/libs/xc/xc.ml
@@ -70,6 +70,7 @@
 	scrub_pages      : nativeint;
 	(* XXX hw_cap *)
 	capabilities     : physinfo_cap_flag list;
+	max_nr_cpus      : int;
 }
 
 type version =
tools/ocaml/libs/xc/xc.mli +1 -0
diff -r 05f63323bbb5 -r 136274808a4d tools/ocaml/libs/xc/xc.mli
@@ -52,6 +52,7 @@
   free_pages       : nativeint;
   scrub_pages      : nativeint;
   capabilities     : physinfo_cap_flag list;
+  max_nr_cpus      : int; (** compile-time max possible number of nr_cpus *)
 }
 type version = { major : int; minor : int; extra : string; }
 type compile_info = {
tools/ocaml/libs/xc/xc_stubs.c +3 -1
diff -r 05f63323bbb5 -r 136274808a4d tools/ocaml/libs/xc/xc_stubs.c
@@ -534,6 +534,7 @@
 
 	if (retval)
 		failwith_xc(_H(xch));
+
 	ring[size] = '\0';
 	CAMLreturn(caml_copy_string(ring));
 }
@@ -573,7 +574,7 @@
 		}
 	}
 
-	physinfo = caml_alloc_tuple(9);
+	physinfo = caml_alloc_tuple(10);
 	Store_field(physinfo, 0, Val_int(c_physinfo.threads_per_core));
 	Store_field(physinfo, 1, Val_int(c_physinfo.cores_per_socket));
 	Store_field(physinfo, 2, Val_int(c_physinfo.nr_cpus));
@@ -583,6 +584,7 @@
 	Store_field(physinfo, 6, caml_copy_nativeint(c_physinfo.free_pages));
 	Store_field(physinfo, 7, caml_copy_nativeint(c_physinfo.scrub_pages));
 	Store_field(physinfo, 8, cap_list);
+	Store_field(physinfo, 9, Val_int(c_physinfo.max_cpu_id + 1));
 
 	CAMLreturn(physinfo);
 }