@@ -10,11 +10,11 @@ _dmerror_setup()
local blk_dev_size=`blockdev --getsz $dm_backing_dev`
- DMERROR_DEV='/dev/mapper/error-test'
+ export DMERROR_DEV='/dev/mapper/error-test'
- DMLINEAR_TABLE="0 $blk_dev_size linear $dm_backing_dev 0"
+ export DMLINEAR_TABLE="0 $blk_dev_size linear $dm_backing_dev 0"
- DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0"
+ export DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0"
}
_dmerror_init()
@@ -42,6 +42,8 @@ _dmerror_cleanup()
$DMSETUP_PROG resume error-test > /dev/null 2>&1
$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
_dmsetup_remove error-test
+
+ unset DMERROR_DEV DMLINEAR_TABLE DMERROR_TABLE
}
_dmerror_load_error_table()
@@ -5,15 +5,12 @@
. ./common/config
. ./common/dmerror
-_dmerror_setup
+if [ -z "$DMERROR_DEV" ]; then
+ echo "Caller should have run _dmerror_init."
+ exit 1
+fi
case $1 in
-cleanup)
- _dmerror_cleanup
- ;;
-init)
- _dmerror_init
- ;;
load_error_table)
_dmerror_load_error_table
;;
@@ -21,7 +18,7 @@ load_working_table)
_dmerror_load_working_table
;;
*)
- echo "Usage: $0 {init|cleanup|load_error_table|load_working_table}"
+ echo "Usage: $0 {load_error_table|load_working_table}"
exit 1
;;
esac