diff mbox

[04/11] xenconsoled: honour XEN_LOG_DIR and remove hard-coded path

Message ID 1465477062-28805-5-git-send-email-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu June 9, 2016, 12:57 p.m. UTC
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(-)

Comments

Ian Jackson June 9, 2016, 3:47 p.m. UTC | #1
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>
diff mbox

Patch

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) {