From: Eryu Guan <eguan@redhat.com>
To: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Cc: fstests@vger.kernel.org, linux-mtd@lists.infradead.org, richard@nod.at
Subject: Re: [PATCH v2 1/4] Add tests for character devices
Date: Wed, 31 May 2017 19:07:59 +0800 [thread overview]
Message-ID: <20170531110759.GR23805@eguan.usersys.redhat.com> (raw)
In-Reply-To: <20170531085433.26865-2-david.oberhollenzer@sigma-star.at>
On Wed, May 31, 2017 at 10:54:30AM +0200, David Oberhollenzer wrote:
> Implement _is_char_dev similar to _is_block_dev to test for
> character devices.
>
> Add a _require_local_device test. This test is similar to
> _require_block_device but checks if the path refers to a
> block or a character device.
>
> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
v2 looks fine to me overall, though I don't have the environment to test
ubifs support.
I have some nits below and to other patches :)
> ---
> common/rc | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/common/rc b/common/rc
> index ba215961..ae8ea550 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1363,6 +1363,26 @@ _is_block_dev()
> fi
> }
>
> +# returns device number if a file is a character device
> +#
> +_is_char_dev()
> +{
> + if [ $# -ne 1 ]
> + then
> + echo "Usage: _is_char_dev dev" 1>&2
> + exit 1
> + fi
> +
> + _dev=$1
> + if [ -L "${_dev}" ]; then
> + _dev=`readlink -f "${_dev}"`
> + fi
> +
> + if [ -c "${_dev}" ]; then
> + src/lstat64 "${_dev}" | $AWK_PROG '/Device type:/ { print $9 }'
> + fi
> +}
> +
Please use one tab for indention for new code, and place 'then' on the
same line as 'if'. (I know this is copied from the old _is_block_dev(),
and the new code style is not documented anywhere yet.. sorry about
that).
Thanks,
Eryu
> # Do a command, log it to $seqres.full, optionally test return status
> # and die if command fails. If called with one argument _do executes the
> # command, logs it, and returns its exit status. With two arguments _do
> @@ -1791,6 +1811,23 @@ _require_block_device()
> fi
> }
>
> +# this test requires a path to refere to a local block or character device
> +# $1 - device
> +_require_local_device()
> +{
> + if [ -z "$1" ]; then
> + echo "Usage: _require_local_device <dev>" 1>&2
> + exit 1
> + fi
> + if [ "`_is_block_dev "$1"`" != "" ]; then
> + return 0
> + fi
> + if [ "`_is_char_dev "$1"`" != "" ]; then
> + return 0
> + fi
> + _notrun "require $1 to be local device"
> +}
> +
> # brd based ram disks erase the device when they receive a flush command when no
> # active references are present. This causes problems for DM devices sitting on
> # top of brd devices as DM doesn't hold active references to the brd device.
> --
> 2.12.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-05-31 11:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 8:54 [PATCH v2] Add UBIFS support to xfstests David Oberhollenzer
2017-05-31 8:54 ` [PATCH v2 1/4] Add tests for character devices David Oberhollenzer
2017-05-31 11:07 ` Eryu Guan [this message]
2017-05-31 8:54 ` [PATCH v2 2/4] Add support for UBIFS David Oberhollenzer
2017-05-31 11:12 ` Eryu Guan
2017-05-31 8:54 ` [PATCH v2 3/4] Accept failing with EPERM in addition to ENOKEY for rename without key David Oberhollenzer
2017-05-31 8:54 ` [PATCH v2 4/4] Fix block device requirements and manual scratch mounts David Oberhollenzer
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=20170531110759.GR23805@eguan.usersys.redhat.com \
--to=eguan@redhat.com \
--cc=david.oberhollenzer@sigma-star.at \
--cc=fstests@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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