Put _qmount_option into common.quota for other quota tests to use.
authorTim Shimmin <tes@sgi.com>
Fri, 20 Apr 2007 03:58:19 +0000 (03:58 +0000)
committerTim Shimmin <tes@sgi.com>
Fri, 20 Apr 2007 03:58:19 +0000 (03:58 +0000)
Merge of master-melb:xfs-cmds:28443a by kenmcd.

  Put _qmount_option into common.quota for other quota tests to use.

050
052
054
common.quota

diff --git a/050 b/050
index 9347131e8dc03f4f4afea890f823acabeace7d47..05e55fbeccc4626d5697e04b444f6e8ab485aec0 100755 (executable)
--- a/050
+++ b/050
@@ -155,27 +155,6 @@ _exercise()
 
 }
 
-
-#ensures only one quota mount option is specified
-_qmount_option()
-{
-       #replace any user defined quota options
-       export MOUNT_OPTIONS=`echo $MOUNT_OPTIONS \
-       | sed -e 's/uquota/$q_opt/g' \
-               -e 's/gquota/$q_opt/g' \
-               -e 's/pquota/$q_opt/g' \
-               -e 's/quota/$q_opt/g' \
-               -e 's/uqnoenforce/$q_opt/g' \
-               -e 's/gqnoenforce/$q_opt/g' \
-               -e 's/pqnoenforce/$q_opt/g' \
-               -e 's/qnoenforce/$q_opt/g' \
-       | sed 's/$q_opt/'$1'/g'`
-
-       #check $q_opt is in new mount options
-       echo $MOUNT_OPTIONS | grep "$1" > /dev/null 2>&1
-       [ "$?" -eq 0 ] || export MOUNT_OPTIONS="$MOUNT_OPTIONS -o $1"
-}
-
 cat >$tmp.projects <<EOF
 1:$SCRATCH_MNT
 EOF
diff --git a/052 b/052
index ee96a1f4bd05796b211c1d146109424b9e3687b0..ccd3008ea4ec0036412af0b603d9b11d466b9f2d 100755 (executable)
--- a/052
+++ b/052
@@ -44,9 +44,7 @@ _require_quota
 _require_nobody
 
 # setup a default run
-if [ -z "$MOUNT_OPTIONS" ]; then
-        export MOUNT_OPTIONS="-o uquota"
-fi
+_qmount_option uquota
 
 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
 cat $tmp.mkfs >>$seq.full
diff --git a/054 b/054
index 7363e3358dca538bb3460668fed39ae68645eca1..d29aad184e0edcd36653e976e2ed7249f5637a42 100755 (executable)
--- a/054
+++ b/054
@@ -86,7 +86,7 @@ _exercise()
 }
 
 _scratch_mkfs_xfs $SCRATCH_DEV >/dev/null 2>&1
-export MOUNT_OPTIONS="-o uquota,gquota"
+_qmount_option "uquota,gquota"
 _qmount
 if src/feature -G $SCRATCH_DEV ; then
        :
@@ -95,19 +95,20 @@ else
 fi
 umount $SCRATCH_MNT 2>/dev/null
 
-export MOUNT_OPTIONS=""
+_qmount_option "rw" # no quota options
 echo "*** Default mount options"
 _exercise
 
-export MOUNT_OPTIONS="-o uquota"
+_qmount_option "uquota"
 echo "*** User quota mount option"
 _exercise
 
 export MOUNT_OPTIONS="-o gquota"
+_qmount_option "gquota"
 echo "*** Group quota mount option"
 _exercise
 
-export MOUNT_OPTIONS="-o uquota,gquota"
+_qmount_option "uquota,gquota"
 echo "*** User and Group quota mount options"
 _exercise
 
index a00b832ea97fbafc245af100c10b3a3dd7bca92c..51d9586d481d8235d220bf2d0301456559d66591 100644 (file)
@@ -153,5 +153,33 @@ _qsetup()
     echo "and using type=$type id=$id" >>$seq.full
 }
 
+#
+# Ensures only the given quota mount option is used
+#
+_qmount_option()
+{
+       # Replace any user defined quota options
+       # with the quota option that we want.
+       # Simplest to do this rather than delete existing ones first because
+       # of the variety of commas and spaces and multiple -o's
+       # that we'd have to cater for. Doesn't matter if we have duplicates.
+       # Use "QUOTA" string so that we don't have any substring confusion
+       # thanks to "quota" which will match with "uquota" and "gquota" etc.
+       export MOUNT_OPTIONS=`echo $MOUNT_OPTIONS \
+       | sed   -e 's/uquota/QUOTA/g'      \
+               -e 's/gquota/QUOTA/g'      \
+               -e 's/pquota/QUOTA/g'      \
+               -e 's/quota/QUOTA/g'       \
+               -e 's/uqnoenforce/QUOTA/g' \
+               -e 's/gqnoenforce/QUOTA/g' \
+               -e 's/pqnoenforce/QUOTA/g' \
+               -e 's/qnoenforce/QUOTA/g'  \
+               -e "s/QUOTA/$1/g"`
+
+       # Ensure we have the given quota option - duplicates are fine
+       export MOUNT_OPTIONS="$MOUNT_OPTIONS -o $1"
+       echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seq.full
+}
+
 # make sure this script returns success
 /bin/true