From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Daniel Wagner <dwagner@suse.de>,
linux-block@vger.kernel.org, Daniel Wagner <wagi@kernel.org>,
John Meneghini <jmeneghi@redhat.com>
Subject: Re: [PATCH blktests 2/3] common/rc: add _echo() function to trace sysfs attribute writes
Date: Thu, 14 May 2026 18:41:39 +0900 [thread overview]
Message-ID: <agWXr9Yntf4OiQ9e@shinmob> (raw)
In-Reply-To: <3ef4e2a4-c0ec-4040-a4c7-3687ed7e2d93@acm.org>
On May 13, 2026 / 10:07, Bart Van Assche wrote:
> On 5/13/26 7:05 AM, Daniel Wagner wrote:
> > On Wed, May 13, 2026 at 08:23:25PM +0900, Shin'ichiro Kawasaki wrote:
> > > +# Echo a value to a file. This wrapper is used to trace sysfs attribute writes
> > > +# when the --cmd-trace option is enabled.
> > > +_echo() {
> > > + echo "$1" > "$2"
> > > +}
> >
> > Stupid question, can't we override the echo function, something like this:
> >
> > echo() {
> > builtin echo "$@"
> > builtin echo "$@" >> "/tmp/debug_log.txt"
> > }
>
> How can this work since the sysfs/debugfs/configfs attribute is not an
> argument of the echo command?
I guess Daniel's idea was to do as follows:
echo() {
builtin echo "$@"
builtin echo "$@" >> "${seqres}.cmdtrace"
}
This can capture both the value and the filename in the .cmdtrace file.
Said that, this will not work when printf is used to write to
sysfs/debugfs/configfs attributes. So, I'm tempted to Bart's idea to
rename _echo() to _set_attr().
next prev parent reply other threads:[~2026-05-14 9:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 11:23 [PATCH blktests 0/3] introduce command trace feature Shin'ichiro Kawasaki
2026-05-13 11:23 ` [PATCH blktests 1/3] check: add --cmd-trace option Shin'ichiro Kawasaki
2026-05-13 17:08 ` Bart Van Assche
2026-05-14 9:36 ` Shin'ichiro Kawasaki
2026-05-14 16:12 ` Bart Van Assche
2026-05-13 11:23 ` [PATCH blktests 2/3] common/rc: add _echo() function to trace sysfs attribute writes Shin'ichiro Kawasaki
2026-05-13 14:05 ` Daniel Wagner
2026-05-13 17:07 ` Bart Van Assche
2026-05-14 9:41 ` Shin'ichiro Kawasaki [this message]
2026-05-14 10:36 ` Daniel Wagner
2026-05-13 17:17 ` Bart Van Assche
2026-05-14 9:45 ` Shin'ichiro Kawasaki
2026-05-14 15:58 ` Bart Van Assche
2026-05-13 11:23 ` [PATCH blktests 3/3] common/nvme, nvme/rc: use _echo() " Shin'ichiro Kawasaki
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=agWXr9Yntf4OiQ9e@shinmob \
--to=shinichiro.kawasaki@wdc.com \
--cc=bvanassche@acm.org \
--cc=dwagner@suse.de \
--cc=jmeneghi@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=wagi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.