linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kel Modderman <kel@otaku42.de>
To: linux-ide@vger.kernel.org
Subject: [PATCH 3/5] storage-fixup: make a quiet/silent mode work
Date: Wed, 29 Oct 2008 09:10:25 +1000	[thread overview]
Message-ID: <200810290910.25324.kel@otaku42.de> (raw)

Add a quiet mode. Remove the seemingly unused sact variable.

Signed-off-by: Kel Modderman <kel@otaku42.de>
---
--- a/storage-fixup
+++ b/storage-fixup
@@ -27,10 +27,6 @@
 #	Executes ACTION on matched devices.  ACTION can contain $DEV
 #	which will be substituted with device file of matching device.
 #
-# sact ACTION
-#	Silent version of "act".  Useful when the action to take is
-#	printing out a warning message.
-#
 # PATTERN is bash extglob pattern.
 #
 # For example, the following (useless) rule disables APM on the first
@@ -47,10 +43,11 @@
 #
 
 declare usage="
-Usage: storage-fixup [-h] [-V] [-v] [-b] [-c config_file] [-m max_devs]
+Usage: storage-fixup [-h] [-V] [-q] [-v] [-b] [-c config_file] [-m max_devs]
 
        -h      Print this help message and exit
        -V      Print version and exit
+       -q      Quiet
        -v      Verbose
        -d      Dry run, don't actually execute action
        -c      Use config_file instead of /etc/storage-fixup.conf
@@ -81,7 +78,7 @@ warn() {
 }
 
 debug() {
-    if [ $verbose -ne 0 ]; then
+    if [ $verbose -gt 0 ]; then
 	warn "$@"
     fi
 }
@@ -242,8 +239,10 @@ do_act() {
     for idx in ${matches[@]}; do
 	DEV=${storage_devs[idx]}
 	if [ $dry_run -eq 0 ]; then
-	    if [ $verbose -ne 0 ]; then
+	    if [ $verbose -gt 0 ]; then
 		eval log "$rule_name: executing \"$act\""
+	    elif [ $verbose -lt 0 ]; then
+	    	act=${act//$hdparm/$hdparm -q}
 	    fi
 	    eval "$act"
 	else
@@ -259,10 +258,12 @@ do_act() {
 #
 shopt -s extglob
 
-while getopts "dvVc:m:h" option; do
+while getopts "dqvVc:m:h" option; do
     case $option in
 	d)
 	    dry_run=1;;
+	q)
+	    verbose=-1;;
 	v)
 	    verbose=1;;
 	V)
@@ -345,10 +346,7 @@ while read f0 f1 f2; do
 	    do_storage scsi "$f1" "$f2"
 	    ;;
     act)
-	    do_act "$f1 $f2" 1
-	    ;;
-    sact)
-	    do_act "$f1 $f2" 0
+	    do_act "$f1 $f2" "$verbose"
 	    ;;
     *)
 	    false
---

             reply	other threads:[~2008-10-28 23:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 23:10 Kel Modderman [this message]
2008-11-12  5:27 ` [PATCH 3/5] storage-fixup: make a quiet/silent mode work 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=200810290910.25324.kel@otaku42.de \
    --to=kel@otaku42.de \
    --cc=linux-ide@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).