From: Anand Jain <anand.jain@oracle.com>
To: Boris Burkov <boris@bur.io>,
linux-btrfs@vger.kernel.org, kernel-team@fb.com,
fstests@vger.kernel.org
Subject: Re: [PATCH v4 1/6] common: refactor sysfs_attr functions
Date: Fri, 29 Sep 2023 16:23:55 +0800 [thread overview]
Message-ID: <146c1ed5-d914-cd9e-8164-165eb1a9f23c@oracle.com> (raw)
In-Reply-To: <0714f6b21000181ab43d3085903859b8ae1e1a32.1695942727.git.boris@bur.io>
On 29/09/2023 07:16, Boris Burkov wrote:
> Expand the has/get/require functions to allow passing a dev by
> parameter, and implement the test_dev specific one in terms of the new
> generic one.
>
> Signed-off-by: Boris Burkov <boris@bur.io>
looks good. The diff is confusing.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
a small nit below.
>
> +# Test for the existence of a sysfs entry at /sys/fs/$FSTYP/$DEV/$ATTR
> +#
> +# All arguments are necessary, and in this order:
> +# - dev: device name, e.g. $SCRATCH_DEV
> +# - attr: path name under /sys/fs/$FSTYP/$dev
> +#
> +# Usage example:
> +# _has_fs_sysfs_attr /dev/mapper/scratch-dev error/fail_at_unmount
> +_has_fs_sysfs_attr()
> +{
> + local dev=$1
> + local attr=$2
> +
> + if [ ! -b "$dev" -o -z "$attr" ];then
> + _fail "Usage: _get_fs_sysfs_attr <mounted_device> <attr>"
^^^
_has_fs_sysfs_attr
No need to resend.
Thanks, Anand
> + fi
> +
> + local dname=$(_fs_sysfs_dname $dev)
> +
> + test -e /sys/fs/${FSTYP}/${dname}/${attr}
> +}
> +
> +# Require the existence of a sysfs entry at /sys/fs/$FSTYP/$DEV/$ATTR
> +# All arguments are necessary, and in this order:
> +# - dev: device name, e.g. $SCRATCH_DEV
> +# - attr: path name under /sys/fs/$FSTYP/$dev
> +#
> +# Usage example:
> +# _require_fs_sysfs_attr /dev/mapper/scratch-dev error/fail_at_unmount
> +_require_fs_sysfs_attr()
> +{
> + _has_fs_sysfs_attr "$@" && return
> +
> + local dev=$1
> + local attr=$2
> + local dname=$(_fs_sysfs_dname $dev)
> +
> + _notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr}"
> +}
> +
> +# Test for the existence of a sysfs entry at /sys/fs/$FSTYP/DEV/$ATTR
> +#
> +# Only one argument is needed:
> +# - attr: path name under /sys/fs/$FSTYP/DEV
> +#
> +# Usage example:
> +# _has_fs_sysfs error/fail_at_unmount
> +_has_fs_sysfs()
> +{
> + _has_fs_sysfs_attr $TEST_DEV "$@"
> +}
> +
> +# Require the existence of a sysfs entry at /sys/fs/$FSTYP/DEV/$ATTR
> +_require_fs_sysfs()
> +{
> + _has_fs_sysfs "$@" && return
> +
> + local attr=$1
> + local dname=$(_short_dev $TEST_DEV)
> +
> + _notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr}"
> +}
> +
> # Generic test for specific filesystem feature.
> # Currently only implemented to test overlayfs features.
> _require_scratch_feature()
next prev parent reply other threads:[~2023-09-29 8:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 23:16 [PATCH v4 0/6] btrfs: simple quotas fstests Boris Burkov
2023-09-28 23:16 ` [PATCH v4 1/6] common: refactor sysfs_attr functions Boris Burkov
2023-09-29 8:23 ` Anand Jain [this message]
2023-09-28 23:16 ` [PATCH v4 2/6] btrfs: quota mode helpers Boris Burkov
2023-09-29 8:57 ` Anand Jain
2023-09-29 9:11 ` Anand Jain
2023-09-28 23:16 ` [PATCH v4 3/6] btrfs/301: new test for simple quotas Boris Burkov
2023-09-28 23:16 ` [PATCH v4 4/6] btrfs: quota rescan helpers Boris Burkov
2023-09-29 9:14 ` Anand Jain
2023-09-28 23:16 ` [PATCH v4 5/6] btrfs: use new rescan wrapper Boris Burkov
2023-09-29 9:28 ` Anand Jain
2023-09-28 23:16 ` [PATCH v4 6/6] btrfs: skip squota incompatible tests Boris Burkov
2023-09-29 9:37 ` Anand Jain
2023-09-29 9:42 ` Anand Jain
2023-09-29 16:57 ` Boris Burkov
2023-09-29 17:28 ` Boris Burkov
2023-09-29 17:43 ` [PATCH] btrfs: fix rescan helper Boris Burkov
2023-09-30 9:37 ` Anand Jain
2023-09-30 9:45 ` [PATCH v4 0/6] btrfs: simple quotas fstests Anand Jain
2023-10-05 8:08 ` Anand Jain
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=146c1ed5-d914-cd9e-8164-165eb1a9f23c@oracle.com \
--to=anand.jain@oracle.com \
--cc=boris@bur.io \
--cc=fstests@vger.kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@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).