[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230323043935.1221184-5-boqun.feng@gmail.com>
Date: Wed, 22 Mar 2023 21:39:29 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: rcu@...r.kernel.org
Cc: Davidlohr Bueso <dave@...olabs.net>,
"Paul E. McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>,
Frederic Weisbecker <frederic@...nel.org>,
Neeraj Upadhyay <quic_neeraju@...cinc.com>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Joel Fernandes <joel@...lfernandes.org>,
Shuah Khan <shuah@...nel.org>,
Bhaskar Chowdhury <unixbhaskar@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: [PATCH rcu v2 04/10] tools: rcu: Add usage function and check for argument
From: Bhaskar Chowdhury <unixbhaskar@...il.com>
This commit converts extract-stall.sh script's header comment to a
usage() function, and adds an argument check. While in the area, make
this script be executable.
[ paulmck: Strength argument check, remove extraneous comment. ]
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@...il.com>
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
Signed-off-by: Boqun Feng <boqun.feng@...il.com>
---
tools/rcu/extract-stall.sh | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
mode change 100644 => 100755 tools/rcu/extract-stall.sh
diff --git a/tools/rcu/extract-stall.sh b/tools/rcu/extract-stall.sh
old mode 100644
new mode 100755
index e565697c9f90..08a39ad44320
--- a/tools/rcu/extract-stall.sh
+++ b/tools/rcu/extract-stall.sh
@@ -1,11 +1,25 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0+
-#
-# Extract any RCU CPU stall warnings present in specified file.
-# Filter out clocksource lines. Note that preceding-lines excludes the
-# initial line of the stall warning but trailing-lines includes it.
-#
-# Usage: extract-stall.sh dmesg-file [ preceding-lines [ trailing-lines ] ]
+
+usage() {
+ echo Extract any RCU CPU stall warnings present in specified file.
+ echo Filter out clocksource lines. Note that preceding-lines excludes the
+ echo initial line of the stall warning but trailing-lines includes it.
+ echo
+ echo Usage: $(basename $0) dmesg-file [ preceding-lines [ trailing-lines ] ]
+ echo
+ echo Error: $1
+}
+
+# Terminate the script, if the argument is missing
+
+if test -f "$1" && test -r "$1"
+then
+ :
+else
+ usage "Console log file \"$1\" missing or unreadable."
+ exit 1
+fi
echo $1
preceding_lines="${2-3}"
--
2.38.1
Powered by blists - more mailing lists