summaryrefslogtreecommitdiffstats
path: root/discover/boot.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-08-13 13:03:53 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-08-19 13:27:59 +0800
commit51c6aaf7864eb65779d548ee2549caa357f71e2c (patch)
treec68d7b272c40a152c6ec65b2a1af70d6bbad2b13 /discover/boot.c
parent823958fbbd17ab2c1b2a1779eb10351ca0a668c6 (diff)
downloadtalos-petitboot-51c6aaf7864eb65779d548ee2549caa357f71e2c.tar.gz
talos-petitboot-51c6aaf7864eb65779d548ee2549caa357f71e2c.zip
lib/process: replace pb_run_cmd
This change replaces the pb_run_cmd() function with proper usage of the process API. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/boot.c')
-rw-r--r--discover/boot.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/discover/boot.c b/discover/boot.c
index d9c606f..8ad83be 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -77,7 +77,7 @@ static int kexec_load(struct boot_task *boot_task)
*p++ = boot_task->local_image; /* 6 */
*p++ = NULL; /* 7 */
- result = pb_run_cmd(argv, 1, boot_task->dry_run);
+ result = process_run_simple_argv(boot_task, argv);
if (result)
pb_log("%s: failed: (%d)\n", __func__, result);
@@ -91,31 +91,18 @@ static int kexec_load(struct boot_task *boot_task)
* Must only be called after a successful call to kexec_load().
*/
-static int kexec_reboot(bool dry_run)
+static int kexec_reboot(struct boot_task *task)
{
- int result = 0;
- const char *argv[4];
- const char **p;
+ int result;
/* First try running shutdown. Init scripts should run 'exec -e' */
-
- p = argv;
- *p++ = pb_system_apps.shutdown; /* 1 */
- *p++ = "-r"; /* 2 */
- *p++ = "now"; /* 3 */
- *p++ = NULL; /* 4 */
-
- result = pb_run_cmd(argv, 1, dry_run);
+ result = process_run_simple(task, pb_system_apps.shutdown, "-r",
+ "now", NULL);
/* On error, force a kexec with the -e option */
-
if (result) {
- p = argv;
- *p++ = pb_system_apps.kexec; /* 1 */
- *p++ = "-e"; /* 2 */
- *p++ = NULL; /* 3 */
-
- result = pb_run_cmd(argv, 1, 0);
+ result = process_run_simple(task, pb_system_apps.kexec,
+ "-e", NULL);
}
if (result)
@@ -123,13 +110,8 @@ static int kexec_reboot(bool dry_run)
/* okay, kexec -e -f */
if (result) {
- p = argv;
- *p++ = pb_system_apps.kexec; /* 1 */
- *p++ = "-e"; /* 2 */
- *p++ = "-f"; /* 3 */
- *p++ = NULL; /* 4 */
-
- result = pb_run_cmd(argv, 1, 0);
+ result = process_run_simple(task, pb_system_apps.kexec,
+ "-e", "-f", NULL);
}
if (result)
@@ -395,7 +377,7 @@ no_load:
update_status(status_fn, status_arg, BOOT_STATUS_INFO,
"performing kexec reboot");
- result = kexec_reboot(boot_task->dry_run);
+ result = kexec_reboot(boot_task);
if (result) {
update_status(status_fn, status_arg, BOOT_STATUS_ERROR,
OpenPOWER on IntegriCloud