From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
Yosry Ahmed <yosryahmed@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] seq_buf: add seq_buf_printk() helper
Date: Tue, 11 Apr 2023 23:24:27 +0900 [thread overview]
Message-ID: <20230411142427.GB25053@google.com> (raw)
In-Reply-To: <ZDVPJnx9tjetdm9K@alley>
On (23/04/11 14:14), Petr Mladek wrote:
> We might want to somehow distinguish that this is actually
> printing (reading) the context of the buffer.
>
> The name is similar to seq_buf_printf() and seq_buf_vprintf()
> whose are wrinting into the buffer.
>
> What about the following?
>
> + seq_buf_printf_seq() like the existing seq_buf_print_seq()
> + seq_buf_to_printk() like the existing seq_buf_to_user()
>
> I personally prefer seq_buf_to_printk() because it looks more
> selfexplaining to me.
I like seq_buf_to_printk().
> > +{
> > + const char *start, *lf;
> > + int len;
> > +
> > + if (s->size == 0)
> > + return;
> > +
> > + start = s->buffer;
> > + while ((lf = strchr(start, '\n'))) {
>
> We should rather use strnchr(). It seems that the trailing '\0' is
> not guaranteed. For example, seq_buf_putc() just adds the given
> character at the end.
Good point.
prev parent reply other threads:[~2023-04-11 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 2:55 [PATCH] seq_buf: add seq_buf_printk() helper Sergey Senozhatsky
2023-04-11 3:45 ` Yosry Ahmed
2023-04-11 12:14 ` Petr Mladek
2023-04-11 14:10 ` Steven Rostedt
2023-04-11 14:27 ` Sergey Senozhatsky
2023-04-11 14:24 ` Sergey Senozhatsky [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=20230411142427.GB25053@google.com \
--to=senozhatsky@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=yosryahmed@google.com \
/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