summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpyther@pyther.net <pyther@pyther.net>2011-01-29 11:33:53 -0500
committerDieter Plaetinck <dieter@plaetinck.be>2011-01-29 17:49:44 +0100
commitb9afaa3fca01c055337301b02b2803b0b2775235 (patch)
treefec4868f41eaa75620e7dd9fd7cc4e026eea344c /src
parenta51268e3b947a58e0808b0db249c1d08ac6f44a9 (diff)
Use globbing and parameter expansion to get the raid slave devices
Uses bash globbing and parameter expansion to find all of the slaves for a raid device. This is a much better method then using ls. Also, by looking at DEVNAME in the uevent file we provide support for block device that are not in the root of /dev. Signed-off-by: Dieter Plaetinck <dieter@plaetinck.be>
Diffstat (limited to 'src')
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index bcde961..6533b7c 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -945,10 +945,14 @@ mdraid_slave0 ()
# ex: /dev/md0 has slaves: "/dev/sda1 /dev/sdb2 /dev/sdc2"
mdraid_all_slaves ()
{
+ shopt -s nullglob
local slave=
local slaves=
- for slave in $(ls /sys/class/block/$(basename $1)/slaves/); do
- slaves=$slaves"/dev/"$slave" "
+ for slave in /sys/class/block/${1##*/}/slaves/*; do
+ source "$slave/uevent"
+ slaves="$slaves/dev/$DEVNAME "
+ unset DEVNAME
done
+ shopt -u nullglob
echo $slaves
}