From 04145749363e0180e8014b37eb3dfe59450f9bd4 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Tue, 10 Jan 2012 19:59:44 +0400 Subject: small changes for debian/checkarray remove usage of $SYNC_ACTION_CTL in favour of $MDBASE/sync_action since $MDBASE is (and will be) used in other places. While at it, replace var=$(cat foo) with read var < foo construct --- debian/checkarray | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'debian/checkarray') diff --git a/debian/checkarray b/debian/checkarray index 96538e33..2043d8cd 100644 --- a/debian/checkarray +++ b/debian/checkarray @@ -139,33 +139,33 @@ fi [ $all = 1 ] && arrays="$(ls -d1 /sys/block/md* | cut -d/ -f4)" for array in $arrays; do - SYNC_ACTION_CTL=/sys/block/$array/md/sync_action + MDBASE=/sys/block/$array/md - if [ ! -e $SYNC_ACTION_CTL ]; then + if [ ! -e $MDBASE/sync_action ]; then [ $quiet -lt 1 ] && echo "$PROGNAME: I: skipping non-redundant array $array." >&2 continue fi - cur_status="$(cat $SYNC_ACTION_CTL)" + read cur_status < $MDBASE/sync_action if [ $action = status ]; then echo "$array: $cur_status" continue fi - if [ ! -w $SYNC_ACTION_CTL ]; then - [ $quiet -lt 2 ] && echo "$PROGNAME: E: $SYNC_ACTION_CTL not writeable." >&2 + if [ ! -w $MDBASE/sync_action ]; then + [ $quiet -lt 2 ] && echo "$PROGNAME: E: $MDBASE/sync_action not writeable." >&2 exit 4 fi - if [ "$(cat /sys/block/$array/md/array_state)" = 'read-auto' ]; then + if [ "$(cat $MDBASE/array_state)" = 'read-auto' ]; then [ $quiet -lt 1 ] && echo "$PROGNAME: W: array $array in auto-read-only state, skipping..." >&2 continue fi case "$action" in idle) - echo $action > $SYNC_ACTION_CTL + echo $action > $MDBASE/sync_action [ $quiet -lt 1 ] && echo "$PROGNAME: I: cancel request queued for array $array." >&2 ;; @@ -177,7 +177,7 @@ for array in $arrays; do # queue request for the array. The kernel will make sure that these requests # are properly queued so as to not kill one of the array. - echo $action > $SYNC_ACTION_CTL + echo $action > $MDBASE/sync_action [ $quiet -lt 1 ] && echo "$PROGNAME: I: check queued for array $array." >&2 case "$ionice" in -- cgit v1.2.3