From f0c03dee6ed7fe9edccb554f4dfda7afdd65d8c5 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 22 Mar 2002 18:55:44 +0000 Subject: [PATCH] The loopback device helper will use the next unused loopback device instead of just starting at minor 0. --- lustre/tests/common.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lustre/tests/common.sh b/lustre/tests/common.sh index 7510666..fced05a 100644 --- a/lustre/tests/common.sh +++ b/lustre/tests/common.sh @@ -22,6 +22,16 @@ else fi fi +next_loop_dev() { + NEXT= + while [ -b ${LOOP}${LOOPNUM} ]; do + LOOPDEV=${LOOP}${LOOPNUM} + losetup ${LOOPDEV} > /dev/null 2>&1 || NEXT=${LOOPDEV} + LOOPNUM=`expr ${LOOPNUM} + 1` + [ "$NEXT" ] && echo ${NEXT} && break + done +} + list_mods() { $DEBCTL modules > $R/tmp/ogdb echo "The GDB module script is in /tmp/ogdb. Press enter to continue" @@ -31,16 +41,14 @@ list_mods() { new_fs () { dd if=/dev/zero of=$2 bs=1k count=$3 1>&2 || exit -1 mkfs.$1 -b 4096 -F $2 1>&2 || exit -1 - LOOPDEV=${LOOP}${LOOPNUM} + LOOPDEV=`next_loop_dev` losetup ${LOOPDEV} $2 1>&2 || exit -1 - LOOPNUM=`expr ${LOOPNUM} + 1` } old_fs () { [ -e $2 ] || exit -1 - LOOPDEV=${LOOP}${LOOPNUM} + LOOPDEV=`next_loop_dev` losetup ${LOOPDEV} $2 1>&2 || exit -1 - LOOPNUM=`expr ${LOOPNUM} + 1` } setup() { -- 1.8.3.1