From: Shuah Khan <skhan@linuxfoundation.org>
To: Rong Tao <rtoax@foxmail.com>, shuah@kernel.org
Cc: rongtao@cestc.cn,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v2] selftests: splice: Add usage() to splice_read.c
Date: Tue, 3 Sep 2024 16:07:53 -0600 [thread overview]
Message-ID: <52a6d4ab-99a4-46b3-bd43-58054602d86b@linuxfoundation.org> (raw)
In-Reply-To: <tencent_0AEA8FB622DE1A740841643D5F36ABF8BD0A@qq.com>
On 8/30/24 23:14, Rong Tao wrote:
> From: Rong Tao <rongtao@cestc.cn>
>
> Give the programmer more help information to inform the program on how to
> use it.
>
> Signed-off-by: Rong Tao <rongtao@cestc.cn>
> ---
> tools/testing/selftests/splice/splice_read.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/splice/splice_read.c b/tools/testing/selftests/splice/splice_read.c
> index 46dae6a25cfb..73a8bc146f97 100644
> --- a/tools/testing/selftests/splice/splice_read.c
> +++ b/tools/testing/selftests/splice/splice_read.c
> @@ -9,6 +9,12 @@
> #include <sys/types.h>
> #include <sys/stat.h>
>
> +void usage(const char *prog)
> +{
> + fprintf(stderr, "Usage: %s INPUT [BYTES]\n", prog);
> + fprintf(stderr, " %s /etc/os-release | cat\n", prog);
How does replacing %s INPUT [BYTES]\n", prog with /etc/os-release | cat\n" do?
Also what happens on distros that don't have os-release file?
> +}
> +
> int main(int argc, char *argv[])
> {
> int fd;
> @@ -16,7 +22,7 @@ int main(int argc, char *argv[])
> ssize_t spliced;
>
> if (argc < 2) {
> - fprintf(stderr, "Usage: %s INPUT [BYTES]\n", argv[0]);
> + usage(argv[0]);
> return EXIT_FAILURE;
> }
>
> @@ -49,6 +55,7 @@ int main(int argc, char *argv[])
> size, SPLICE_F_MOVE);
> if (spliced < 0) {
> perror("splice");
> + usage(argv[0]);
> return EXIT_FAILURE;
> }
>
I don't understand how this change helps user.
thanks,
-- Shuah
prev parent reply other threads:[~2024-09-03 22:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-31 5:14 [PATCH v2] selftests: splice: Add usage() to splice_read.c Rong Tao
2024-09-03 22:07 ` Shuah Khan [this message]
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=52a6d4ab-99a4-46b3-bd43-58054602d86b@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=rongtao@cestc.cn \
--cc=rtoax@foxmail.com \
--cc=shuah@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