Wei Liu (11): Config.mk: add XEN_LOG_DIR to BUILD_MAKE_VARS docs: use XEN_LOG_DIR in log file location tools: install XEN_{LOG,RUN}_DIR xenconsoled: honour XEN_LOG_DIR and remove hard-coded path xenbackendd: honour XEN_{RUN,LOG}_DIR libxc: honour XEN_LOG_DIR in xc_dom_core.c hotplug/FreeBSD: honour XEN_{LOG,RUN}_DIR hotplug/Linux: honour XEN_LOG_DIR hotplug/NetBSD: honour XEN_{LOG,RUN}_DIR libxl: honour XEN_LOG_DIR oxenstored: honour XEN_{LOG,RUN}_DIR in oxenstored.conf .gitignore | 4 ++++ Config.mk | 2 +- docs/misc/hvm-emulated-unplug.markdown | 2 +- tools/Makefile | 3 ++- tools/configure | 3 ++- tools/configure.ac | 1 + tools/console/Makefile | 5 +++++ tools/console/daemon/main.c | 3 ++- tools/hotplug/FreeBSD/rc.d/xencommons.in | 10 +++++----- tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 2 +- tools/hotplug/Linux/init.d/xencommons.in | 2 +- tools/hotplug/Linux/xen-hotplug-common.sh.in | 2 +- tools/hotplug/NetBSD/rc.d/xencommons.in | 14 +++++++------- tools/libxc/xc_dom_core.c | 3 ++- tools/libxl/libxl_utils.c | 13 +++++++------ .../xenstored/{oxenstored.conf => oxenstored.conf.in} | 6 +++--- tools/xenbackendd/Makefile | 6 +++++- tools/xenbackendd/xenbackendd.c | 6 ++++-- 18 files changed, 54 insertions(+), 33 deletions(-) rename tools/ocaml/xenstored/{oxenstored.conf => oxenstored.conf.in} (84%) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
... so that it can be turned into shell environment and exported to header files. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: George Dunlap <George.Dunlap@eu.citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Tim Deegan <tim@xen.org> Cc: Wei Liu <wei.liu2@citrix.com> --- Config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config.mk b/Config.mk index e083727..b35a13f 100644 --- a/Config.mk +++ b/Config.mk @@ -181,7 +181,7 @@ endef BUILD_MAKE_VARS := sbindir bindir LIBEXEC LIBEXEC_BIN libdir SHAREDIR \ XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \ - XEN_RUN_DIR XEN_PAGING_DIR XEN_DUMP_DIR + XEN_RUN_DIR XEN_PAGING_DIR XEN_DUMP_DIR XEN_LOG_DIR buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1))) define buildmakevars2file-closure -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: George Dunlap <George.Dunlap@eu.citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Tim Deegan <tim@xen.org> Cc: Wei Liu <wei.liu2@citrix.com> --- docs/misc/hvm-emulated-unplug.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/misc/hvm-emulated-unplug.markdown b/docs/misc/hvm-emulated-unplug.markdown index c6d1f9b..89fe14b 100644 --- a/docs/misc/hvm-emulated-unplug.markdown +++ b/docs/misc/hvm-emulated-unplug.markdown @@ -45,7 +45,7 @@ drivers): Once the drivers have checked the magic number, they can send log messages to qemu which will be logged to wherever qemu's logs go -(`/var/log/xen/qemu-dm.log` on normal Xen, dom0 syslog on XenServer). +(`$XEN_LOG_DIR/qemu-dm.log` on normal Xen, dom0 syslog on XenServer). These messages are written to IO port `0x12` a byte at a time, and are terminated by newlines. There's a fairly aggressive rate limiter on these messages, so they shouldn't be used for anything even vaguely -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> --- tools/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 6440dec..d43a229 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -61,7 +61,8 @@ build all: subdirs-all .PHONY: install install: subdirs-install $(INSTALL_DIR) -m 700 $(DESTDIR)$(XEN_DUMP_DIR) - $(INSTALL_DIR) $(DESTDIR)/var/log/xen + $(INSTALL_DIR) $(DESTDIR)$(XEN_LOG_DIR) + $(INSTALL_DIR) $(DESTDIR)$(XEN_RUN_DIR) $(INSTALL_DIR) $(DESTDIR)/var/lib/xen .PHONY: uninstall -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Make a _paths.h for xenconsoled as well and use that to generate a default path for log file directory. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> --- .gitignore | 1 + tools/console/Makefile | 5 +++++ tools/console/daemon/main.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7347801..b014509 100644 --- a/.gitignore +++ b/.gitignore @@ -111,6 +111,7 @@ tools/blktap2/vhd/vhd-util tools/console/xenconsole tools/console/xenconsoled tools/console/client/_paths.h +tools/console/daemon/_paths.h tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/* tools/debugger/gdb/gdb-6.2.1/* tools/debugger/gdb/gdb-6.2.1.tar.bz2 diff --git a/tools/console/Makefile b/tools/console/Makefile index a7bec75..c8b0300 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -22,10 +22,12 @@ clean: $(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS) $(RM) client/*.o daemon/*.o $(RM) client/_paths.h + $(RM) daemon/_paths.h .PHONY: distclean distclean: clean +daemon/main.o: daemon/_paths.h daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS) @@ -37,6 +39,9 @@ xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c)) genpath-target = $(call buildmakevars2header,client/_paths.h) $(eval $(genpath-target)) +genpath-target = $(call buildmakevars2header,daemon/_paths.h) +$(eval $(genpath-target)) + .PHONY: install install: $(BIN) $(INSTALL_DIR) $(DESTDIR)/$(sbindir) diff --git a/tools/console/daemon/main.c b/tools/console/daemon/main.c index 23860d3..20e3513 100644 --- a/tools/console/daemon/main.c +++ b/tools/console/daemon/main.c @@ -31,6 +31,7 @@ #include "utils.h" #include "io.h" +#include "_paths.h" int log_reload = 0; int log_guest = 0; @@ -176,7 +177,7 @@ int main(int argc, char **argv) } if (!log_dir) { - log_dir = strdup("/var/log/xen/console"); + log_dir = strdup(XEN_LOG_DIR "/console"); } if (geteuid() != 0) { -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Also added a gitignore entry for xenbackendd binary while I was there. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> --- .gitignore | 2 ++ tools/xenbackendd/Makefile | 6 +++++- tools/xenbackendd/xenbackendd.c | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b014509..af0e0a8 100644 --- a/.gitignore +++ b/.gitignore @@ -210,6 +210,8 @@ tools/tests/mem-sharing/memshrtool tools/tests/mce-test/tools/xen-mceinj tools/xcutils/lsevtchn tools/xcutils/readnotes +tools/xenbackendd/_paths.h +tools/xenbackendd/xenbackendd tools/xenmon/xentrace_setmask tools/xenmon/xenbaked tools/xenpaging/xenpaging diff --git a/tools/xenbackendd/Makefile b/tools/xenbackendd/Makefile index f52be74..80ac7f4 100644 --- a/tools/xenbackendd/Makefile +++ b/tools/xenbackendd/Makefile @@ -30,12 +30,16 @@ install: build .PHONY: clean clean: - $(RM) *.a *.so *.o $(DEPS) xenbackendd + $(RM) *.a *.so *.o $(DEPS) xenbackendd _paths.h .PHONY: distclean distclean: clean +xenbackendd.o: _paths.h xenbackendd: xenbackendd.o $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS) +genpath-target = $(call buildmakevars2header,_paths.h) +$(eval $(genpath-target)) + -include $(DEPS) diff --git a/tools/xenbackendd/xenbackendd.c b/tools/xenbackendd/xenbackendd.c index e21464b..b6d9298 100644 --- a/tools/xenbackendd/xenbackendd.c +++ b/tools/xenbackendd/xenbackendd.c @@ -29,6 +29,8 @@ #include <xenstore.h> +#include "_paths.h" + #define DEVTYPE_UNKNOWN 0 #define DEVTYPE_VIF 1 #define DEVTYPE_VBD 2 @@ -44,10 +46,10 @@ #define VBD_SCRIPT XEN_SCRIPT_DIR"/block" #endif #ifndef LOG_FILE -#define LOG_FILE "/var/log/xen/xenbackendd.log" +#define LOG_FILE XEN_LOG_DIR "xenbackendd.log" #endif #ifndef PID_FILE -#define PID_FILE "/var/run/xenbackendd.pid" +#define PID_FILE XEN_RUN_DIR "xenbackendd.pid" #endif -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> --- tools/libxc/xc_dom_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c index 55c779d..ebada89 100644 --- a/tools/libxc/xc_dom_core.c +++ b/tools/libxc/xc_dom_core.c @@ -33,13 +33,14 @@ #include "xg_private.h" #include "xc_dom.h" +#include "_paths.h" /* ------------------------------------------------------------------------ */ /* debugging */ -static const char *default_logfile = "/var/log/xen/domain-builder-ng.log"; +static const char *default_logfile = XEN_LOG_DIR "/domain-builder-ng.log"; int xc_dom_loginit(xc_interface *xch) { if (xch->dombuild_logger) return 0; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Roger Pau Monné <roger.pau@citrix.com> --- tools/hotplug/FreeBSD/rc.d/xencommons.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/hotplug/FreeBSD/rc.d/xencommons.in b/tools/hotplug/FreeBSD/rc.d/xencommons.in index d453c6b..2f9e1ec 100644 --- a/tools/hotplug/FreeBSD/rc.d/xencommons.in +++ b/tools/hotplug/FreeBSD/rc.d/xencommons.in @@ -18,10 +18,10 @@ status_cmd="xen_status" extra_commands="status" required_files="/dev/xen/privcmd" -XENSTORED_PIDFILE="/var/run/xenstored.pid" -XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid" -#XENCONSOLED_TRACE="/var/log/xen/xenconsole-trace.log" -#XENSTORED_TRACE="/var/log/xen/xenstore-trace.log" +XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid" +XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid" +#XENCONSOLED_TRACE="@XEN_LOG_DIR@/xenconsole-trace.log" +#XENSTORED_TRACE="@XEN_LOG_DIR@/xen/xenstore-trace.log" xen_precmd() { @@ -43,7 +43,7 @@ xen_startcmd() printf "Starting xenservices: xenstored, xenconsoled." XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}" if [ -n "${XENSTORED_TRACE}" ]; then - XENSTORED_ARGS="${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace.log" + XENSTORED_ARGS="${XENSTORED_ARGS} -T @XEN_LOG_DIR@/xenstored-trace.log" fi ${sbindir}/xenstored ${XENSTORED_ARGS} while [ $time -lt $timeout ] && ! `${bindir}/xenstore-read -s / >/dev/null 2>&1` ; do -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Roger Pau Monné <roger.pau@citrix.com> --- tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 2 +- tools/hotplug/Linux/init.d/xencommons.in | 2 +- tools/hotplug/Linux/xen-hotplug-common.sh.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in index acc7309..c27a476 100644 --- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in +++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in @@ -24,7 +24,7 @@ ## Default: "" # # Additional commandline arguments to start xenstored, -# like "--trace-file /var/log/xen/xenstored-trace.log" +# like "--trace-file @XEN_LOG_DIR@/xenstored-trace.log" # See "@sbindir@/xenstored --help" for possible options. XENSTORED_ARGS= diff --git a/tools/hotplug/Linux/init.d/xencommons.in b/tools/hotplug/Linux/init.d/xencommons.in index eeac8ab..7b69fc2 100644 --- a/tools/hotplug/Linux/init.d/xencommons.in +++ b/tools/hotplug/Linux/init.d/xencommons.in @@ -66,7 +66,7 @@ do_start () { then test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="@XEN_LIB_STORED@" rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null - test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log" + test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T @XEN_LOG_DIR@/xenstored-trace.log" if [ -n "$XENSTORED" ] ; then echo -n Starting $XENSTORED... diff --git a/tools/hotplug/Linux/xen-hotplug-common.sh.in b/tools/hotplug/Linux/xen-hotplug-common.sh.in index d5d0b69..8c2cb9e 100644 --- a/tools/hotplug/Linux/xen-hotplug-common.sh.in +++ b/tools/hotplug/Linux/xen-hotplug-common.sh.in @@ -20,7 +20,7 @@ dir=$(dirname "$0") . "$dir/xen-script-common.sh" . "$dir/locking.sh" -exec 2>>/var/log/xen/xen-hotplug.log +exec 2>>@XEN_LOG_DIR@/xen-hotplug.log export PATH="${bindir}:${sbindir}:${LIBEXEC_BIN}:/sbin:/bin:/usr/bin:/usr/sbin:$PATH" export LD_LIBRARY_PATH="${libdir}${LD_LIBRARY_PATH+:}$LD_LIBRARY_PATH" -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Roger Pau Monné <roger.pau@citrix.com> --- tools/hotplug/NetBSD/rc.d/xencommons.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/hotplug/NetBSD/rc.d/xencommons.in b/tools/hotplug/NetBSD/rc.d/xencommons.in index d7552cd..886a2e2 100644 --- a/tools/hotplug/NetBSD/rc.d/xencommons.in +++ b/tools/hotplug/NetBSD/rc.d/xencommons.in @@ -20,16 +20,16 @@ status_cmd="xen_status" extra_commands="status" required_files="/kern/xen/privcmd" -XENSTORED_PIDFILE="/var/run/xenstored.pid" -XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid" -XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid" +XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid" +XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid" +XENBACKENDD_PIDFILE="@XEN_RUN_DIR@/xenbackendd.pid" #XENBACKENDD_DEBUG=1 -#XENCONSOLED_TRACE="/var/log/xen/xenconsole-trace.log" -#XENSTORED_TRACE="/var/log/xen/xenstore-trace.log" +#XENCONSOLED_TRACE="@XEN_LOG_DIR@/xenconsole-trace.log" +#XENSTORED_TRACE="@XEN_LOG_DIR@/xenstore-trace.log" xen_precmd() { - mkdir -p /var/run/xenstored || exit 1 + mkdir -p @XEN_RUN_DIR@/xenstored || exit 1 } xen_startcmd() @@ -47,7 +47,7 @@ xen_startcmd() printf "Starting xenservices: xenstored, xenconsoled." XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}" if [ -n "${XENSTORED_TRACE}" ]; then - XENSTORED_ARGS="${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace.log" + XENSTORED_ARGS="${XENSTORED_ARGS} -T @XEN_LOG_DIR@/xenstored-trace.log" fi ${sbindir}/xenstored ${XENSTORED_ARGS} while [ $time -lt $timeout ] && ! `${bindir}/xenstore-read -s / >/dev/null 2>&1` ; do -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> --- tools/libxl/libxl_utils.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 4ca6bcb..6108d4b 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -18,6 +18,7 @@ #include <ctype.h> #include "libxl_internal.h" +#include "_paths.h" #ifndef LIBXL_HAVE_NONCONST_LIBXL_BASENAME_RETURN_VALUE const @@ -261,20 +262,20 @@ int libxl_create_logfile(libxl_ctx *ctx, const char *name, char **full_name) char *logfile, *logfile_new; int i, rc; - logfile = GCSPRINTF("/var/log/xen/%s.log", name); + logfile = GCSPRINTF(XEN_LOG_DIR "/%s.log", name); if (stat(logfile, &stat_buf) == 0) { /* file exists, rotate */ - logfile = GCSPRINTF("/var/log/xen/%s.log.10", name); + logfile = GCSPRINTF(XEN_LOG_DIR "/%s.log.10", name); unlink(logfile); for (i = 9; i > 0; i--) { - logfile = GCSPRINTF("/var/log/xen/%s.log.%d", name, i); - logfile_new = GCSPRINTF("/var/log/xen/%s.log.%d", name, i + 1); + logfile = GCSPRINTF(XEN_LOG_DIR "/%s.log.%d", name, i); + logfile_new = GCSPRINTF(XEN_LOG_DIR "/%s.log.%d", name, i + 1); rc = logrename(gc, logfile, logfile_new); if (rc) goto out; } - logfile = GCSPRINTF("/var/log/xen/%s.log", name); - logfile_new = GCSPRINTF("/var/log/xen/%s.log.1", name); + logfile = GCSPRINTF(XEN_LOG_DIR "/%s.log", name); + logfile_new = GCSPRINTF(XEN_LOG_DIR "/%s.log.1", name); rc = logrename(gc, logfile, logfile_new); if (rc) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Generate oxenstored.conf with configure. This involves modifying tools/configure.ac and rerun autogen.sh. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: David Scott <dave@recoil.org> There are two hard-coded paths in logging.ml, but I'm not sure if generate an ocaml _Path module is the right thing to do. --- .gitignore | 1 + tools/configure | 3 ++- tools/configure.ac | 1 + tools/ocaml/xenstored/{oxenstored.conf => oxenstored.conf.in} | 6 +++--- 4 files changed, 7 insertions(+), 4 deletions(-) rename tools/ocaml/xenstored/{oxenstored.conf => oxenstored.conf.in} (84%) diff --git a/.gitignore b/.gitignore index af0e0a8..39deb2d 100644 --- a/.gitignore +++ b/.gitignore @@ -346,6 +346,7 @@ tools/ocaml/libs/xentoollog/_xtl_levels.* tools/ocaml/libs/xentoollog/xentoollog.ml tools/ocaml/libs/xentoollog/xentoollog.mli tools/ocaml/xenstored/oxenstored +tools/ocaml/xenstored/oxenstored.conf tools/ocaml/test/xtl tools/ocaml/test/send_debug_keys tools/ocaml/test/list_domains diff --git a/tools/configure b/tools/configure index a80f132..42e07a6 100755 --- a/tools/configure +++ b/tools/configure @@ -2408,7 +2408,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in" +ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in ocaml/xenstored/oxenstored.conf" ac_config_headers="$ac_config_headers config.h" @@ -10374,6 +10374,7 @@ do "hotplug/NetBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xendriverdomain" ;; "libxl/xenlight.pc.in") CONFIG_FILES="$CONFIG_FILES libxl/xenlight.pc.in" ;; "libxl/xlutil.pc.in") CONFIG_FILES="$CONFIG_FILES libxl/xlutil.pc.in" ;; + "ocaml/xenstored/oxenstored.conf") CONFIG_FILES="$CONFIG_FILES ocaml/xenstored/oxenstored.conf" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "hotplug/Linux/systemd/proc-xen.mount") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/proc-xen.mount" ;; "hotplug/Linux/systemd/var-lib-xenstored.mount") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/var-lib-xenstored.mount" ;; diff --git a/tools/configure.ac b/tools/configure.ac index d0c9e63..2e5c95c 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -21,6 +21,7 @@ hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in +ocaml/xenstored/oxenstored.conf ]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([../]) diff --git a/tools/ocaml/xenstored/oxenstored.conf b/tools/ocaml/xenstored/oxenstored.conf.in similarity index 84% rename from tools/ocaml/xenstored/oxenstored.conf rename to tools/ocaml/xenstored/oxenstored.conf.in index ac60f49..82117a9 100644 --- a/tools/ocaml/xenstored/oxenstored.conf +++ b/tools/ocaml/xenstored/oxenstored.conf.in @@ -1,7 +1,7 @@ # default xenstored config # Where the pid file is stored -pid-file = /var/run/xenstored.pid +pid-file = @XEN_RUN_DIR@/xenstored.pid # Randomly failed a transaction with EAGAIN. Used for testing Xs user test-eagain = false @@ -24,12 +24,12 @@ quota-maxrequests = 1024 persistent = false # Xenstored logs -# xenstored-log-file = /var/log/xenstored.log +# xenstored-log-file = @XEN_LOG_DIR@/xenstored.log # xenstored-log-level = null # xenstored-log-nb-files = 10 # Xenstored access logs -# access-log-file = /var/log/xenstored-access.log +# access-log-file = @XEN_LOG_DIR@/xenstored-access.log # access-log-nb-lines = 13215 # acesss-log-nb-chars = 180 # access-log-special-ops = false -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On 09/06/16 13:57, Wei Liu wrote: > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > --- > tools/Makefile | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/Makefile b/tools/Makefile > index 6440dec..d43a229 100644 > --- a/tools/Makefile > +++ b/tools/Makefile > @@ -61,7 +61,8 @@ build all: subdirs-all > .PHONY: install > install: subdirs-install > $(INSTALL_DIR) -m 700 $(DESTDIR)$(XEN_DUMP_DIR) > - $(INSTALL_DIR) $(DESTDIR)/var/log/xen > + $(INSTALL_DIR) $(DESTDIR)$(XEN_LOG_DIR) > + $(INSTALL_DIR) $(DESTDIR)$(XEN_RUN_DIR) > $(INSTALL_DIR) $(DESTDIR)/var/lib/xen Looking at a `git grep`, /var/lib/xen is another path in need of a name and less hard coding. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On 09/06/16 13:57, Wei Liu wrote: > Wei Liu (11): > Config.mk: add XEN_LOG_DIR to BUILD_MAKE_VARS > docs: use XEN_LOG_DIR in log file location > tools: install XEN_{LOG,RUN}_DIR > xenconsoled: honour XEN_LOG_DIR and remove hard-coded path > xenbackendd: honour XEN_{RUN,LOG}_DIR > libxc: honour XEN_LOG_DIR in xc_dom_core.c > hotplug/FreeBSD: honour XEN_{LOG,RUN}_DIR > hotplug/Linux: honour XEN_LOG_DIR > hotplug/NetBSD: honour XEN_{LOG,RUN}_DIR I appear to be missing patches 10 and 11, so can't comment on them yet, but Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> for 1..9 ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 02:13:23PM +0100, Andrew Cooper wrote: > On 09/06/16 13:57, Wei Liu wrote: > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > > --- > > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > > --- > > tools/Makefile | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tools/Makefile b/tools/Makefile > > index 6440dec..d43a229 100644 > > --- a/tools/Makefile > > +++ b/tools/Makefile > > @@ -61,7 +61,8 @@ build all: subdirs-all > > .PHONY: install > > install: subdirs-install > > $(INSTALL_DIR) -m 700 $(DESTDIR)$(XEN_DUMP_DIR) > > - $(INSTALL_DIR) $(DESTDIR)/var/log/xen > > + $(INSTALL_DIR) $(DESTDIR)$(XEN_LOG_DIR) > > + $(INSTALL_DIR) $(DESTDIR)$(XEN_RUN_DIR) > > $(INSTALL_DIR) $(DESTDIR)/var/lib/xen > > Looking at a `git grep`, /var/lib/xen is another path in need of a name > and less hard coding. > Yeah, I started off only looking at /var/log/xen and found issues with XEN_RUN_DIR as well. The one you mentioned doesn't seem to have a XEN_*_DIR set, so I left it untouched. I have it on my list already. Wei. > ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 01:57:39PM +0100, Wei Liu wrote: > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 01:57:38PM +0100, Wei Liu wrote: > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 01:57:40PM +0100, Wei Liu wrote: > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Thanks! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 10/11] libxl: honour XEN_LOG_DIR"): > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 01/11] Config.mk: add XEN_LOG_DIR to BUILD_MAKE_VARS"): > ... so that it can be turned into shell environment and exported to > header files. Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 02/11] docs: use XEN_LOG_DIR in log file location"): > Signed-off-by: Wei Liu <wei.liu2@citrix.com> ... > diff --git a/docs/misc/hvm-emulated-unplug.markdown b/docs/misc/hvm-emulated-unplug.markdown > index c6d1f9b..89fe14b 100644 > --- a/docs/misc/hvm-emulated-unplug.markdown > +++ b/docs/misc/hvm-emulated-unplug.markdown > @@ -45,7 +45,7 @@ drivers): > > Once the drivers have checked the magic number, they can send log > messages to qemu which will be logged to wherever qemu's logs go > -(`/var/log/xen/qemu-dm.log` on normal Xen, dom0 syslog on XenServer). > +(`$XEN_LOG_DIR/qemu-dm.log` on normal Xen, dom0 syslog on XenServer). > These messages are written to IO port `0x12` a byte at a time, and are > terminated by newlines. There's a fairly aggressive rate limiter on > these messages, so they shouldn't be used for anything even vaguely I'm not a big fan of this kind of abstracted-away documentation. (I think writing this in the markdown does not cause substitution.) IMO it's better to have a concrete path which is right in almost all cases, even if it is sometimes wrong. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 03/11] tools: install XEN_{LOG,RUN}_DIR"): > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 04/11] xenconsoled: honour XEN_LOG_DIR and remove hard-coded path"): > Make a _paths.h for xenconsoled as well and use that to generate a > default path for log file directory. Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 05/11] xenbackendd: honour XEN_{RUN,LOG}_DIR"): > Also added a gitignore entry for xenbackendd binary while I was there. Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 06/11] libxc: honour XEN_LOG_DIR in xc_dom_core.c"): > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 07/11] hotplug/FreeBSD: honour XEN_{LOG,RUN}_DIR"): > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 08/11] hotplug/Linux: honour XEN_LOG_DIR"): > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 09/11] hotplug/NetBSD: honour XEN_{LOG,RUN}_DIR"): > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 04:47:17PM +0100, Ian Jackson wrote: > Wei Liu writes ("[PATCH 02/11] docs: use XEN_LOG_DIR in log file location"): > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > ... > > diff --git a/docs/misc/hvm-emulated-unplug.markdown b/docs/misc/hvm-emulated-unplug.markdown > > index c6d1f9b..89fe14b 100644 > > --- a/docs/misc/hvm-emulated-unplug.markdown > > +++ b/docs/misc/hvm-emulated-unplug.markdown > > @@ -45,7 +45,7 @@ drivers): > > > > Once the drivers have checked the magic number, they can send log > > messages to qemu which will be logged to wherever qemu's logs go > > -(`/var/log/xen/qemu-dm.log` on normal Xen, dom0 syslog on XenServer). > > +(`$XEN_LOG_DIR/qemu-dm.log` on normal Xen, dom0 syslog on XenServer). > > These messages are written to IO port `0x12` a byte at a time, and are > > terminated by newlines. There's a fairly aggressive rate limiter on > > these messages, so they shouldn't be used for anything even vaguely > > I'm not a big fan of this kind of abstracted-away documentation. (I > think writing this in the markdown does not cause substitution.) IMO > it's better to have a concrete path which is right in almost all > cases, even if it is sometimes wrong. Correct, it is not substituted. I will drop this one. Wei. > > Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH 11/11] oxenstored: honour XEN_{LOG,RUN}_DIR in oxenstored.conf"): > Generate oxenstored.conf with configure. This involves modifying > tools/configure.ac and rerun autogen.sh. > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: David Scott <dave@recoil.org> You should mention that autogen.sh should be rerun. Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> > There are two hard-coded paths in logging.ml, but I'm not sure if > generate an ocaml _Path module is the right thing to do. I would be interested to hear Dave's opinion. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
There is also some /var/run hardcoded in here: tools/hotplug/Linux/systemd/xenstored.socket.in tools/hotplug/Linux/systemd/xenstored_ro.socket.in -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 05:53:09PM +0100, Anthony PERARD wrote: > There is also some /var/run hardcoded in here: > tools/hotplug/Linux/systemd/xenstored.socket.in > tools/hotplug/Linux/systemd/xenstored_ro.socket.in Thanks. I will send out follow-up patches for that. Wei. > > > -- > Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
> On 9 Jun 2016, at 16:51, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote: > > Wei Liu writes ("[PATCH 11/11] oxenstored: honour XEN_{LOG,RUN}_DIR in oxenstored.conf"): >> Generate oxenstored.conf with configure. This involves modifying >> tools/configure.ac and rerun autogen.sh. >> >> Signed-off-by: Wei Liu <wei.liu2@citrix.com> >> --- >> Cc: Ian Jackson <ian.jackson@eu.citrix.com> >> Cc: David Scott <dave@recoil.org> > > You should mention that autogen.sh should be rerun. > > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> > >> There are two hard-coded paths in logging.ml, but I'm not sure if >> generate an ocaml _Path module is the right thing to do. > > I would be interested to hear Dave's opinion. For reference the paths are: let xenstored_log_destination = ref (File "/var/log/xenstored.log") let access_log_destination = ref (File "/var/log/xenstored-access.log”) These correspond to the command line arguments: ("access-log-file", Config.String Logging.set_access_log_destination); ("xenstored-log-file", Config.String Logging.set_xenstored_log_destination); I think if you want to remove these paths completely from the binary then generating a simple module would be fine. I guess other options would be - make the paths into optional values, default to None, and interpret None as “don’t bother logging”. Might not be a good idea to encourage people to turn off logging though. - make it mandatory to set the paths via the config file? I don’t have a strong opinion though :-) Cheers, Dave _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 09:38:55PM +0100, David Scott wrote: > > > On 9 Jun 2016, at 16:51, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote: > > > > Wei Liu writes ("[PATCH 11/11] oxenstored: honour XEN_{LOG,RUN}_DIR in oxenstored.conf"): > >> Generate oxenstored.conf with configure. This involves modifying > >> tools/configure.ac and rerun autogen.sh. > >> > >> Signed-off-by: Wei Liu <wei.liu2@citrix.com> > >> --- > >> Cc: Ian Jackson <ian.jackson@eu.citrix.com> > >> Cc: David Scott <dave@recoil.org> > > > > You should mention that autogen.sh should be rerun. > > > > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> > > > >> There are two hard-coded paths in logging.ml, but I'm not sure if > >> generate an ocaml _Path module is the right thing to do. > > > > I would be interested to hear Dave's opinion. > > For reference the paths are: > > let xenstored_log_destination = ref (File "/var/log/xenstored.log") > let access_log_destination = ref (File "/var/log/xenstored-access.log”) > > These correspond to the command line arguments: > > ("access-log-file", Config.String Logging.set_access_log_destination); > ("xenstored-log-file", Config.String Logging.set_xenstored_log_destination); > > I think if you want to remove these paths completely from the binary then generating a simple module would be fine. I guess other options would be > > - make the paths into optional values, default to None, and interpret None as “don’t bother logging”. Might not be a good idea to encourage people to turn off logging though. > - make it mandatory to set the paths via the config file? > > I don’t have a strong opinion though :-) > I think having a module generated is the best solution. That's something for another day though because my OCaml skill is pretty rusty now. Wei. > Cheers, > Dave _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Thu, Jun 09, 2016 at 09:38:55PM +0100, David Scott wrote: > > > On 9 Jun 2016, at 16:51, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote: > > > > Wei Liu writes ("[PATCH 11/11] oxenstored: honour XEN_{LOG,RUN}_DIR in oxenstored.conf"): > >> Generate oxenstored.conf with configure. This involves modifying > >> tools/configure.ac and rerun autogen.sh. > >> > >> Signed-off-by: Wei Liu <wei.liu2@citrix.com> > >> --- > >> Cc: Ian Jackson <ian.jackson@eu.citrix.com> > >> Cc: David Scott <dave@recoil.org> > > > > You should mention that autogen.sh should be rerun. > > > > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> > > > >> There are two hard-coded paths in logging.ml, but I'm not sure if > >> generate an ocaml _Path module is the right thing to do. > > > > I would be interested to hear Dave's opinion. > > For reference the paths are: > > let xenstored_log_destination = ref (File "/var/log/xenstored.log") > let access_log_destination = ref (File "/var/log/xenstored-access.log”) > > These correspond to the command line arguments: > > ("access-log-file", Config.String Logging.set_access_log_destination); > ("xenstored-log-file", Config.String Logging.set_xenstored_log_destination); > > I think if you want to remove these paths completely from the binary then generating a simple module would be fine. I guess other options would be > > - make the paths into optional values, default to None, and interpret None as “don’t bother logging”. Might not be a good idea to encourage people to turn off logging though. > - make it mandatory to set the paths via the config file? > > I don’t have a strong opinion though :-) > I think this patch also requires an ack from you because this is under the ocaml directory. I've hold off pushing this one. Wei. > Cheers, > Dave _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
This is the first attempt to address the problem properly. More patches will follow after we agree on how to proceed. Wei. Wei Liu (2): oxenstored: generate a paths module oxenstored: honour XEN_LOG_DIR defined by configure .gitignore | 1 + tools/ocaml/Makefile.rules | 11 +++++++++++ tools/ocaml/xenstored/Makefile | 6 ++++++ tools/ocaml/xenstored/logging.ml | 4 ++-- 4 files changed, 20 insertions(+), 2 deletions(-) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
That file includes all paths generated by configure. It will be used to get rid of hard-coded paths in code. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: David Scot <dave@recoil.org> The paths module is the first one in object list so that it gets built first. This seems to be the practice for managing dependency in oxenstored? --- .gitignore | 1 + tools/ocaml/Makefile.rules | 11 +++++++++++ tools/ocaml/xenstored/Makefile | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/.gitignore b/.gitignore index 1494c58..8e0a177 100644 --- a/.gitignore +++ b/.gitignore @@ -350,6 +350,7 @@ tools/ocaml/libs/xentoollog/xentoollog.ml tools/ocaml/libs/xentoollog/xentoollog.mli tools/ocaml/xenstored/oxenstored tools/ocaml/xenstored/oxenstored.conf +tools/ocaml/xenstored/paths.ml tools/ocaml/test/xtl tools/ocaml/test/send_debug_keys tools/ocaml/test/list_domains diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules index 1796060..a893c42 100644 --- a/tools/ocaml/Makefile.rules +++ b/tools/ocaml/Makefile.rules @@ -95,3 +95,14 @@ $(foreach lib,$(OCAML_LIBRARY),$(eval $(call OCAML_LIBRARY_template,$(lib)))) $(foreach lib,$(OCAML_NOC_LIBRARY),$(eval $(call OCAML_NOC_LIBRARY_template,$(lib)))) $(foreach p,$(OCAML_PROGRAM),$(eval $(call OCAML_PROGRAM_template,$(p)))) $(foreach p,$(C_PROGRAM),$(eval $(call C_PROGRAM_template,$(p)))) + +buildmakevars2module = $(eval $(call buildmakevars2module-closure,$(1))) +define buildmakevars2module-closure + $(1): .phony + rm -f $(1).tmp; \ + $(foreach var, $(BUILD_MAKE_VARS), \ + printf "let %s = \"%s\";;\n" \ + $(shell echo $(var) | tr '[:upper:]' '[:lower:]') \ + $($(var)) >>$(1).tmp;) \ + $(call move-if-changed,$(1).tmp,$(1)) +endef diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile index dce9e70..40aa288 100644 --- a/tools/ocaml/xenstored/Makefile +++ b/tools/ocaml/xenstored/Makefile @@ -33,6 +33,7 @@ OCAML_LIBRARY += systemd LIBS_systemd += $(LDFLAGS-y) OBJS = define \ + paths \ stdext \ trie \ config \ @@ -87,3 +88,8 @@ install: all $(INSTALL_DATA) oxenstored.conf $(DESTDIR)$(XEN_CONFIG_DIR) include $(OCAML_TOPLEVEL)/Makefile.rules + +genpath-target = $(call buildmakevars2module,paths.ml) +$(eval $(genpath-target)) + +GENERATED_FILES += paths.ml -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
We generate a corresponding constant (in lower case) in paths.ml. Use that in source code to get rid of hard-coded path. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: David Scot <dave.scot@recoil.org> --- tools/ocaml/xenstored/logging.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml index 4c90032..d05b2d4 100644 --- a/tools/ocaml/xenstored/logging.ml +++ b/tools/ocaml/xenstored/logging.ml @@ -154,7 +154,7 @@ let make_syslog_logger facility = Syslog.log facility level s in { stop = nothing; restart = nothing; rotate = nothing; write=write } -let xenstored_log_destination = ref (File "/var/log/xenstored.log") +let xenstored_log_destination = ref (File (String.concat "" [Paths.xen_log_dir; "/xenstored.log"])) let xenstored_log_level = ref Warn let xenstored_log_nb_files = ref 10 let xenstored_log_nb_lines = ref 13215 @@ -262,7 +262,7 @@ let sanitize_data data = String.escaped data let activate_access_log = ref true -let access_log_destination = ref (File "/var/log/xenstored-access.log") +let access_log_destination = ref (File (String.concat "" [Paths.xen_log_dir; "/xenstored-access.log"])) let access_log_nb_files = ref 20 let access_log_nb_lines = ref 13215 let access_log_nb_chars = ref 180 -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
CC Dave's correct email address. On Fri, Jun 10, 2016 at 03:25:46PM +0100, Wei Liu wrote: > We generate a corresponding constant (in lower case) in paths.ml. Use > that in source code to get rid of hard-coded path. > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: David Scot <dave.scot@recoil.org> > --- > tools/ocaml/xenstored/logging.ml | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml > index 4c90032..d05b2d4 100644 > --- a/tools/ocaml/xenstored/logging.ml > +++ b/tools/ocaml/xenstored/logging.ml > @@ -154,7 +154,7 @@ let make_syslog_logger facility = > Syslog.log facility level s in > { stop = nothing; restart = nothing; rotate = nothing; write=write } > > -let xenstored_log_destination = ref (File "/var/log/xenstored.log") > +let xenstored_log_destination = ref (File (String.concat "" [Paths.xen_log_dir; "/xenstored.log"])) > let xenstored_log_level = ref Warn > let xenstored_log_nb_files = ref 10 > let xenstored_log_nb_lines = ref 13215 > @@ -262,7 +262,7 @@ let sanitize_data data = > String.escaped data > > let activate_access_log = ref true > -let access_log_destination = ref (File "/var/log/xenstored-access.log") > +let access_log_destination = ref (File (String.concat "" [Paths.xen_log_dir; "/xenstored-access.log"])) > let access_log_nb_files = ref 20 > let access_log_nb_lines = ref 13215 > let access_log_nb_chars = ref 180 > -- > 2.1.4 > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Hi, Rather than (String.concat “” [a; b]) it’s simpler to write (a ^ b) With that small change, Acked-by: David Scott <dave@recoil.org> Cheers, Dave > On 10 Jun 2016, at 19:44, Wei Liu <wei.liu2@citrix.com> wrote: > > CC Dave's correct email address. > > On Fri, Jun 10, 2016 at 03:25:46PM +0100, Wei Liu wrote: >> We generate a corresponding constant (in lower case) in paths.ml. Use >> that in source code to get rid of hard-coded path. >> >> Signed-off-by: Wei Liu <wei.liu2@citrix.com> >> --- >> Cc: Ian Jackson <ian.jackson@eu.citrix.com> >> Cc: David Scot <dave.scot@recoil.org> >> --- >> tools/ocaml/xenstored/logging.ml | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml >> index 4c90032..d05b2d4 100644 >> --- a/tools/ocaml/xenstored/logging.ml >> +++ b/tools/ocaml/xenstored/logging.ml >> @@ -154,7 +154,7 @@ let make_syslog_logger facility = >> Syslog.log facility level s in >> { stop = nothing; restart = nothing; rotate = nothing; write=write } >> >> -let xenstored_log_destination = ref (File "/var/log/xenstored.log") >> +let xenstored_log_destination = ref (File (String.concat "" [Paths.xen_log_dir; "/xenstored.log"])) >> let xenstored_log_level = ref Warn >> let xenstored_log_nb_files = ref 10 >> let xenstored_log_nb_lines = ref 13215 >> @@ -262,7 +262,7 @@ let sanitize_data data = >> String.escaped data >> >> let activate_access_log = ref true >> -let access_log_destination = ref (File "/var/log/xenstored-access.log") >> +let access_log_destination = ref (File (String.concat "" [Paths.xen_log_dir; "/xenstored-access.log"])) >> let access_log_nb_files = ref 20 >> let access_log_nb_lines = ref 13215 >> let access_log_nb_chars = ref 180 >> -- >> 2.1.4 >> > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Looks fine to me: Acked-by: David Scott <dave@recoil.org> > On 10 Jun 2016, at 15:25, Wei Liu <wei.liu2@citrix.com> wrote: > > That file includes all paths generated by configure. It will be used to > get rid of hard-coded paths in code. > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: David Scot <dave@recoil.org> > > The paths module is the first one in object list so that it gets built > first. This seems to be the practice for managing dependency in > oxenstored? > --- > .gitignore | 1 + > tools/ocaml/Makefile.rules | 11 +++++++++++ > tools/ocaml/xenstored/Makefile | 6 ++++++ > 3 files changed, 18 insertions(+) > > diff --git a/.gitignore b/.gitignore > index 1494c58..8e0a177 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -350,6 +350,7 @@ tools/ocaml/libs/xentoollog/xentoollog.ml > tools/ocaml/libs/xentoollog/xentoollog.mli > tools/ocaml/xenstored/oxenstored > tools/ocaml/xenstored/oxenstored.conf > +tools/ocaml/xenstored/paths.ml > tools/ocaml/test/xtl > tools/ocaml/test/send_debug_keys > tools/ocaml/test/list_domains > diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules > index 1796060..a893c42 100644 > --- a/tools/ocaml/Makefile.rules > +++ b/tools/ocaml/Makefile.rules > @@ -95,3 +95,14 @@ $(foreach lib,$(OCAML_LIBRARY),$(eval $(call OCAML_LIBRARY_template,$(lib)))) > $(foreach lib,$(OCAML_NOC_LIBRARY),$(eval $(call OCAML_NOC_LIBRARY_template,$(lib)))) > $(foreach p,$(OCAML_PROGRAM),$(eval $(call OCAML_PROGRAM_template,$(p)))) > $(foreach p,$(C_PROGRAM),$(eval $(call C_PROGRAM_template,$(p)))) > + > +buildmakevars2module = $(eval $(call buildmakevars2module-closure,$(1))) > +define buildmakevars2module-closure > + $(1): .phony > + rm -f $(1).tmp; \ > + $(foreach var, $(BUILD_MAKE_VARS), \ > + printf "let %s = \"%s\";;\n" \ > + $(shell echo $(var) | tr '[:upper:]' '[:lower:]') \ > + $($(var)) >>$(1).tmp;) \ > + $(call move-if-changed,$(1).tmp,$(1)) > +endef > diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile > index dce9e70..40aa288 100644 > --- a/tools/ocaml/xenstored/Makefile > +++ b/tools/ocaml/xenstored/Makefile > @@ -33,6 +33,7 @@ OCAML_LIBRARY += systemd > LIBS_systemd += $(LDFLAGS-y) > > OBJS = define \ > + paths \ > stdext \ > trie \ > config \ > @@ -87,3 +88,8 @@ install: all > $(INSTALL_DATA) oxenstored.conf $(DESTDIR)$(XEN_CONFIG_DIR) > > include $(OCAML_TOPLEVEL)/Makefile.rules > + > +genpath-target = $(call buildmakevars2module,paths.ml) > +$(eval $(genpath-target)) > + > +GENERATED_FILES += paths.ml > -- > 2.1.4 > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Fri, Jun 10, 2016 at 09:26:05PM +0100, David Scott wrote: > Hi, > > Rather than > > (String.concat “” [a; b]) > > it’s simpler to write > > (a ^ b) > > With that small change, > Indeed, this looks better. I will update the patch accordingly. > Acked-by: David Scott <dave@recoil.org> Thanks! Wei. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel