# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273157975 -3600
# Node ID cd61f4ff90b9524c1c5c90d01d855ef47478d6c5
# Parent 32237ba44ac415032e7e680c60cbe68eea6e9c09
libxl: make use of libxl path functions
Make use of the new libxl_*_path functions to specify the correct
absolute path of qemu-dm, hvmloader and ioemu-stubdom.gz.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
tools/libxl/libxl.c | 7 ++++---
tools/libxl/libxl_dom.c | 8 +++++++-
tools/libxl/libxl_internal.c | 8 ++++++++
tools/libxl/libxl_internal.h | 2 ++
4 files changed, 21 insertions(+), 4 deletions(-)
diff -r 32237ba44ac4 -r cd61f4ff90b9 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu May 06 15:55:31 2010 +0100
+++ b/tools/libxl/libxl.c Thu May 06 15:59:35 2010 +0100
@@ -981,7 +981,7 @@ static int libxl_create_stubdom(struct l
b_info.max_vcpus = 1;
b_info.max_memkb = 32 * 1024;
b_info.target_memkb = b_info.max_memkb;
- b_info.kernel = "/usr/lib/xen/boot/ioemu-stubdom.gz";
+ b_info.kernel = libxl_abs_path(ctx, "ioemu-stubdom.gz",
libxl_xenfirmwaredir_path());
b_info.u.pv.cmdline = libxl_sprintf(ctx, " -d %d", info->domid);
b_info.u.pv.ramdisk = "";
b_info.u.pv.features = "";
@@ -1122,7 +1122,8 @@ int libxl_create_device_model(struct lib
if (rc < 0) goto xit;
if (!rc) { /* inner child */
libxl_exec(null, logfile_w, logfile_w,
- info->device_model, args);
+ libxl_abs_path(ctx, info->device_model,
libxl_private_bindir_path()),
+ args);
}
rc = 0;
@@ -1702,7 +1703,7 @@ static int libxl_build_xenpv_qemu_args(s
}
info->domid = vfb->domid;
info->dom_name = libxl_domid_to_name(ctx, vfb->domid);
- info->device_model = "/usr/lib/xen/bin/qemu-dm";
+ info->device_model = libxl_abs_path(ctx, "qemu-dm",
libxl_private_bindir_path());
info->type = XENPV;
return 0;
}
diff -r 32237ba44ac4 -r cd61f4ff90b9 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Thu May 06 15:55:31 2010 +0100
+++ b/tools/libxl/libxl_dom.c Thu May 06 15:59:35 2010 +0100
@@ -171,7 +171,13 @@ int build_hvm(struct libxl_ctx *ctx, uin
{
int ret;
- ret = xc_hvm_build_target_mem(ctx->xch, domid, (info->max_memkb -
info->video_memkb) / 1024, (info->target_memkb - info->video_memkb) / 1024,
info->kernel);
+ ret = xc_hvm_build_target_mem(
+ ctx->xch,
+ domid,
+ (info->max_memkb - info->video_memkb) / 1024,
+ (info->target_memkb - info->video_memkb) / 1024,
+ libxl_abs_path(ctx, (char *)info->kernel,
+ libxl_xenfirmwaredir_path()));
if (ret) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "hvm building failed");
return ERROR_FAIL;
diff -r 32237ba44ac4 -r cd61f4ff90b9 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c Thu May 06 15:55:31 2010 +0100
+++ b/tools/libxl/libxl_internal.c Thu May 06 15:59:35 2010 +0100
@@ -194,3 +194,11 @@ void xl_log(struct libxl_ctx *ctx, int l
xl_logv(ctx, loglevel, errnoval, file, line, func, fmt, ap);
va_end(ap);
}
+
+char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path)
+{
+ if (!s || s[0] == '/')
+ return s;
+ return libxl_sprintf(ctx, "%s/%s", path, s);
+}
+
diff -r 32237ba44ac4 -r cd61f4ff90b9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Thu May 06 15:55:31 2010 +0100
+++ b/tools/libxl/libxl_internal.h Thu May 06 15:59:35 2010 +0100
@@ -202,6 +202,8 @@ void libxl_log_child_exitstatus(struct l
void libxl_log_child_exitstatus(struct libxl_ctx *ctx,
const char *what, pid_t pid, int status);
+char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path);
+
/* libxl_paths.c */
const char *libxl_sbindir_path(void);
const char *libxl_bindir_path(void);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|