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

This commit is contained in:
Brian Behlendorf 2009-07-24 10:36:00 -07:00
commit 08c9bcde74
5 changed files with 17 additions and 15 deletions

View File

@ -18,6 +18,8 @@ DUMP_LOG=
ERROR= ERROR=
MODULES=() MODULES=()
LOSETUP=/sbin/losetup
die() { die() {
echo -e "${PROG}: $1" >&2 echo -e "${PROG}: $1" >&2
exit 1 exit 1
@ -146,9 +148,9 @@ unload_modules() {
unused_loop_device() { unused_loop_device() {
for DEVICE in `ls -1 /dev/loop*`; do for DEVICE in `ls -1 /dev/loop*`; do
losetup $DEVICE &>/dev/null ${LOSETUP} ${DEVICE} &>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo $DEVICE echo ${DEVICE}
return return
fi fi
done done

View File

@ -16,7 +16,7 @@ zpool_create() {
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 ||
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
losetup ${DEVICE} ${FILE} || ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback" die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
@ -30,9 +30,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}" msg "Removing ${FILE} using loopback device ${DEVICE}"
losetup -d ${DEVICE} || ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback" die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1 rm -f ${FILE} || exit 1
done done

View File

@ -18,7 +18,7 @@ zpool_create() {
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 ||
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
losetup ${DEVICE} ${FILE} || ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback" die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES_M1="${DEVICES_M1} ${DEVICE}" DEVICES_M1="${DEVICES_M1} ${DEVICE}"
done done
@ -29,7 +29,7 @@ zpool_create() {
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 ||
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
losetup ${DEVICE} ${FILE} || ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback" die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES_M2="${DEVICES_M2} ${DEVICE}" DEVICES_M2="${DEVICES_M2} ${DEVICE}"
done done
@ -45,9 +45,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}" msg "Removing ${FILE} using loopback device ${DEVICE}"
losetup -d ${DEVICE} || ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback" die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1 rm -f ${FILE} || exit 1
done done

View File

@ -16,7 +16,7 @@ zpool_create() {
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 ||
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
losetup ${DEVICE} ${FILE} || ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback" die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
@ -30,9 +30,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}" msg "Removing ${FILE} using loopback device ${DEVICE}"
losetup -d ${DEVICE} || ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback" die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1 rm -f ${FILE} || exit 1
done done

View File

@ -16,7 +16,7 @@ zpool_create() {
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 ||
die "Error $? creating ${FILE}" die "Error $? creating ${FILE}"
losetup ${DEVICE} ${FILE} || ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback" die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES="${DEVICES} ${DEVICE}" DEVICES="${DEVICES} ${DEVICE}"
done done
@ -30,9 +30,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do for FILE in ${FILES}; do
DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:` DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}" msg "Removing ${FILE} using loopback device ${DEVICE}"
losetup -d ${DEVICE} || ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback" die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1 rm -f ${FILE} || exit 1
done done