The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <senozhatsky@chromium.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:27:43 +0900	[thread overview]
Message-ID: <20230411142743.GC25053@google.com> (raw)
In-Reply-To: <20230411101033.1868494e@gandalf.local.home>

On (23/04/11 10:10), Steven Rostedt wrote:
[..]
> seq_buf came from trace_seq to become more generic. trace_seq is also part
> of the libtraceevent library, and there we have:
> 
>   trace_seq_do_printf()
> 
>  https://www.trace-cmd.org/Documentation/libtraceevent/libtraceevent-tseq.html
> 
> That is to differentiate the trace_seq_printf() function. And does what
> this function is doing (dumping the buffer).
> 
> Perhaps we should use the precedence of that function and have:
> 
>   seq_buf_do_printk()

OK, I'll rename the helper to seq_buf_do_printk().

> > 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.
> 
> I think we should add a seq_buf_terminate() that adds the '\0' to the
> buffer. There's one for user space (trace_seq_terminate()).
> 
> It's a nop if it already has the '\0'.
> 
> I think we should add that first, and then we can use that when entering
> this function.

Sounds good. This also should address Petr's concern.

  reply	other threads:[~2023-04-11 14:28 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 [this message]
2023-04-11 14:24   ` Sergey Senozhatsky

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=20230411142743.GC25053@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