Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1493833ybk; Thu, 21 May 2020 08:10:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0PlgqHvIcikSoHb1F4v+z+NNfTk/z+6uTBtaZ8zBA55yGW6C66JN/Hsv4fB0Slm1yd0u0 X-Received: by 2002:a17:906:6457:: with SMTP id l23mr3871022ejn.188.1590073846186; Thu, 21 May 2020 08:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590073846; cv=none; d=google.com; s=arc-20160816; b=Xr5E8pGHQKm8A8kDK+5l5wDNQwVSHTWzedn05apLDUrCPSiX6+SM41hKT2oIb37e29 OJtj+mOsw2hTC6/vH9oyXhLao82ybeaOTfdIGe4nxIhkSVfRHcWM9obHug7IMd9XmlQM 6s9T3TFx37KayVmLuqbZrj4ZcCOfsPV1fAOUpb0npSwJWJMt3J6CtAzB34Pm0sv1Tq5Z FT6i4FFWNhTPXudGmYQdQRalfBPSdX0m75UVBoYJ8vhI70dDHHXMHe/EjqaQrvCn4hFj e01ohUiD/jjLRsx9qYNN6dSpf0jvGOato5WYm7EH8oIjqghJZ709OP/cX+KN6PYdXUqk CL1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=LTvEEGeS3AeJSpq4ZVHIXuVyD9+KGHohS7s/D0phJak=; b=JqEHmuwWjuMUaec4LD5ra5ex/udtWNUjdq833nn3L9oh7d0pEGSXllvA2M0xL4wkge bp1VvHLOQhgnEadrNalGp3k+8bfMCNoNsy7xz+d9+ydl8qJ3Xa1olqPiNdtGFaNhqYDa 0bX+HGIsve/7H+0Vka4l1Sl85bI4ELBiEZOne9+xL0RrFb0EJrFRlvJs04CmTQfJhr3w SMCl5pF0M3XKffHvFrSQKHT9DKv0jEts8BS2Fd2zScxRYybxpSQ8Qb7lnScU19rKOexw wRi0/9ohGEeMBudrgO7BoATpV339Gpy2DQ+T5aXaN/MhZtZz/lCDJp7vrNFm4kKdXHrY r9IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=W0+hqrHw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si3544146ejj.84.2020.05.21.08.10.21; Thu, 21 May 2020 08:10:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=W0+hqrHw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729678AbgEUPIW (ORCPT + 99 others); Thu, 21 May 2020 11:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728229AbgEUPIV (ORCPT ); Thu, 21 May 2020 11:08:21 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FEC5C061A0E for ; Thu, 21 May 2020 08:08:21 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id c24so5709269qtw.7 for ; Thu, 21 May 2020 08:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LTvEEGeS3AeJSpq4ZVHIXuVyD9+KGHohS7s/D0phJak=; b=W0+hqrHwbUhpCwGT7ted1RVsLGtTjL0p0TEkD3LwLl9GRA2IdpqAWpISKTp4KrWR3G qSqgSG/IpmziIG6tYqE6Cb+i8Nrnhpk5bdKafdHXulONG7HV2EH/ErDqQVc9iHGAzHKv GDEu4sE6lpSfvwwpseoIHMT/oQqN26+4MeDlDSL/ZtkHeXVPCeA0nTGw1tc6ZrwH+WVO LXbksT7gqyfOS7p41+6N9FRDPhuKjzZYqiwnk9VJSzo1meA/2IEPFHPai/Y5SHf1TlFs 81zOrny5IBupdmdr8qdu8LxMK0fxQ9HUlICIeNy9iQR8kjZcTuLQX85d1JxJK30c4wAE jiSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=LTvEEGeS3AeJSpq4ZVHIXuVyD9+KGHohS7s/D0phJak=; b=i36kWdh2LD8jWlVYsSSW8aA1u2cjqAWvD8dL7trhaBek7ovz7E68xbRZTA6FIBvBt8 u4uwRDQ7gNALU21heBmRuYpjiS4vPqtniZFBdCyaAdklY2uhq8EeR/7AL5P+uX8OP2qg +umcQ19VGujthvRJhNV1idVVOxxwwJ2gAT6tF7FMa2m8SHt7K70sltVfF6CZg96f/x0t 0+05IumcV0y5o0w0DTXKLsJr70n3ssK55WSZ2RmznUwXidqqywpW3LAPO/LDUVR4q3Zt 1UC9o9me1ox+eUwLH6aIbitXG9FMf2r2i0JGjI28vjAVXNZBdY2ux3O9u/ANo4auHGlX OVVA== X-Gm-Message-State: AOAM533o4/rl9v+ALiszmEwKjZD/oNDA9r93hJ3XADF024DlXVSH3bPC Cnq/oWFqnZ4VgxxFpKWlteQ= X-Received: by 2002:ac8:4e06:: with SMTP id c6mr11191079qtw.360.1590073700207; Thu, 21 May 2020 08:08:20 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id o2sm5606013qtj.70.2020.05.21.08.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 08:08:19 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Thu, 21 May 2020 11:08:17 -0400 To: Petr Mladek Cc: Andrew Morton , Sergey Senozhatsky , Joe Perches , Chenggang Wang , linux-kernel@vger.kernel.org, Steven Rostedt Subject: Re: [RFC PATCH 2/2] init: Allow multi-line output of kernel command line Message-ID: <20200521150817.GA502432@rani.riverdale.lan> References: <2b3832fed9370f0f8dfd1ea33dddb1d05a36e265.1589916689.git.joe@perches.com> <20200520044127.GB938@jagdpanzerIV.localdomain> <20200520121000.GF520@jagdpanzerIV.localdomain> <19a8c717f8d9dc76f2b09e6dd19f3fbb71bf29c5.camel@perches.com> <20200520180028.8fc1b7890774c6f92a6c2623@linux-foundation.org> <20200521043628.GB755@jagdpanzerIV.localdomain> <20200520214007.86f36f61e1fc0329b66758ed@linux-foundation.org> <20200521123117.GD8397@linux-b0ei> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200521123117.GD8397@linux-b0ei> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 21, 2020 at 02:31:17PM +0200, Petr Mladek wrote: > On Wed 2020-05-20 21:40:07, Andrew Morton wrote: > > On Thu, 21 May 2020 13:36:28 +0900 Sergey Senozhatsky wrote: > > > > > On (20/05/20 18:00), Andrew Morton wrote: > > > [..] > > > > I'm wondering if we shold add a kernel puts() (putsk()? yuk) which can > > > > puts() a string of any length. > > > > > > > > I'm counting around 150 instances of printk("%s", ...) and pr_foo("%s", > > > > ...) which could perhaps be converted, thus saving an argument. > > > > > > Can you point me at some examples? > > > > > > > ./arch/powerpc/kernel/udbg.c: printk("%s", s); > > ./arch/powerpc/xmon/nonstdio.c: printk("%s", xmon_outbuf); > > ./arch/um/os-Linux/drivers/ethertap_user.c: printk("%s", output); > > ./arch/um/os-Linux/drivers/ethertap_user.c: printk("%s", output); > > ./arch/um/os-Linux/drivers/tuntap_user.c: printk("%s", out > > > > etc. > > > > My point is, if we created a length-unlimited puts() function for printing the > > kernel command line, it could be reused in such places, resulting in a > > smaller kernel. > > Interesting idea. Well, such a generic function would need to be safe > and do not modify the original string. We would need to implement > printk() variant that would support strigs limited by size instead > of the trailing '\0'. I am not sure if it is worth it. > > Best Regards, > Petr You don't need a printk variant for strings -- you'd only need one if you wanted formatted output of unlimited length. Using printk("%.*s", chunk_size, str) should print at most chunk_size characters from str. The puts could then just be a loop around that. Something like: do { printed = printk("%.*s", chunk_size, str); str += printed; } while (printed >= chunk_size);