lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230102135155.20326-1-unixbhaskar@gmail.com>
Date:   Mon,  2 Jan 2023 19:21:57 +0530
From:   Bhaskar Chowdhury <unixbhaskar@...il.com>
To:     unixbhaskar@...il.com, linux-kernel@...r.kernel.org
Cc:     paulmck@...nel.org
Subject: [PATCH] tools: rcu: Added check for argument and usage function

Inducted some argument check as well put the important information in a
function for better usecase.

cc: paulmck@...nel.org

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@...il.com>
---
  Paul, pardon my brevity. Chances might be there that I might have
  misunderstood the requirement.
 tools/rcu/extract-stall.sh | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/tools/rcu/extract-stall.sh b/tools/rcu/extract-stall.sh
index e565697c9f90..d71617d0e565 100644
--- a/tools/rcu/extract-stall.sh
+++ b/tools/rcu/extract-stall.sh
@@ -1,11 +1,27 @@
 #!/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 ] ]
+
+# Terminate the script, if the argument file is missing
+
+if [[ $# -eq 0 ]];then
+
+	echo You are suppose to pass the dmesg file as an argument.
+	usage
+	exit 1
+fi
+
+# This is an usage function to spit out information about properly use this
+# script
+
+usage() {
+
+      echo Extract any RCU CPU stall warnings present in specified file.
+      echo Filter out clocksource lines.  Note that preceding-lines excludes
+      echo The initial line of the stall warning but trailing-lines includes it.
+
+      echo $0 dmesg-file [ preceding-lines [ trailing-lines  ]  ]
+
+}

 echo $1
 preceding_lines="${2-3}"
--
2.38.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ