Merge commit 'refs/top-bases/linux-zpios' into linux-zpios

This commit is contained in:
Brian Behlendorf 2009-07-21 16:32:18 -07:00
commit 8e5f7bd9d5
5 changed files with 16 additions and 4 deletions

View File

@ -143,3 +143,15 @@ unload_modules() {
return 0
}
unused_loop_device() {
for DEVICE in `ls -1 /dev/loop*`; do
losetup $DEVICE &>/dev/null
if [ $? -ne 0 ]; then
echo $DEVICE
return
fi
done
die "Error: Unable to find unused loopback device"
}

View File

@ -11,7 +11,7 @@ DEVICES=""
zpool_create() {
for FILE in ${FILES}; do
DEVICE=`/sbin/losetup -f`
DEVICE=`unused_loop_device`
msg "Creating ${FILE} using loopback device ${DEVICE}"
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||

View File

@ -13,7 +13,7 @@ DEVICES_M2=""
zpool_create() {
for FILE in ${FILES_M1}; do
DEVICE=`/sbin/losetup -f`
DEVICE=`unused_loop_device`
msg "Creating ${FILE} using loopback device ${DEVICE}"
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||

View File

@ -11,7 +11,7 @@ DEVICES=""
zpool_create() {
for FILE in ${FILES}; do
DEVICE=`/sbin/losetup -f`
DEVICE=`unused_loop_device`
msg "Creating ${FILE} using loopback device ${DEVICE}"
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||

View File

@ -11,7 +11,7 @@ DEVICES=""
zpool_create() {
for FILE in ${FILES}; do
DEVICE=`/sbin/losetup -f`
DEVICE=`unused_loop_device`
msg "Creating ${FILE} using loopback device ${DEVICE}"
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||