# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1272566332 -3600
# Node ID a167ea374f26ed06c7dd518599e202822e26ef97
# Parent 9a1d7caa20246f89bf7395131483f44e686bd9cd
libxl: Expose build-time install paths inside libxl.
Use this to construct the fully-qualified path to xenconsole.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
.hgignore | 1
tools/libxl/Makefile | 13 +++++++--
tools/libxl/libxl.c | 13 ++-------
tools/libxl/libxl_internal.h | 11 +++++++
tools/libxl/libxl_paths.c | 61 +++++++++++++++++++++++++++++++++++++++++++
5 files changed, 87 insertions(+), 12 deletions(-)
diff -r 9a1d7caa2024 -r a167ea374f26 .hgignore
--- a/.hgignore Mon Apr 26 12:13:23 2010 +0100
+++ b/.hgignore Thu Apr 29 19:38:52 2010 +0100
@@ -180,6 +180,7 @@
^tools/libxen/libxenapi-
^tools/libxen/test/test_bindings$
^tools/libxen/test/test_event_handling$
+^tools/libxl/_.*\.h$
^tools/libxl/libxlu_cfg_y\.output$
^tools/libxl/xl$
^tools/libaio/src/.*\.ol$
diff -r 9a1d7caa2024 -r a167ea374f26 tools/libxl/Makefile
--- a/tools/libxl/Makefile Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/libxl/Makefile Thu Apr 29 19:38:52 2010 +0100
@@ -17,7 +17,7 @@ CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_
LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
-LIBXL_OBJS-y = osdeps.o
+LIBXL_OBJS-y = osdeps.o libxl_paths.o
LIBXL_OBJS = flexarray.o libxl.o libxl_dom.o libxl_exec.o libxl_xshelp.o
libxl_device.o libxl_internal.o xenguest.o libxl_utils.o $(LIBXL_OBJS-y)
AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
@@ -42,6 +42,15 @@ all: $(CLIENTS) libxenlight.so libxenlig
%.c: %.l
$(FLEX) --header-file=$*.h --outfile=$@ $<
+
+genpath-target = $(call buildmakevars2file,_libxl_paths.h)
+$(eval $(genpath-target))
+
+_libxl_paths.h: genpath
+ sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@ >_$@
+ mv _$@ $@
+
+libxl_paths.c: _libxl_paths.h
libxenlight.so: libxenlight.so.$(MAJOR)
ln -sf $< $@
@@ -88,7 +97,7 @@ install: all
.PHONY: clean
clean:
- $(RM) -f *.o *.so* *.a $(CLIENTS) $(DEPS)
+ $(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
# $(RM) -f $(AUTOSRCS) $(AUTOINCS)
distclean: clean
diff -r 9a1d7caa2024 -r a167ea374f26 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/libxl/libxl.c Thu Apr 29 19:38:52 2010 +0100
@@ -739,16 +739,9 @@ int libxl_domain_destroy(struct libxl_ct
int libxl_console_attach(struct libxl_ctx *ctx, uint32_t domid, int cons_num)
{
- struct stat st;
- const char *XENCONSOLE = "/usr/lib/xen/bin/xenconsole";
- char *cmd;
-
- if (stat(XENCONSOLE, &st) != 0) {
- XL_LOG(ctx, XL_LOG_ERROR, "could not access %s", XENCONSOLE);
- return ERROR_FAIL;
- }
-
- cmd = libxl_sprintf(ctx, "%s %d --num %d", XENCONSOLE, domid, cons_num);
+ char *cmd = libxl_sprintf(
+ ctx, "%s/xenconsole %d --num %d",
+ libxl_private_bindir_path(), domid, cons_num);
return (system(cmd) != 0) ? ERROR_FAIL : 0;
}
diff -r 9a1d7caa2024 -r a167ea374f26 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/libxl/libxl_internal.h Thu Apr 29 19:38:52 2010 +0100
@@ -202,5 +202,16 @@ void libxl_log_child_exitstatus(struct l
void libxl_log_child_exitstatus(struct libxl_ctx *ctx,
const char *what, pid_t pid, int status);
+/* libxl_paths.c */
+const char *libxl_sbindir_path(void);
+const char *libxl_bindir_path(void);
+const char *libxl_libexec_path(void);
+const char *libxl_libdir_path(void);
+const char *libxl_sharedir_path(void);
+const char *libxl_private_bindir_path(void);
+const char *libxl_xenfirmwaredir_path(void);
+const char *libxl_xen_config_dir_path(void);
+const char *libxl_xen_script_dir_path(void);
+
#endif
diff -r 9a1d7caa2024 -r a167ea374f26 tools/libxl/libxl_paths.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_paths.c Thu Apr 29 19:38:52 2010 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 Citrix Ltd.
+ *
+ * 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.
+ */
+
+#include "_libxl_paths.h"
+
+const char *libxl_sbindir_path(void)
+{
+ return SBINDIR;
+}
+
+const char *libxl_bindir_path(void)
+{
+ return BINDIR;
+}
+
+const char *libxl_libexec_path(void)
+{
+ return LIBEXEC;
+}
+
+const char *libxl_libdir_path(void)
+{
+ return LIBDIR;
+}
+
+const char *libxl_sharedir_path(void)
+{
+ return SHAREDIR;
+}
+
+const char *libxl_private_bindir_path(void)
+{
+ return PRIVATE_BINDIR;
+}
+
+const char *libxl_xenfirmwaredir_path(void)
+{
+ return XENFIRMWAREDIR;
+}
+
+const char *libxl_xen_config_dir_path(void)
+{
+ return XEN_CONFIG_DIR;
+}
+
+const char *libxl_xen_script_dir_path(void)
+{
+ return XEN_SCRIPT_DIR;
+}
+
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|