common: open files in ro mode for extent and hole count helpers
[xfstests-dev.git] / common / rc
index a2a28f321ad6e4d0366c4c9527085924b78347c8..238ffef9d959e5309abcb73724c687e62d7877b5 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -165,6 +165,11 @@ if [ ! -z "$REPORT_LIST" ]; then
        _assert_report_list
 fi
 
+_get_filesize()
+{
+    stat -c %s "$1"
+}
+
 _mount()
 {
     $MOUNT_PROG `_mount_ops_filter $*`
@@ -2186,7 +2191,7 @@ _require_xfs_io_command()
                        _notrun "xfs_io $command support is missing"
                ;;
        "utimes" )
-               testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
+               testio=`$XFS_IO_PROG -f -c "utimes 0 0 0 0" $testfile 2>&1`
                ;;
        "syncfs")
                touch $testfile
@@ -3194,12 +3199,12 @@ _require_metadata_journaling()
 
 _count_extents()
 {
-       $XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep -v hole | wc -l
+       $XFS_IO_PROG -r -c "fiemap" $1 | tail -n +2 | grep -v hole | wc -l
 }
 
 _count_holes()
 {
-       $XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep hole | wc -l
+       $XFS_IO_PROG -r -c "fiemap" $1 | tail -n +2 | grep hole | wc -l
 }
 
 _count_attr_extents()