common/quota: remove redundant SELinux detection code
[xfstests-dev.git] / common / quota
index fb2b2a041cd20a8cff9359ad75bcb8434c744971..f49728c24f7105995c8af2c10e287b9af96098fd 100644 (file)
@@ -34,7 +34,7 @@ _require_quota()
            _notrun "Installed kernel does not support quotas"
        fi
        ;;
-    gfs2)
+    gfs2|ocfs2)
        ;;
     xfs)
        if [ ! -f /proc/fs/xfs/xqmstat ]; then
@@ -51,13 +51,6 @@ _require_quota()
        _notrun "disk quotas not supported by this filesystem type: $FSTYP"
        ;;
     esac
-
-    # SELinux adds extra xattrs which can mess up our expected output.
-    # So, mount with a context, and they won't be created
-    # nfs_t is a "liberal" context so we can use it.
-    if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
-        export SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0"
-    fi
 }
 
 #
@@ -108,6 +101,16 @@ _require_prjquota()
     fi
 }
 
+#
+# Do we have GETNEXTQUOTA?  Querying ID 0 should work.
+#
+_require_getnextquota()
+{
+       _require_test_program "test-nextquota"
+       $here/src/test-nextquota -i 0 -u -d $SCRATCH_DEV &> $seqres.full || \
+               _notrun "No GETNEXTQUOTA support"
+}
+
 #
 # ext4 (for now) is unique in that we must enable the project quota feature
 # prior to mount.  This is a relatively new feature ...
@@ -139,7 +142,7 @@ _file_as_id()
 
     parent=`dirname $1`
     if [ $3 = p ]; then
-       echo PARENT: xfs_io -r -c "chproj $2" -c "chattr +P" $parent >>$seqres.full
+       echo PARENT: $XFS_IO_PROG -r -c "chproj $2" -c "chattr +P" $parent >>$seqres.full
        $XFS_IO_PROG -r -c "chproj $2" -c "chattr +P" $parent >>$seqres.full 2>&1
        magik='$>'      # (irrelevent, above set projid-inherit-on-parent)
     elif [ $3 = u ]; then
@@ -165,7 +168,7 @@ EOF
 #      exec "dd if=/dev/zero of=$1 bs=$4 count=$5 >>$seqres.full 2>&1";
 
     if [ $3 = p ]; then
-       echo PARENT: xfs_io -r -c "chproj 0" -c "chattr -P" $parent >>$seqres.full
+       echo PARENT: $XFS_IO_PROG -r -c "chproj 0" -c "chattr -P" $parent >>$seqres.full
        $XFS_IO_PROG -r -c "chproj 0" -c "chattr -P" $parent >>$seqres.full 2>&1
     fi
 }
@@ -292,5 +295,15 @@ _check_quota_usage()
        }
 }
 
+# Report the block usage of root, $qa_user, and nobody
+_report_quota_blocks() {
+       repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}'
+}
+
+# Report the inode usage of root, $qa_user, and nobody
+_report_quota_inodes() {
+       repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}'
+}
+
 # make sure this script returns success
 /bin/true