All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Simon Horman <horms@verge.net.au>
Cc: Chris Mason <clm@fb.com>, kexec@lists.infradead.org
Subject: [PATCH 2/2] kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync)
Date: Thu, 26 Mar 2015 15:16:44 -0400	[thread overview]
Message-ID: <20150326191644.GF1953@htj.duckdns.org> (raw)
In-Reply-To: <20150326191608.GE1953@htj.duckdns.org>

From 81b5889b49f0f2448c3e9543c5c936d52348910c Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Thu, 26 Mar 2015 15:11:09 -0400

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>
---
 kexec/kexec.8 |  6 ++----
 kexec/kexec.c | 17 +++++++++--------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/kexec/kexec.8 b/kexec/kexec.8
index 24d1969..4d0c1d1 100644
--- a/kexec/kexec.8
+++ b/kexec/kexec.8
@@ -147,12 +147,10 @@ target kernel. If a capture kernel is being unloaded then specify -p with -u.
 Return the version number of the installed utility.
 .TP
 .B \-x\ (\-\-no\-ifdown)
-Shut down the running kernel, but restore the interface on reload. (If
-this option is used, it must be one of last options specified.)
+Shut down the running kernel, but restore the interface on reload.
 .TP
 .B \-y\ (\-\-no\-sync)
-Shut down the running kernel, but skip syncing the filesystems. (If
-this option is used, it must be one of last options specified.)
+Shut down the running kernel, but skip syncing the filesystems.
 .TP
 .BI \-\-mem\-min= addr
 Specify the lowest memory address
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"
-- 
2.1.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2015-03-26 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 19:16 [PATCH 1/2] kexec: implement -y (--no-sync) option Tejun Heo
2015-03-26 19:16 ` Tejun Heo [this message]
2015-04-13 17:01   ` [PATCH 2/2] kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync) Tejun Heo
2015-04-14  0:29     ` Simon Horman
2015-04-14 12:15       ` [PATCH REPOST 1/2] kexec: implement -y (--no-sync) option Tejun Heo
2015-04-14 12:16         ` [PATCH REPOST 2/2] kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync) Tejun Heo
2015-04-15  1:09         ` [PATCH REPOST 1/2] kexec: implement -y (--no-sync) option Simon Horman
2015-04-15  2:42           ` Tejun Heo

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=20150326191644.GF1953@htj.duckdns.org \
    --to=tj@kernel.org \
    --cc=clm@fb.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.