From ef8b8fcc0de847accabc834644d1f27d6ec526db Mon Sep 17 00:00:00 2001 From: Tim Shimmin Date: Fri, 20 Apr 2007 03:58:19 +0000 Subject: [PATCH] Put _qmount_option into common.quota for other quota tests to use. Merge of master-melb:xfs-cmds:28443a by kenmcd. Put _qmount_option into common.quota for other quota tests to use. --- 050 | 21 --------------------- 052 | 4 +--- 054 | 9 +++++---- common.quota | 28 ++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 28 deletions(-) diff --git a/050 b/050 index 9347131e..05e55fbe 100755 --- 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 <$tmp.mkfs cat $tmp.mkfs >>$seq.full diff --git a/054 b/054 index 7363e335..d29aad18 100755 --- 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 diff --git a/common.quota b/common.quota index a00b832e..51d9586d 100644 --- a/common.quota +++ b/common.quota @@ -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 -- 2.30.2