From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751888AbdH3BB1 (ORCPT ); Tue, 29 Aug 2017 21:01:27 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:33829 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751297AbdH3BBZ (ORCPT ); Tue, 29 Aug 2017 21:01:25 -0400 Date: Wed, 30 Aug 2017 10:03:48 +0900 From: Sergey Senozhatsky To: Steven Rostedt Cc: Linus Torvalds , Sergey Senozhatsky , 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: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170829195013.5048dc42@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 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. -ss