From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752010AbdH3BKu (ORCPT ); Tue, 29 Aug 2017 21:10:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:43824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbdH3BKt (ORCPT ); Tue, 29 Aug 2017 21:10:49 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D91B32133E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Tue, 29 Aug 2017 21:10:46 -0400 From: Steven Rostedt To: Sergey Senozhatsky Cc: 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: <20170829211046.74644c8a@gandalf.local.home> In-Reply-To: <20170830010348.GB654@jagdpanzerIV.localdomain> References: <20170815025625.1977-1-sergey.senozhatsky@gmail.com> <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> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 30 Aug 2017 10:03:48 +0900 Sergey Senozhatsky wrote: > Hello, > > 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. -- Steve