Ocaml related fixes/cleanups
PATCH 1/1 Ocaml related fixes/cleanups
This patch series is mostly the same as that sent by Zheng Li some time ago, but split into smaller chunks. It only relates to code in the tools/ocaml subdir. The log and uuid packages are removed, and most of the remaining packages renamed to avoid namespace collisions when using ocamlfind. There are also some minor bugfixes and a small cleanup of a makefile.
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
@@ -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
@@ -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
@@ -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
@@ -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/Makefile +3 -3
@@ -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
Re: [PATCH 1 of 7] [OCAML] Rename the ocamlfind packages
Quoted 4 lines · Jon Ludlam
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.
So you do "ocamlfind xenbus" in your code but subsequently "import" xl.* (forgive my lack of actual ocaml syntax)?
I'm happy with that if its acceptable practice in ocaml, but given it's "just" a sed invocation away should we bite the bullet and change the module name too?
Quoted 2 lines
xb becomes xenbus, xc becomes xenctrl, xl becomes xenlight, xs becomes xenstore, eventchn becomes xeneventchn.
The next patch removes uuid which by my count leaves just the mmap library, any plans for that one?
Quoted 1 line
Signed-off-by Jon Ludlam <[email protected]>
Quoted 97 lines
diff -r
7998217630e2-rc5df5f625ee2tools/ocaml/libs/eventchn/Makefiletools/ocaml/libs/eventchn/Makefile +3
-3@@ -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.rulesdiff -r
7998217630e2-rc5df5f625ee2tools/ocaml/libs/xb/Makefiletools/ocaml/libs/xb/Makefile +3
-3@@ -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.rulesdiff -r
7998217630e2-rc5df5f625ee2tools/ocaml/libs/xc/Makefiletools/ocaml/libs/xc/Makefile +3
-3@@ -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.rulesdiff -r
7998217630e2-rc5df5f625ee2tools/ocaml/libs/xl/Makefiletools/ocaml/libs/xl/Makefile +3
-3@@ -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.rulesdiff -r
7998217630e2-rc5df5f625ee2tools/ocaml/libs/xs/Makefiletools/ocaml/libs/xs/Makefile +3
-3@@ -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_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 1 of 7] [OCAML] Rename the ocamlfind packages
Quoted 6 lines · Ian Campbell
Quoted 4 lines · Jon Ludlam
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.
Quoted 7 lines
So you do "ocamlfind xenbus" in your code but subsequently "import" xl.* (forgive my lack of actual ocaml syntax)?
I'm happy with that if its acceptable practice in ocaml, but given it's "just" a sed invocation away should we bite the bullet and change the module name too?
It's not uncommon, e.g. the 'threads' package allows the use of the Thread, Mutex, Condition, Event and ThreadUnix modules, but not a 'Threads' one. Having said that, for the single module packages it would be slightly odd. The only thing that stopped me is that what I did involves a change in the makefiles of any ocaml project using the libs, whereas a renaming of the modules would require changing a lot more code. Being a bit ambivalent about the two approaches, I picked the one that was less noisy, though I'm willing to be persuaded otherwise.
Quoted 6 lines
Quoted 2 lines
xb becomes xenbus, xc becomes xenctrl, xl becomes xenlight, xs becomes xenstore, eventchn becomes xeneventchn.
The next patch removes uuid which by my count leaves just the mmap library, any plans for that one?
We haven't quite figured out what to do with that one yet. It depends a little on whether anything else is using the module. More to follow :-)
Jon
Re: [PATCH 1 of 7] [OCAML] Rename the ocamlfind packages
Quoted 16 lines · Jonathan Ludlam
Quoted 6 lines · Ian Campbell
Quoted 4 lines · Jon Ludlam
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.
Quoted 7 lines
So you do "ocamlfind xenbus" in your code but subsequently "import" xl.* (forgive my lack of actual ocaml syntax)?
I'm happy with that if its acceptable practice in ocaml, but given it's "just" a sed invocation away should we bite the bullet and change the module name too?
Quoted 9 lines
It's not uncommon, e.g. the 'threads' package allows the use of the Thread, Mutex, Condition, Event and ThreadUnix modules, but not a 'Threads' one. Having said that, for the single module packages it would be slightly odd. The only thing that stopped me is that what I did involves a change in the makefiles of any ocaml project using the libs, whereas a renaming of the modules would require changing a lot more code. Being a bit ambivalent about the two approaches, I picked the one that was less noisy, though I'm willing to be persuaded otherwise.
Thanks -- seems reasonable. I'm don't see any reason to try and persuade you any further ;-)
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
xb becomes xenbus, xc becomes xenctrl, xl becomes xenlight, xs becomes xenstore, eventchn becomes xeneventchn.
The next patch removes uuid which by my count leaves just the mmap library, any plans for that one?
We haven't quite figured out what to do with that one yet. It depends a little on whether anything else is using the module. More to follow :-)
Great!
PATCH 1/1 Remove the uuid library
In reply to Jon LudlamThe library was only minimally used, and was really rather redundant.
tools/ocaml/libs/Makefile +1 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,5 +1,5 @@ version = "@VERSION@" description = "Xen Control Interface" -requires = "mmap,uuid" +requires = "unix,mmap" archive(byte) = "xc.cma" archive(native) = "xc.cmxa"
tools/ocaml/libs/xc/Makefile +1 -1
@@ -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
@@ -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
@@ -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
@@ -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 \
Re: [PATCH 2 of 7] [OCAML] Remove the uuid library
tools/ocaml/libs/xc/META.in line 5
Quoted 10 lines · Jon Ludlam
diff -r
c5df5f625ee2-r42cdb34ec175tools/ocaml/libs/xc/META.intools/ocaml/libs/xc/META.in +1
-1@@ -1,5 +1,5 @@ version = "@VERSION@" description = "Xen Control Interface" -requires = "mmap,uuid" +requires = "unix,mmap" archive(byte) = "xc.cma" archive(native) = "xc.cmxa"
Is the addition of unix here really part of removing uuid? I don't see any additional use of unix arising from the change.
xc does seem to use unix already so the change is probably correct, just not really part of this change. I'd be happier if it went in separately, but:
Quoted 83 lines
diff -r
c5df5f625ee2-r42cdb34ec175tools/ocaml/libs/xc/Makefiletools/ocaml/libs/xc/Makefile +1
-1@@ -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.cmidiff -r
c5df5f625ee2-r42cdb34ec175tools/ocaml/libs/xc/xc.mltools/ocaml/libs/xc/xc.ml +11
-2@@ -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"diff -r
c5df5f625ee2-r42cdb34ec175tools/ocaml/libs/xc/xc.mlitools/ocaml/libs/xc/xc.mli +2
-6@@ -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"diff -r
c5df5f625ee2-r42cdb34ec175tools/ocaml/xenstored/Makefiletools/ocaml/xenstored/Makefile +0
-2@@ -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 \_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 2 of 7] [OCAML] Remove the uuid library
Quoted 15 lines · Ian Campbell
Quoted 10 lines · Jon Ludlam
diff -r
c5df5f625ee2-r42cdb34ec175tools/ocaml/libs/xc/META.intools/ocaml/libs/xc/META.in +0
-0@@ -1,5 +1,5 @@version = "@VERSION@"
description = "Xen Control Interface"tools/ocaml/libs/xc/META.in +1
-1-requires = "mmap,uuid" +requires = "unix,mmap"archive(byte) = "xc.cma"
archive(native) = "xc.cmxa"Is the addition of unix here really part of removing uuid? I don't see any additional use of unix arising from the change.
No, you're correct - it's a bugfix in the dependencies. I can prepare it as a separate patch, if you want?
Quoted 5 lines
xc does seem to use unix already so the change is probably correct, just not really part of this change. I'd be happier if it went in separately, but:
Acked-by Ian Campbell <[email protected]>
Re: [PATCH 2 of 7] [OCAML] Remove the uuid library
Quoted 18 lines · Jonathan Ludlam
Quoted 15 lines · Ian Campbell
Quoted 10 lines · Jon Ludlam
diff -r
c5df5f625ee2-r42cdb34ec175tools/ocaml/libs/xc/META.intools/ocaml/libs/xc/META.in +0
-0@@ -1,5 +1,5 @@version = "@VERSION@"
description = "Xen Control Interface"tools/ocaml/libs/xc/META.in +1
-1-requires = "mmap,uuid" +requires = "unix,mmap"archive(byte) = "xc.cma"
archive(native) = "xc.cmxa"Is the addition of unix here really part of removing uuid? I don't see any additional use of unix arising from the change.
Quoted 1 line
No, you're correct - it's a bugfix in the dependencies. I can prepare it as a separate patch, if you want?
I you need to resend the series anyway you may as well I suppose, but if not then its not a big deal for me at least.
Ian.
Quoted 7 lines
Quoted 6 lines
xc does seem to use unix already so the change is probably correct, just not really part of this change. I'd be happier if it went in separately, but:
Acked-by Ian Campbell <[email protected]>
PATCH 1/1 Remove log library from tools/ocaml/libs
In reply to Jon LudlamThe only user was oxenstored, which has had the relevant bits merged in.
tools/ocaml/libs/Makefile +1 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Re: [PATCH 3 of 7] [OCAML] Remove log library from tools/ocaml/libs
Quoted 5 lines · Jon Ludlam
The only user was oxenstored, which has had the relevant bits merged in.
Signed-off-by Zheng Li <[email protected]>Acked-by Jon Ludlam <[email protected]>
PATCH 1/1 Fix a problem with ocaml xenstored
In reply to Jon LudlamHave xenstored trigger an @introduceDomain event even if the introduce call tries to introduce an already existing domain.
tools/ocaml/xenstored/process.ml +3 -2
@@ -168,9 +168,10 @@ | _ -> raise Invalid_Cmd_Args; in let dom = - if Domains.exist domains domid then + if Domains.exist domains domid then begin + Connections.fire_spec_watches cons "@introduceDomain"; Domains.find domains domid - else try + end else try let ndom = Xc.with_intf (fun xc -> Domains.create xc domains domid mfn port) in Connections.add_domain cons ndom;
Re: [PATCH 4 of 7] [OCAML] Fix a problem with ocaml xenstored
Quoted 2 lines · Jon Ludlam
Have xenstored trigger an @introduceDomain event even if the introduce call tries to introduce an already existing domain.
The C daemon doesn't appear to behave this way. It would be nice to explain why this change is necessary.
Quoted 24 lines
Signed-off-by Thomas Gazagnaire <[email protected]>Acked-by Jon Ludlam <[email protected]>diff -r
734cb0807357-rb6022a18ebb0tools/ocaml/xenstored/process.mltools/ocaml/xenstored/process.ml +3
-2@@ -168,9 +168,10 @@ | _ -> raise Invalid_Cmd_Args; in let dom = - if Domains.exist domains domid then + if Domains.exist domains domid then begin + Connections.fire_spec_watches cons "@introduceDomain"; Domains.find domains domid - else try + end else try let ndom = Xc.with_intf (fun xc -> Domains.create xc domains domid mfn port) in Connections.add_domain cons ndom;_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 4 of 7] [OCAML] Fix a problem with ocaml xenstored
Ah, that's a shame. I was hoping this was a bugfix to the ocaml xenstored and that the C version already did this. Unfortunately the patch here went in to XenServer a couple of years ago, and Thomas, who made the change, has since left. I'll dig into this and see why we depend upon it.
Jon
Quoted 33 lines · Ian Campbell
Quoted 2 lines · Jon Ludlam
Have xenstored trigger an @introduceDomain event even if the introduce call tries to introduce an already existing domain.
The C daemon doesn't appear to behave this way. It would be nice to explain why this change is necessary.
Quoted 24 lines
Signed-off-by Thomas Gazagnaire <[email protected]>Acked-by Jon Ludlam <[email protected]>diff -r
734cb0807357-rb6022a18ebb0tools/ocaml/xenstored/process.mltools/ocaml/xenstored/process.ml +3
-2@@ -168,9 +168,10 @@ | _ -> raise Invalid_Cmd_Args; in let dom = - if Domains.exist domains domid then + if Domains.exist domains domid then begin + Connections.fire_spec_watches cons "@introduceDomain"; Domains.find domains domid - else try + end else try let ndom = Xc.with_intf (fun xc -> Domains.create xc domains domid mfn port) in Connections.add_domain cons ndom;_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 4 of 7] [OCAML] Fix a problem with ocaml xenstored
Quoted 5 lines · Jonathan Ludlam
Ah, that's a shame. I was hoping this was a bugfix to the ocaml xenstored and that the C version already did this. Unfortunately the patch here went in to XenServer a couple of years ago, and Thomas, who made the change, has since left. I'll dig into this and see why we depend upon it.
Seems to be CA-30927 which was "internal shutdown doesn't work anymore after VM.checkpoint":
The bugs comes from the fact that xal always assume that suspended domains are or will be soon dead.
However, for VM.checkpoint that assumptions is false, as the VM is suspended, snapshoted, and then resumed, without destroying the domain.
Thomas said in that ticket:
I fixed this issue by:
* teach to xal how to handle dead domains for suspended reasons which become suddenly alive
* when resuming a domain, use the xenstore introduce call
* modify xenstore to generates a @introduceDomain event even if the introduced domain does not exists
I believe nobody care to see too many @introduceDomain event, so that will not change anything. My fix modifies the code path taken by VM.suspend, but that should be safe because xapi destroys properly the domain after suspending it.
(I think he meant _does_ exist in the third bullet). In his commit message he said:
Teach xal what to do with dead domains which become alive again.
Needed to modify xenstored as well in order to trigger a @introduceDomain event even if the introduce call tries to introduce an already existing domain. That will kick-up xal in case when resuming the domain.
I think possibly the right fix would have been to have xal kick-up itself. That said spurious @introduceDomain watches are pretty harmless (as he suggests) since they have no context, the recipient has to go and check it's idea of the world vs the real state to know what happened an the answer "nothing" is not a big deal...
Ian.
Quoted 39 lines
Jon
Quoted 33 lines · Ian Campbell
Quoted 2 lines · Jon Ludlam
Have xenstored trigger an @introduceDomain event even if the introduce call tries to introduce an already existing domain.
The C daemon doesn't appear to behave this way. It would be nice to explain why this change is necessary.
Quoted 24 lines
Signed-off-by Thomas Gazagnaire <[email protected]>Acked-by Jon Ludlam <[email protected]>diff -r
734cb0807357-rb6022a18ebb0tools/ocaml/xenstored/process.mltools/ocaml/xenstored/process.ml +3
-2@@ -168,9 +168,10 @@ | _ -> raise Invalid_Cmd_Args; in let dom = - if Domains.exist domains domid then + if Domains.exist domains domid then begin + Connections.fire_spec_watches cons "@introduceDomain"; Domains.find domains domid - else try + end else try let ndom = Xc.with_intf (fun xc -> Domains.create xc domains domid mfn port) in Connections.add_domain cons ndom;_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 4 of 7] [OCAML] Fix a problem with ocaml xenstored
Quoted 42 lines · Ian Campbell
Quoted 5 lines · Jonathan Ludlam
Ah, that's a shame. I was hoping this was a bugfix to the ocaml xenstored and that the C version already did this. Unfortunately the patch here went in to XenServer a couple of years ago, and Thomas, who made the change, has since left. I'll dig into this and see why we depend upon it.
Seems to be CA-30927 which was "internal shutdown doesn't work anymore after VM.checkpoint":
The bugs comes from the fact that xal always assume that suspended domains are or will be soon dead.
However, for VM.checkpoint that assumptions is false, as the VM is suspended, snapshoted, and then resumed, without destroying the domain.
Thomas said in that ticket:
I fixed this issue by:
* teach to xal how to handle dead domains for suspended reasons which become suddenly alive
* when resuming a domain, use the xenstore introduce call
* modify xenstore to generates a @introduceDomain event even if the introduced domain does not existsI believe nobody care to see too many @introduceDomain event, so that will not change anything. My fix modifies the code path taken by VM.suspend, but that should be safe because xapi destroys properly the domain after suspending it.
(I think he meant _does_ exist in the third bullet). In his commit message he said:
Teach xal what to do with dead domains which become alive again.
Needed to modify xenstored as well in order to trigger a @introduceDomain event even if the introduce call tries to introduce an already existing domain. That will kick-up xal in case when resuming the domain.
Quoted 6 lines
I think possibly the right fix would have been to have xal kick-up itself. That said spurious @introduceDomain watches are pretty harmless (as he suggests) since they have no context, the recipient has to go and check it's idea of the world vs the real state to know what happened an the answer "nothing" is not a big deal...
I think you're right that the fix should go into xal. Please don't commit this particular patch; we'll keep it in our patch queue until we can fix it properly in xapi.
Jon
Quoted 44 lines
Ian.
Quoted 39 lines
Jon
Quoted 33 lines · Ian Campbell
Quoted 2 lines · Jon Ludlam
Have xenstored trigger an @introduceDomain event even if the introduce call tries to introduce an already existing domain.
The C daemon doesn't appear to behave this way. It would be nice to explain why this change is necessary.
Quoted 24 lines
Signed-off-by Thomas Gazagnaire <[email protected]>Acked-by Jon Ludlam <[email protected]>diff -r
734cb0807357-rb6022a18ebb0tools/ocaml/xenstored/process.mltools/ocaml/xenstored/process.ml +3
-2@@ -168,9 +168,10 @@ | _ -> raise Invalid_Cmd_Args; in let dom = - if Domains.exist domains domid then + if Domains.exist domains domid then begin + Connections.fire_spec_watches cons "@introduceDomain"; Domains.find domains domid - else try + end else try let ndom = Xc.with_intf (fun xc -> Domains.create xc domains domid mfn port) in Connections.add_domain cons ndom;_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 Minor makefile cleanup
In reply to Jon Ludlamtools/ocaml/Makefile.rules +5 -5
@@ -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
@@ -8,7 +8,7 @@ INTF = $(foreach obj, $(OBJS),$(obj).cmi) LIBS = eventchn.cma eventchn.cmxa -LIBS_evtchn = $(LDLIBS_libxenctrl) +LIBS_eventchn = -L$(XEN_ROOT)/tools/libxc -lxenctrl all: $(INTF) $(LIBS) $(PROGRAMS)
Re: [PATCH 5 of 7] [OCAML] Minor makefile cleanup
What does the cleanup actually do?
tools/ocaml/libs/eventchn/Makefile line 11
Quoted 9 lines · Jon Ludlam
diff -r
b6022a18ebb0-r48d4f312d069tools/ocaml/libs/eventchn/Makefiletools/ocaml/libs/eventchn/Makefile +1
-1@@ -8,7 +8,7 @@ INTF = $(foreach obj, $(OBJS),$(obj).cmi) LIBS = eventchn.cma eventchn.cmxa -LIBS_evtchn = $(LDLIBS_libxenctrl) +LIBS_eventchn = -L$(XEN_ROOT)/tools/libxc -lxenctrl
This should continue using LDLIBS_libxenctrl unless there is a good reason not too.
Quoted 8 lines
tools/ocaml/libs/eventchn/Makefile +0
-0all: $(INTF) $(LIBS) $(PROGRAMS)_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 5 of 7] [OCAML] Minor makefile cleanup
Hello,
Quoted 1 line · Ian Campbell
What does the cleanup actually do?
IIRC, the patch meant to do 2 things:
* A small improvement (in two occasions)
E.g., for make rule
lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
substitute the action part from
$(call mk-caml-lib-stubs,$$@, $$+)
to
$(call mk-caml-lib-stubs,$(1), $$+)
i.e. pass part of the target's name as the argument to mk-caml-lib-stubs instead of the whole name, so that we can avoid calling basename and sed later on to recover the sub string. I.e.,
from
$(call quiet-command, $(AR) rcs $1 $2 && $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2,MKLIB,$1)
to
$(call quiet-command, $(AR) rcs lib$(1)_stubs.a $2 && $(OCAMLMKLIB) $(LIBS_$(1)) -o $(1)_stubs $2,MKLIB,$1)
* Some correction on linking parameters for bytecode mode compilation
IIRC, it's this line that changed from
$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs, $$+)
to
$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $$+)
The former was able to produce bytecode as well, but there would be problem in dynamic loading the generated bytecode (e.g. in OCaml toplevel). The later version should work fine with the toplevel.
Quoted 5 lines
tools/ocaml/libs/eventchn/Makefile line 11
Quoted 2 lines
tools/ocaml/libs/eventchn/Makefile +1
-1-LIBS_evtchn = $(LDLIBS_libxenctrl) +LIBS_eventchn = -L$(XEN_ROOT)/tools/libxc -lxenctrlThis should continue using
LDLIBS_libxenctrlunless there is a good reason not too.
I think you are right. They are identical, only the name in the first line needs fixing, and using predefined $(LDLIBS_libxenctrl) is certainly better. The change dated back before your Makefile refactoring after Xen-4.1 and was probably a result of mix up during rebase.
Cheers
--
Zheng
PATCH 1/1 Fix 2 bit-twiddling bugs and an off-by-one
In reply to Jon LudlamThe 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
@@ -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);
Re: [PATCH 6 of 7] [OCAML] Fix 2 bit-twiddling bugs and an off-by-one
Quoted 5 lines · Jon Ludlam
The bit bugs are in ocaml vcpu affinity calls, and the off-by-one error is in the ocaml console ring code
Signed-off-by Zheng Li <[email protected]>Acked-by Jon Ludlam <[email protected]>
PATCH 1/1 Small improvement to the ocaml xenctrl library
In reply to Jon LudlamAdd a new field 'max_nr_cpus' to the physinfo type in the ocaml xc bindings
tools/ocaml/libs/xc/xc.ml +1 -0
@@ -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
@@ -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
@@ -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); }
Re: [PATCH 7 of 7] [OCAML] Small improvement to the ocaml xenctrl library
Quoted 3 lines · Jon Ludlam
Add a new field '
max_nr_cpus' to the physinfo type in the ocaml xc bindingsSigned-off-by Zheng Li <[email protected]>
Quoted 56 lines
diff -r
05ac32c3956c-rabf14d22106atools/ocaml/libs/xc/xc.mltools/ocaml/libs/xc/xc.ml +1
-0@@ -70,6 +70,7 @@ scrub_pages : nativeint; (* XXX hw_cap *) capabilities : physinfo_cap_flag list; + max_nr_cpus : int; } type version =diff -r
05ac32c3956c-rabf14d22106atools/ocaml/libs/xc/xc.mlitools/ocaml/libs/xc/xc.mli +1
-0@@ -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 = {diff -r
05ac32c3956c-rabf14d22106atools/ocaml/libs/xc/xc_stubs.ctools/ocaml/libs/xc/xc_stubs.c +3
-1@@ -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); }_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel