# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
Move Xen_cmdline module from xen-api.hg to xen-api-lib.hg
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
diff -r 55f11260c711 .hgignore
--- a/.hgignore Wed Feb 17 09:05:03 2010 +0000
+++ b/.hgignore Wed Feb 24 14:17:47 2010 +0000
@@ -15,3 +15,6 @@
^config\.status$
^configure$
doc/*
+~$
+\.rej$
+\.orig$
diff -r 55f11260c711 Makefile.in
--- a/Makefile.in Wed Feb 17 09:05:03 2010 +0000
+++ b/Makefile.in Wed Feb 24 14:17:47 2010 +0000
@@ -32,6 +32,7 @@
$(MAKE) -C forking_executioner
$(MAKE) -C mlvm
$(MAKE) -C cpuid
+ $(MAKE) -C xen-utils
.PHONY: allxen
allxen:
@@ -69,6 +70,7 @@
$(MAKE) -C forking_executioner install
$(MAKE) -C mlvm install
$(MAKE) -C cpuid install
+ $(MAKE) -C xen-utils install
installxen:
ifeq ($(HAVE_XEN),1)
@@ -105,6 +107,7 @@
$(MAKE) -C forking_executioner uninstall
$(MAKE) -C mlvm uninstall
$(MAKE) -C cpuid uninstall
+ $(MAKE) -C xen-utils uninstall
uninstallxen:
ifeq ($(HAVE_XEN),1)
@@ -164,26 +167,28 @@
$(MAKE) -C forking_executioner doc
$(MAKE) -C mlvm doc
$(MAKE) -C cpuid doc
+ $(MAKE) -C xen-utils doc
.PHONY: clean
clean:
- make -C uuid clean
- make -C camldm clean
- make -C stdext clean
- make -C log clean
- make -C stunnel clean
- make -C pciutil clean
- make -C cdrom clean
- make -C xml-light2 clean
- make -C rss clean
- make -C rpc-light clean
- make -C http-svr clean
- make -C close-and-exec clean
- make -C sexpr clean
- make -C doc clean
- make -C forking_executioner clean
- make -C mlvm clean
- make -C cpuid clean
+ $(MAKE) -C uuid clean
+ $(MAKE) -C camldm clean
+ $(MAKE) -C stdext clean
+ $(MAKE) -C log clean
+ $(MAKE) -C stunnel clean
+ $(MAKE) -C pciutil clean
+ $(MAKE) -C cdrom clean
+ $(MAKE) -C xml-light2 clean
+ $(MAKE) -C rss clean
+ $(MAKE) -C rpc-light clean
+ $(MAKE) -C http-svr clean
+ $(MAKE) -C close-and-exec clean
+ $(MAKE) -C sexpr clean
+ $(MAKE) -C doc clean
+ $(MAKE) -C forking_executioner clean
+ $(MAKE) -C mlvm clean
+ $(MAKE) -C cpuid clean
+ $(MAKE) -C xen-utils clean
cleanxen:
$(MAKE) -C mmap clean
@@ -192,3 +197,4 @@
$(MAKE) -C xs clean
$(MAKE) -C xsrpc clean
$(MAKE) -C eventchn clean
+
diff -r 55f11260c711 xen-utils/META.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen-utils/META.in Wed Feb 24 14:17:47 2010 +0000
@@ -0,0 +1,5 @@
+version = "@VERSION@"
+description = "Xen utility modules"
+requires = "stdext"
+archive(byte) = "xen-utils.cma"
+archive(native) = "xen-utils.cmxa"
diff -r 55f11260c711 xen-utils/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen-utils/Makefile Wed Feb 24 14:17:47 2010 +0000
@@ -0,0 +1,65 @@
+CC = gcc
+CFLAGS = -Wall -fPIC -O2 -I/opt/xensource/lib/ocaml -I$(XEN_ROOT)/usr/include
+OCAMLC = ocamlc -g
+OCAMLOPT = ocamlopt
+INCLUDES = -I ../stdext
+
+LDFLAGS = -cclib -L./
+
+VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0)
+OCAMLOPTFLAGS = -g -dtypes
+
+OCAMLABI := $(shell ocamlc -version)
+OCAMLLIBDIR := $(shell ocamlc -where)
+OCAMLDESTDIR ?= $(OCAMLLIBDIR)
+
+OBJS = xen_cmdline
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = xen-utils.cma xen-utils.cmxa
+
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
+all: $(INTF) $(LIBS) $(PROGRAMS)
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+xen-utils.cmxa: $(foreach obj,$(OBJS),$(obj).cmx)
+ $(OCAMLOPT) $(OCAMLOPTFLAGS) -a -o $@ $(foreach obj,$(OBJS),$(obj).cmx)
+
+xen-utils.cma: $(foreach obj,$(OBJS),$(obj).cmo)
+ $(OCAMLC) -a -o $@ $(foreach obj,$(OBJS),$(obj).cmo)
+
+%.cmo: %.ml
+ $(OCAMLC) $(INCLUDES) -c -o $@ $<
+
+%.cmi: %.mli
+ $(OCAMLC) $(INCLUDES) -c -o $@ $<
+
+%.cmx: %.ml
+ $(OCAMLOPT) $(OCAMLOPTFLAGS) $(INCLUDES) -c -o $@ $<
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+META: META.in
+ sed 's/@VERSION@/$(VERSION)/g' < $< > $@
+
+.PHONY: install
+install: path = $(DESTDIR)$(shell ocamlfind printconf destdir)
+install: $(LIBS) META
+ mkdir -p $(path)
+ ocamlfind install -destdir $(path) -ldconf ignore xen-utils META
$(INTF) $(LIBS) *.a *.cmx
+
+.PHONY: uninstall
+uninstall:
+ ocamlfind remove xen-utils
+
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "xen-utils" "package" "$(OBJS)" "."
"stdext" ""
+
+clean:
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS)
$(PROGRAMS)
+
diff -r 55f11260c711 xen-utils/xen_cmdline.ml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen-utils/xen_cmdline.ml Wed Feb 24 14:17:47 2010 +0000
@@ -0,0 +1,36 @@
+(*
+ * Copyright (C) 2006-2009 Citrix Systems Inc.
+ *
+ * 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.
+ *)
+open Stringext
+
+let xen_cmdline_script = "/opt/xensource/libexec/xen-cmdline"
+
+let call_script args =
+ try
+ let out, _ = Forkhelpers.execute_command_get_output
xen_cmdline_script args in
+ out
+ with
+ | Forkhelpers.Spawn_internal_error(stderr, stdout, Unix.WEXITED n) ->
+ failwith "Error while calling xen-cmdline script"
+
+let list_cpuid_masks () =
+ let masks = call_script ["--list-cpuid-masks"] in
+ let masks = String.split '\n' masks in
+ let masks = List.filter (fun m -> String.contains m '=') masks in
+ List.map (fun m -> match String.split '=' m with k :: [v] -> k, v | _
-> failwith ("parse error: " ^ m)) masks
+
+let set_cpuid_masks masks =
+ call_script ("--set-cpuid-masks" :: (List.map (fun (k,v) -> k ^ "=" ^
v) masks))
+
+let delete_cpuid_masks masks =
+ List.map (fun mask -> call_script ("--delete-cpuid-masks" :: [mask]))
masks
diff -r 55f11260c711 xen-utils/xen_cmdline.mli
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen-utils/xen_cmdline.mli Wed Feb 24 14:17:47 2010 +0000
@@ -0,0 +1,24 @@
+(*
+ * Copyright (C) 2006-2009 Citrix Systems Inc.
+ *
+ * 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.
+ *)
+(** Helper module to view, modify and delete Xen command-line options *)
+
+(** Gives a list of CPU feature masks currently set. *)
+val list_cpuid_masks : unit -> (string * string) list
+
+(** Sets CPU feature masks. *)
+val set_cpuid_masks : (string * string) list -> string
+
+(** Removes CPU feature masks. *)
+val delete_cpuid_masks : string list -> string list
+
xen-utils
Description: Text document
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|