Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4128319ybp; Sun, 13 Oct 2019 22:55:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGk+Ov85mM8/UOd8CW9MSQ9qiZ427GV74ABhINreer84hEsonLa6MNJxEdO6QZABktkWZR X-Received: by 2002:aa7:c6d5:: with SMTP id b21mr26735265eds.37.1571032559365; Sun, 13 Oct 2019 22:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571032559; cv=none; d=google.com; s=arc-20160816; b=nyrZ5yLzlQJFhAjDwsul0T9QEQlMl64qMXscfDm/ez4qEFRsDmcgTU1g7Ilae3vzKY VPwh27XDucVacLbGbrLYbdu6g7ASywsND6JMtzCP6/7iwnLZD3maOIX1kRvpAufueJeh iFAFPEOuifZoFLkQBNrAbNeUnTALUhk4a6rNHatkJe7OTdRaP/5aoM9eHP5XcJCRPRSf PvEftqsXCPHjjs9pggJLVCraQqxvEc60ni+Kmk25Fen4WGsEHeBNXaYfLtve0L4aBsaK 7wiTh8JgJM5OEbhfXKpg/wkyc8rLFwP8jkGS7pRIJL00HgaQTjIXotc4nMlYaK+I/V/k 2FAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Yg7y07rZFoimHr6WYzhr6Q+tduOgCZsGVbE/sTU4wt8=; b=kugozx7L1qSGjloASZosO8oF9fvgyk0YjI5HJDfu67wV8DBbVpLnmgQlta9lqW9PUe nu+1AGbiezThNUVL1CBXaZYIiGSjK6No+1cPxFEYRo/58FzzTTanxllsWuMUZCcMUp7O 9Pd7X2e/d/bhA9WMotcVbhx4wOAPTXRoTn2n8x37i8D11nIkVdzeSm54Dz1OxPLKyq3w 1n+W7PeRAOruGYmwqze01/aeYTBJLz6C8fQRrGGXyXmS2ALjKaSFmaerpS3c2L68oUPn ZCusYe9oa90BxCV/OPC6YvDJ5qR/rGM9h1E+9MZZleZ6HK2AV+oPOuOYVXvt6DhV70+S hNFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci21si10805988ejb.320.2019.10.13.22.55.36; Sun, 13 Oct 2019 22:55:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729778AbfJNFx3 (ORCPT + 99 others); Mon, 14 Oct 2019 01:53:29 -0400 Received: from antares.kleine-koenig.org ([94.130.110.236]:44392 "EHLO antares.kleine-koenig.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726587AbfJNFx2 (ORCPT ); Mon, 14 Oct 2019 01:53:28 -0400 Received: by antares.kleine-koenig.org (Postfix, from userid 1000) id 9F1ED7F34CE; Mon, 14 Oct 2019 07:53:26 +0200 (CEST) Date: Mon, 14 Oct 2019 07:51:14 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Rasmus Villemoes Cc: Joe Perches , Petr Mladek , Andrew Morton , linux-kernel@vger.kernel.org, Andy Shevchenko , Jonathan Corbet Subject: Re: [PATCH v4 1/1] printf: add support for printing symbolic error names Message-ID: <20191014055114.GA5045@taurus.defre.kleine-koenig.org> References: <20190917065959.5560-1-linux@rasmusvillemoes.dk> <20191011133617.9963-1-linux@rasmusvillemoes.dk> <20191011133617.9963-2-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline In-Reply-To: <20191011133617.9963-2-linux@rasmusvillemoes.dk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jRHKVT23PllUwdXP Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 11, 2019 at 03:36:17PM +0200, Rasmus Villemoes wrote: > It has been suggested several times to extend vsnprintf() to be able > to convert the numeric value of ENOSPC to print "ENOSPC". This > implements that as a %p extension: With %pe, one can do >=20 > if (IS_ERR(foo)) { > pr_err("Sorry, can't do that: %pe\n", foo); > return PTR_ERR(foo); > } >=20 > instead of what is seen in quite a few places in the kernel: >=20 > if (IS_ERR(foo)) { > pr_err("Sorry, can't do that: %ld\n", PTR_ERR(foo)); > return PTR_ERR(foo); > } >=20 > If the value passed to %pe is an ERR_PTR, but the library function > errname() added here doesn't know about the value, the value is simply > printed in decimal. If the value passed to %pe is not an ERR_PTR, we > treat it as an ordinary %p and thus print the hashed value (passing > non-ERR_PTR values to %pe indicates a bug in the caller, but we can't > do much about that). >=20 > With my embedded hat on, and because it's not very invasive to do, > I've made it possible to remove this. The errname() function and > associated lookup tables take up about 3K. For most, that's probably > quite acceptable and a price worth paying for more readable > dmesg (once this starts getting used), while for those that disable > printk() it's of very little use - I don't see a > procfs/sysfs/seq_printf() file reasonably making use of this - and > they clearly want to squeeze vmlinux as much as possible. Hence the > default y if PRINTK. >=20 > The symbols to include have been found by massaging the output of >=20 > find arch include -iname 'errno*.h' | xargs grep -E 'define\s*E' >=20 > In the cases where some common aliasing exists > (e.g. EAGAIN=3DEWOULDBLOCK on all platforms, EDEADLOCK=3DEDEADLK on most), > I've moved the more popular one (in terms of 'git grep -w Efoo | wc) > to the bottom so that one takes precedence. >=20 > Signed-off-by: Rasmus Villemoes I like having an explicit code even better than relying on a plain %p to emit the code. So please readd my Acked-by: Uwe Kleine-K=F6nig Best regards Uwe --jRHKVT23PllUwdXP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl2kDM4ACgkQwfwUeK3K 7Amktgf/ZUKMyhXs+ND6w+xxA4HnQO3sndsdhdsqO1EBhXFTKJAGMi43qs++FP7z 62e30zX9uKg0AnFrKS2E67GpoM7ye9er0Q/NNnOQ7zLe2hDyN/9qsPsQz165hxvj 3c8ySawCsJSjCBNYbqTEa4YncIvjKMmHijDQQCchp5FR6S9eoK744oKH/Dy7Qofl CkGoFFB6+FMUTBJTTO3PI4rW4R2PAePi5KedmtS/yc53wcJx2eRSyOkbZH7TEIw1 a51F8u9W/wR65Kn/v+0fAM/Ka33QfEaxZYMlh05uHVCb7aGod/TqzysFMsBbgUKz wmOX3SlTzJFw7Vgp2Ytol4drCNfXVg== =k9wZ -----END PGP SIGNATURE----- --jRHKVT23PllUwdXP--