1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Fix test-utils.h for rhel4 backward compatability.

for losetup, break out of the loop when successful setup of loop device,
and only look at 7 loop devices (default loop module setting)
for blockdev, use old option if new one is not available
This commit is contained in:
Dave Wysochanski 2008-12-05 05:03:23 +00:00
parent b47952641a
commit 8d2f8d7b6b

View File

@ -73,15 +73,19 @@ prepare_loop() {
return 0 return 0
else else
# no -f support # no -f support
# Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9} # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7}
for slash in '' /; do for slash in '' /; do
for i in 0 1 2 3 4 5 6 7 8 9; do for i in 0 1 2 3 4 5 6 7; do
local dev=$G_dev_/loop$slash$i local dev=$G_dev_/loop$slash$i
! losetup $dev >/dev/null 2>&1 || continue ! losetup $dev >/dev/null 2>&1 || continue
# got a free # got a free
losetup "$dev" "$LOOPFILE" losetup "$dev" "$LOOPFILE"
LOOP=$dev LOOP=$dev
break
done done
if [ -n "$LOOP" ]; then
break
fi
done done
test -n "$LOOP" # confirm or fail test -n "$LOOP" # confirm or fail
return 0 return 0
@ -99,7 +103,10 @@ prepare_devs() {
PREFIX="LVMTEST$$" PREFIX="LVMTEST$$"
local loopsz=`blockdev --getsz $LOOP` if ! loopsz=`blockdev --getsz $LOOP 2>/dev/null`; then
loopsz=`blockdev --getsize $LOOP 2>/dev/null`
fi
local size=$(($loopsz/$n)) local size=$(($loopsz/$n))
for i in `seq 1 $n`; do for i in `seq 1 $n`; do