aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2023-11-02 19:28:19 +0800
committerZorro Lang <zlang@kernel.org>2023-11-16 10:42:39 +0800
commit24c58f2d973c855cc0af0a12e225fd2f07b342d4 (patch)
treee7a663a429e7aaad0232f9b5ec7d64bb98871440
parent22bca8d9a6d9fba0ac240ed95a42f44110e31910 (diff)
downloadxfstests-dev-24c58f2d973c855cc0af0a12e225fd2f07b342d4.tar.gz
common/btrfs: add helper _has_btrfs_sysfs_feature_attr
With this helper, btrfs test cases can now check if a particular feature is implemented in the kernel. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--common/btrfs12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/btrfs b/common/btrfs
index c3bffd2ae3..fbc26181f7 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -753,3 +753,15 @@ _require_scratch_enable_simple_quota()
_notrun "simple quotas not available"
_scratch_unmount
}
+
+_has_btrfs_sysfs_feature_attr()
+{
+ local feature_attr=$1
+
+ [ -z $feature_attr ] && \
+ _fail "Missing feature name argument for _has_btrfs_sysfs_attr"
+
+ modprobe btrfs &> /dev/null
+
+ test -e /sys/fs/btrfs/features/$feature_attr
+}