From: Zorro Lang <zlang@kernel.org>
To: fstests@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org,
Anand Suveer Jain <asj@kernel.org>, Chao Yu <chao@kernel.org>
Subject: [PATCH 2/5] common/sysfs: adjust function naming
Date: Tue, 15 Sep 2026 01:25:06 +0800 [thread overview]
Message-ID: <20260914172509.3799016-3-zlang@kernel.org> (raw)
In-Reply-To: <20260914172509.3799016-1-zlang@kernel.org>
Add the _dev_ infix to helper functions associated with
/sys/fs/$FSTYP/<devices> to distinguish them from upcoming
/sys/fs/$FSTYP/features/ related helpers.
Signed-off-by: Zorro Lang <zlang@kernel.org>
---
common/sysfs | 66 ++++++++++++++++++++++++-------------------------
tests/btrfs/253 | 2 +-
tests/btrfs/329 | 4 +--
tests/btrfs/334 | 2 +-
4 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/common/sysfs b/common/sysfs
index c36ab426..ede5bcb6 100644
--- a/common/sysfs
+++ b/common/sysfs
@@ -12,8 +12,8 @@
# - policy: policy within /sys/fs/$FSTYP/$dev
#
# Usage example:
-# _has_fs_sysfs_attr_policy /dev/mapper/scratch-dev read_policy round-robin
-_has_fs_sysfs_attr_policy()
+# _has_fs_sysfs_dev_policy /dev/mapper/scratch-dev read_policy round-robin
+_has_fs_sysfs_dev_policy()
{
local dev=$1
local attr=$2
@@ -21,7 +21,7 @@ _has_fs_sysfs_attr_policy()
if [ ! -b "$dev" -o -z "$attr" -o -z "$policy" ]; then
_fail \
- "Usage: _has_fs_sysfs_attr_policy <mounted_device> <attr> <policy>"
+ "Usage: _has_fs_sysfs_dev_policy <mounted_device> <attr> <policy>"
fi
local dname=$(_fs_sysfs_dname $dev)
@@ -40,10 +40,10 @@ _has_fs_sysfs_attr_policy()
# - policy: mentioned in /sys/fs/$FSTYP/$dev/$attr
#
# Usage example:
-# _require_fs_sysfs_attr_policy /dev/mapper/scratch-dev read_policy round-robin
-_require_fs_sysfs_attr_policy()
+# _require_fs_sysfs_dev_policy /dev/mapper/scratch-dev read_policy round-robin
+_require_fs_sysfs_dev_policy()
{
- _has_fs_sysfs_attr_policy "$@" && return
+ _has_fs_sysfs_dev_policy "$@" && return
local dev=$1
local attr=$2
@@ -53,7 +53,7 @@ _require_fs_sysfs_attr_policy()
_notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr} ${policy}"
}
-_set_sysfs_policy()
+_set_sysfs_dev_policy()
{
local dev=$1
local attr=$2
@@ -77,7 +77,7 @@ _set_sysfs_policy()
esac
}
-_set_sysfs_policy_must_fail()
+_set_sysfs_dev_policy_must_fail()
{
local dev=$1
local attr=$2
@@ -91,18 +91,18 @@ _set_sysfs_policy_must_fail()
# Verify sysfs attribute rejects invalid input.
# Usage syntax:
-# _verify_sysfs_syntax <$dev> <$attr> <$policy> [$value]
+# _verify_sysfs_dev_syntax <$dev> <$attr> <$policy> [$value]
# Examples:
-# _verify_sysfs_syntax $TEST_DEV read_policy pid
-# _verify_sysfs_syntax $TEST_DEV read_policy round-robin 4k
+# _verify_sysfs_dev_syntax $TEST_DEV read_policy pid
+# _verify_sysfs_dev_syntax $TEST_DEV read_policy round-robin 4k
# Note:
# Testcase must include
# . ./common/filter
# Prerequisite checks are kept outside this function
# to make them clear to the test case, rather than hiding
# them deep inside another function.
-# _require_fs_sysfs_attr_policy $TEST_DEV $attr $policy
-_verify_sysfs_syntax()
+# _require_fs_sysfs_dev_policy $TEST_DEV $attr $policy
+_verify_sysfs_dev_syntax()
{
local dev=$1
local attr=$2
@@ -110,23 +110,23 @@ _verify_sysfs_syntax()
local value=$4
# Test policy specified wrongly. Must fail.
- _set_sysfs_policy_must_fail $dev $attr "'$policy $policy'"
- _set_sysfs_policy_must_fail $dev $attr "'$policy t'"
- _set_sysfs_policy_must_fail $dev $attr "' '"
- _set_sysfs_policy_must_fail $dev $attr "'${policy} n'"
- _set_sysfs_policy_must_fail $dev $attr "'n ${policy}'"
- _set_sysfs_policy_must_fail $dev $attr "' ${policy}'"
- _set_sysfs_policy_must_fail $dev $attr "' ${policy} '"
- _set_sysfs_policy_must_fail $dev $attr "'${policy} '"
- _set_sysfs_policy_must_fail $dev $attr _${policy}
- _set_sysfs_policy_must_fail $dev $attr ${policy}_
- _set_sysfs_policy_must_fail $dev $attr _${policy}_
- _set_sysfs_policy_must_fail $dev $attr ${policy}:
+ _set_sysfs_dev_policy_must_fail $dev $attr "'$policy $policy'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'$policy t'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "' '"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'${policy} n'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'n ${policy}'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "' ${policy}'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "' ${policy} '"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'${policy} '"
+ _set_sysfs_dev_policy_must_fail $dev $attr _${policy}
+ _set_sysfs_dev_policy_must_fail $dev $attr ${policy}_
+ _set_sysfs_dev_policy_must_fail $dev $attr _${policy}_
+ _set_sysfs_dev_policy_must_fail $dev $attr ${policy}:
# Test policy longer than 32 chars fails stable.
- _set_sysfs_policy_must_fail $dev $attr 'jfdkkkkjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjffjfjfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
+ _set_sysfs_dev_policy_must_fail $dev $attr 'jfdkkkkjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjffjfjfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
# Test policy specified correctly. Must pass.
- _set_sysfs_policy $dev $attr $policy
+ _set_sysfs_dev_policy $dev $attr $policy
# If the policy has no value return
if [[ -z $value ]]; then
@@ -134,12 +134,12 @@ _verify_sysfs_syntax()
fi
# Test value specified wrongly. Must fail.
- _set_sysfs_policy_must_fail $dev $attr "'$policy: $value'"
- _set_sysfs_policy_must_fail $dev $attr "'$policy:$value '"
- _set_sysfs_policy_must_fail $dev $attr "'$policy:$value typo'"
- _set_sysfs_policy_must_fail $dev $attr "'$policy:${value}typo'"
- _set_sysfs_policy_must_fail $dev $attr "'$policy :$value'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'$policy: $value'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'$policy:$value '"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'$policy:$value typo'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'$policy:${value}typo'"
+ _set_sysfs_dev_policy_must_fail $dev $attr "'$policy :$value'"
# Test policy and value all specified correctly. Must pass.
- _set_sysfs_policy $dev $attr $policy:$value
+ _set_sysfs_dev_policy $dev $attr $policy:$value
}
diff --git a/tests/btrfs/253 b/tests/btrfs/253
index 5843643d..b1443328 100755
--- a/tests/btrfs/253
+++ b/tests/btrfs/253
@@ -226,7 +226,7 @@ alloc_size "Data" FOURTH_DATA_SIZE_MB
# Force chunk allocation of system block type must fail.
#
echo "Force allocation of system block type must fail."
-_set_sysfs_policy_must_fail ${SCRATCH_BDEV} allocation/system/force_chunk_alloc 1
+_set_sysfs_dev_policy_must_fail ${SCRATCH_BDEV} allocation/system/force_chunk_alloc 1
#
# Verification of initial allocation.
diff --git a/tests/btrfs/329 b/tests/btrfs/329
index f4fadded..86e9a380 100755
--- a/tests/btrfs/329
+++ b/tests/btrfs/329
@@ -13,9 +13,9 @@ _begin_fstest auto quick
. ./common/filter
_require_test
-_require_fs_sysfs_attr_policy $TEST_DEV read_policy round-robin
+_require_fs_sysfs_dev_policy $TEST_DEV read_policy round-robin
-_verify_sysfs_syntax $TEST_DEV read_policy round-robin 4096
+_verify_sysfs_dev_syntax $TEST_DEV read_policy round-robin 4096
status=0
exit
diff --git a/tests/btrfs/334 b/tests/btrfs/334
index 08b66dc7..ae9b72b7 100755
--- a/tests/btrfs/334
+++ b/tests/btrfs/334
@@ -15,7 +15,7 @@ _begin_fstest auto quick
_require_test
_require_fs_sysfs_dev_attr $TEST_DEV allocation/data/chunk_size
-_verify_sysfs_syntax $TEST_DEV allocation/data/chunk_size 256m
+_verify_sysfs_dev_syntax $TEST_DEV allocation/data/chunk_size 256m
status=0
exit
--
2.55.0
next prev parent reply other threads:[~2026-09-14 17:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 17:25 [PATCH 0/5] Refactor *_fs_sysfs_* helpers Zorro Lang
2026-09-14 17:25 ` [PATCH 1/5] fstests: consolidate _require_fs_sysfs and _require_fs_sysfs_attr Zorro Lang
2026-09-15 6:56 ` Christoph Hellwig
2026-09-15 14:33 ` Zorro Lang
2026-09-14 17:25 ` Zorro Lang [this message]
2026-09-15 6:57 ` [PATCH 2/5] common/sysfs: adjust function naming Christoph Hellwig
2026-09-15 14:46 ` Zorro Lang
2026-09-14 17:25 ` [PATCH 3/5] common/rc: add helpers for /sys/fs/$FSTYP/features/ Zorro Lang
2026-09-14 17:25 ` [PATCH 4/5] common/rc: use common helper in _require_fanotify_ioerrors for f2fs Zorro Lang
2026-09-14 17:25 ` [PATCH 5/5] fstests: replace btrfs specific helpers with common sysfs helpers Zorro Lang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260914172509.3799016-3-zlang@kernel.org \
--to=zlang@kernel.org \
--cc=asj@kernel.org \
--cc=chao@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).