[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230411142743.GC25053@google.com>
Date: Tue, 11 Apr 2023 23:27:43 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Yosry Ahmed <yosryahmed@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] seq_buf: add seq_buf_printk() helper
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.
Powered by blists - more mailing lists