From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751886AbdH3BtM (ORCPT ); Tue, 29 Aug 2017 21:49:12 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33551 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751708AbdH3BtL (ORCPT ); Tue, 29 Aug 2017 21:49:11 -0400 Date: Wed, 30 Aug 2017 10:51:34 +0900 From: Sergey Senozhatsky To: Steven Rostedt Cc: Sergey Senozhatsky , Linus Torvalds , Pavel Machek , Sergey Senozhatsky , Petr Mladek , Jan Kara , Andrew Morton , Jiri Slaby , Andreas Mohr , Tetsuo Handa , Linux Kernel Mailing List Subject: Re: printk: what is going on with additional newlines? Message-ID: <20170830015134.GD654@jagdpanzerIV.localdomain> References: <20170828090521.GA25025@amd> <20170828102830.GA403@jagdpanzerIV.localdomain> <20170828122109.GA532@jagdpanzerIV.localdomain> <20170828124634.GD492@amd> <20170829134048.GA437@jagdpanzerIV.localdomain> <20170829195013.5048dc42@gandalf.local.home> <20170830010348.GB654@jagdpanzerIV.localdomain> <20170829211046.74644c8a@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170829211046.74644c8a@gandalf.local.home> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (08/29/17 21:10), Steven Rostedt wrote: > > On (08/29/17 19:50), Steven Rostedt wrote: > > [..] > > > > A private buffer has none of those issues. > > > > > > What about using the seq_buf*() then? > > > > > > struct seq_buf s; > > > > > > buf = kmalloc(mysize); > > > seq_buf_init(&s, buf, mysize); > > > > > > seq_printf(&s,"blah blah %d", bah_blah); > > > [...] > > > seq_printf(&s, "my last print\n"); > > > > > > printk("%.*s", s.len, s.buffer); > > > > > > kfree(buf); > > > > could do. for a single continuation line printk("%.*s", s.len, s.buffer) > > this will work perfectly fine. for a more general case - backtraces, dumps, > > etc. - this requires some tweaks. > > We could simply add a seq_buf_printk() that is implemented in the printk > proper, to parse the seq_buf buffer properly, and add the timestamps and > such. sounds like a plan :) -ss