Merge commit 'refs/top-bases/linux-have-zpl' into linux-have-zpl

This commit is contained in:
Brian Behlendorf 2009-07-21 16:32:46 -07:00
commit 68ae8401f7
5 changed files with 16 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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