* [PATCH 3/5] storage-fixup: make a quiet/silent mode work
@ 2008-10-28 23:10 Kel Modderman
2008-11-12 5:27 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Kel Modderman @ 2008-10-28 23:10 UTC (permalink / raw)
To: linux-ide
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
---
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 3/5] storage-fixup: make a quiet/silent mode work
2008-10-28 23:10 [PATCH 3/5] storage-fixup: make a quiet/silent mode work Kel Modderman
@ 2008-11-12 5:27 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2008-11-12 5:27 UTC (permalink / raw)
To: Kel Modderman; +Cc: linux-ide
Kel Modderman wrote:
> Add a quiet mode. Remove the seemingly unused sact variable.
Modified so that execution header is printed on !quiet. (the
"storage-fixup: RULE: executing ..." line and use "eval $act >
/dev/null" for quiet mode instead and revive sact (I'm planning on using
it for drives to issue warning messages which we can't do much about).
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-12 5:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-28 23:10 [PATCH 3/5] storage-fixup: make a quiet/silent mode work Kel Modderman
2008-11-12 5:27 ` Tejun Heo
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).