xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com
Subject: [PATCH 1 of 3] libxl: Look for bootloader in libexec path
Date: Thu, 26 Apr 2012 15:26:12 +0100	[thread overview]
Message-ID: <b810908dea7d328aa88c.1335450372@kodo2> (raw)
In-Reply-To: <patchbomb.1335450371@kodo2>

If the full path for a bootloader (such as pygrub or xenpvnetboot) is not
given, look for it in the libexec path.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r b4cbf273b1cb -r b810908dea7d tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Wed Feb 29 16:30:34 2012 +0000
+++ b/tools/libxl/libxl_bootloader.c	Thu Apr 26 15:09:35 2012 +0100
@@ -333,6 +333,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
 
     char tempdir_template[] = "/var/run/libxl/bl.XXXXXX";
     char *tempdir;
+    const char *bootloader = NULL;
 
     char *dom_console_xs_path;
     char dom_console_slave_tty_path[PATH_MAX];
@@ -397,6 +398,13 @@ int libxl_run_bootloader(libxl_ctx *ctx,
         goto out_close;
     }
 
+    bootloader = libxl__abs_path(gc, info->u.pv.bootloader,
+                                 libxl__libexec_path());
+    if ( bootloader == NULL ) {
+        rc = ERROR_NOMEM;
+        goto out_close;
+    }
+
     /*
      * We need to present the bootloader's tty as a pty slave that xenconsole
      * can access.  Since the bootloader itself needs a pty slave,
@@ -417,7 +425,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
     dom_console_xs_path = libxl__sprintf(gc, "%s/console/tty", libxl__xs_get_dompath(gc, domid));
     libxl__xs_write(gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
 
-    pid = fork_exec_bootloader(&bootloader_fd, info->u.pv.bootloader, args);
+    pid = fork_exec_bootloader(&bootloader_fd, bootloader, args);
     if (pid < 0) {
         goto out_close;
     }

  reply	other threads:[~2012-04-26 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 14:26 [PATCH 0 of 3] tools: Move bootloaders to libexec directory George Dunlap
2012-04-26 14:26 ` George Dunlap [this message]
2012-04-26 14:26 ` [PATCH 2 of 3] tools: Install pv bootloaders in libexec rather than /usr/bin George Dunlap
2012-04-26 14:26 ` [PATCH 3 of 3] libxl: Warn that /usr/bin/pygrub is deprecated George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b810908dea7d328aa88c.1335450372@kodo2 \
    --to=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).