1# Supporting routines for blocktest. Do not run directly. 2 3# usage: devtopair /dev/cXdY.. 4# returns a label, minor pair in the form "label=at_wini_N,minor=M" 5devtopair() { 6 label=`awk "/^$(stat -f '%Hr' $1) / "'{print $2}' /proc/dmap` 7 if [ ! -z "$label" ]; then echo "label=$label,minor=`stat -f '%Lr' $1`"; fi 8} 9 10# usage: block_test /dev/cXdY.. "params,for,blocktest" 11# runs the blocktest driver on the given device with the given parameters 12block_test() { 13 if [ ! -x blocktest ]; then echo "compile blocktest first!" >&2; exit 1; fi 14 if [ ! -b "$1" ]; then echo "$1 is not a block device" >&2; exit 1; fi 15 pair=$(devtopair $1) 16 if [ -z "$pair" ]; then echo "driver not found for $1" >&2; exit 1; fi 17 service up `pwd`/blocktest -args "$pair,$2" -config system.conf \ 18 -script /etc/rs.single -label blocktest_$(stat -f '%r' $1) 19} 20