WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] make use of libxl path functions

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] make use of libxl path functions
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Thu, 6 May 2010 14:24:11 +0100
Delivery-date: Thu, 06 May 2010 06:22:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
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>

---

diff -r ccae861f52f7 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl.c       Thu May 06 14:17:16 2010 +0100
@@ -981,7 +981,7 @@
     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 @@
     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 @@
     }
     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 ccae861f52f7 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl_dom.c   Thu May 06 14:17:16 2010 +0100
@@ -171,7 +171,7 @@
 {
     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 ccae861f52f7 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c      Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl_internal.c      Thu May 06 14:17:16 2010 +0100
@@ -194,3 +194,13 @@
     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 libxl_sprintf(ctx, "%s/%s", path, s);
+    } else {
+        return s;
+    }
+}
+
diff -r ccae861f52f7 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl_internal.h      Thu May 06 14:17:16 2010 +0100
@@ -202,6 +202,8 @@
 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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] make use of libxl path functions, Stefano Stabellini <=