summaryrefslogtreecommitdiff
path: root/kexec/kexec.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-03-26 15:11:09 -0400
committerSimon Horman <horms@verge.net.au>2015-04-15 10:07:06 +0900
commit8da5dd2da475ea4d15d0b18c7f4732cb82242d47 (patch)
tree33292f8bfe7bf1362c5c1c67e4e4aa22c3fbeb32 /kexec/kexec.c
parentca718aa5070bb528c6f49172dee724a37dbd1e8a (diff)
kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync)
Currently, the two options must be the last ones to be honored; otherwise, they can get silently ignored and both the manpage and help text point it out. This is error-prone and trivial to fix. There isn't much point in pointing something out in documentation when the peculiarity can be removed with four lines of extra code. Update option handling so that the two arguments are honored regardless of their positions. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/kexec.c')
-rw-r--r--kexec/kexec.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 7123460..8ce6885 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -913,11 +913,7 @@ void usage(void)
" -f, --force Force an immediate kexec,\n"
" don't call shutdown.\n"
" -x, --no-ifdown Don't bring down network interfaces.\n"
- " (if used, must be one of last options\n"
- " specified)\n"
" -y, --no-sync Don't sync filesystems before kexec.\n"
- " (if used, must be one of last options\n"
- " specified)\n"
" -l, --load Load the new kernel into the\n"
" current kernel.\n"
" -p, --load-panic Load the new kernel for use on panic.\n"
@@ -1170,8 +1166,8 @@ int main(int argc, char *argv[])
int do_exec = 0;
int do_load_jump_back_helper = 0;
int do_shutdown = 1;
- int do_sync = 1;
- int do_ifdown = 0;
+ int do_sync = 1, skip_sync = 0;
+ int do_ifdown = 0, skip_ifdown = 0;
int do_unload = 0;
int do_reuse_initrd = 0;
int do_kexec_file_syscall = 0;
@@ -1219,10 +1215,10 @@ int main(int argc, char *argv[])
case OPT_DEBUG:
kexec_debug = 1;
case OPT_NOIFDOWN:
- do_ifdown = 0;
+ skip_ifdown = 1;
break;
case OPT_NOSYNC:
- do_sync = 0;
+ skip_sync = 1;
break;
case OPT_FORCE:
do_load = 1;
@@ -1321,6 +1317,11 @@ int main(int argc, char *argv[])
}
}
+ if (skip_ifdown)
+ do_ifdown = 0;
+ if (skip_sync)
+ do_sync = 0;
+
if (do_load && (kexec_flags & KEXEC_ON_CRASH) &&
!is_crashkernel_mem_reserved()) {
die("Memory for crashkernel is not reserved\n"