forked from pool/kexec-tools
f3fb4b072a
- kexec: add -a option to fall back to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported (bsc#1080916, boo#1076839). * kexec-Return-ENOSYS-when-kexec-does-not-know-how-to-.patch * kexec-Fix-option-checks-to-take-KEXEC_FILE_LOAD-into.patch * kexec-Do-not-special-case-the-s-option.patch * kexec-Add-option-to-revert-s.patch * kexec-Add-option-to-fall-back-to-KEXEC_LOAD-when-KEX.patch * kexec-Document-s-c-and-a-options-in-the-man-page.patch - kexec/ppc64: leverage kexec_file_load support (bsc#1080916) * kexec-ppc64-leverage-kexec_file_load-support.patch Patches accepted upstream. OBS-URL: https://build.opensuse.org/request/show/593211 OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kexec-tools?expand=0&rev=95
78 lines
2.3 KiB
Diff
78 lines
2.3 KiB
Diff
From 1ce7ef9717b1e1a721a1012d1de1ed2b4eae9485 Mon Sep 17 00:00:00 2001
|
|
Message-Id: <1ce7ef9717b1e1a721a1012d1de1ed2b4eae9485.1522755494.git.msuchanek@suse.de>
|
|
In-Reply-To: <e810acd57d9fc2d7ba3b0e95d470c20de9948462.1522755494.git.msuchanek@suse.de>
|
|
References: <e810acd57d9fc2d7ba3b0e95d470c20de9948462.1522755494.git.msuchanek@suse.de>
|
|
From: Michal Suchanek <msuchanek@suse.de>
|
|
Date: Mon, 26 Feb 2018 12:17:01 +0100
|
|
Subject: [PATCH v6 3/6] kexec: Do not special-case the -s option
|
|
|
|
It is parsed separately to save a few CPU cycles when setting up other
|
|
options but it just complicates the code. So fold it back and set up all
|
|
flags for both KEXEC_LOAD and KEXEC_FILE_LOAD
|
|
|
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
|
---
|
|
kexec/kexec.c | 25 ++++---------------------
|
|
1 file changed, 4 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
|
index b793f31ea501..68ae0594d4a7 100644
|
|
--- a/kexec/kexec.c
|
|
+++ b/kexec/kexec.c
|
|
@@ -1256,19 +1256,6 @@ int main(int argc, char *argv[])
|
|
};
|
|
static const char short_options[] = KEXEC_ALL_OPT_STR;
|
|
|
|
- /*
|
|
- * First check if --use-kexec-file-syscall is set. That changes lot of
|
|
- * things
|
|
- */
|
|
- while ((opt = getopt_long(argc, argv, short_options,
|
|
- options, 0)) != -1) {
|
|
- switch(opt) {
|
|
- case OPT_KEXEC_FILE_SYSCALL:
|
|
- do_kexec_file_syscall = 1;
|
|
- break;
|
|
- }
|
|
- }
|
|
-
|
|
/* Reset getopt for the next pass. */
|
|
opterr = 1;
|
|
optind = 1;
|
|
@@ -1310,8 +1297,7 @@ int main(int argc, char *argv[])
|
|
do_shutdown = 0;
|
|
do_sync = 0;
|
|
do_unload = 1;
|
|
- if (do_kexec_file_syscall)
|
|
- kexec_file_flags |= KEXEC_FILE_UNLOAD;
|
|
+ kexec_file_flags |= KEXEC_FILE_UNLOAD;
|
|
break;
|
|
case OPT_EXEC:
|
|
do_load = 0;
|
|
@@ -1354,11 +1340,8 @@ int main(int argc, char *argv[])
|
|
do_exec = 0;
|
|
do_shutdown = 0;
|
|
do_sync = 0;
|
|
- if (do_kexec_file_syscall)
|
|
- kexec_file_flags |= KEXEC_FILE_ON_CRASH;
|
|
- else
|
|
- kexec_flags = KEXEC_ON_CRASH;
|
|
- break;
|
|
+ kexec_file_flags |= KEXEC_FILE_ON_CRASH;
|
|
+ kexec_flags = KEXEC_ON_CRASH;
|
|
case OPT_MEM_MIN:
|
|
mem_min = strtoul(optarg, &endptr, 0);
|
|
if (*endptr) {
|
|
@@ -1383,7 +1366,7 @@ int main(int argc, char *argv[])
|
|
do_reuse_initrd = 1;
|
|
break;
|
|
case OPT_KEXEC_FILE_SYSCALL:
|
|
- /* We already parsed it. Nothing to do. */
|
|
+ do_kexec_file_syscall = 1;
|
|
break;
|
|
case OPT_STATUS:
|
|
do_status = 1;
|
|
--
|
|
2.13.6
|
|
|