X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fboot.c;h=8ad83beb6a98673ecfea8844406da4c0f662078f;hp=d9c606f9a5914acbf79104f1f90e79f337f2a2b3;hb=a249555fa8be3f01f692088f867de8d8b3e45990;hpb=823958fbbd17ab2c1b2a1779eb10351ca0a668c6 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,