mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
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.
This commit is contained in:
@@ -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
|
cat >$tmp.projects <<EOF
|
||||||
1:$SCRATCH_MNT
|
1:$SCRATCH_MNT
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -44,9 +44,7 @@ _require_quota
|
|||||||
_require_nobody
|
_require_nobody
|
||||||
|
|
||||||
# setup a default run
|
# setup a default run
|
||||||
if [ -z "$MOUNT_OPTIONS" ]; then
|
_qmount_option uquota
|
||||||
export MOUNT_OPTIONS="-o uquota"
|
|
||||||
fi
|
|
||||||
|
|
||||||
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
|
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
|
||||||
cat $tmp.mkfs >>$seq.full
|
cat $tmp.mkfs >>$seq.full
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ _exercise()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_scratch_mkfs_xfs $SCRATCH_DEV >/dev/null 2>&1
|
_scratch_mkfs_xfs $SCRATCH_DEV >/dev/null 2>&1
|
||||||
export MOUNT_OPTIONS="-o uquota,gquota"
|
_qmount_option "uquota,gquota"
|
||||||
_qmount
|
_qmount
|
||||||
if src/feature -G $SCRATCH_DEV ; then
|
if src/feature -G $SCRATCH_DEV ; then
|
||||||
:
|
:
|
||||||
@@ -95,19 +95,20 @@ else
|
|||||||
fi
|
fi
|
||||||
umount $SCRATCH_MNT 2>/dev/null
|
umount $SCRATCH_MNT 2>/dev/null
|
||||||
|
|
||||||
export MOUNT_OPTIONS=""
|
_qmount_option "rw" # no quota options
|
||||||
echo "*** Default mount options"
|
echo "*** Default mount options"
|
||||||
_exercise
|
_exercise
|
||||||
|
|
||||||
export MOUNT_OPTIONS="-o uquota"
|
_qmount_option "uquota"
|
||||||
echo "*** User quota mount option"
|
echo "*** User quota mount option"
|
||||||
_exercise
|
_exercise
|
||||||
|
|
||||||
export MOUNT_OPTIONS="-o gquota"
|
export MOUNT_OPTIONS="-o gquota"
|
||||||
|
_qmount_option "gquota"
|
||||||
echo "*** Group quota mount option"
|
echo "*** Group quota mount option"
|
||||||
_exercise
|
_exercise
|
||||||
|
|
||||||
export MOUNT_OPTIONS="-o uquota,gquota"
|
_qmount_option "uquota,gquota"
|
||||||
echo "*** User and Group quota mount options"
|
echo "*** User and Group quota mount options"
|
||||||
_exercise
|
_exercise
|
||||||
|
|
||||||
|
|||||||
@@ -153,5 +153,33 @@ _qsetup()
|
|||||||
echo "and using type=$type id=$id" >>$seq.full
|
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
|
# make sure this script returns success
|
||||||
/bin/true
|
/bin/true
|
||||||
|
|||||||
Reference in New Issue
Block a user