Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5256532ybc; Wed, 27 Nov 2019 00:57:30 -0800 (PST) X-Google-Smtp-Source: APXvYqzW+T74hCOwB7ZxtOz4ScVVVbrAyLWKqq8MwgPA89TZk+MKBMXfepUpKwyggoh2XzhQ5xOj X-Received: by 2002:a17:906:cb93:: with SMTP id mf19mr47627481ejb.87.1574845050044; Wed, 27 Nov 2019 00:57:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574845050; cv=none; d=google.com; s=arc-20160816; b=mntf/TwhZUGX3OhoQU/fG15pb+D7OqRiWMZwTXAI1EYbaJi8cycRcyGqwCm7kuRBeu AFANLvvkFTr9Xd2/arwWKBYXYvkKABmOTYB1iLTyRYwgtQLiXy+VX+Op6vZltaHnnVXl IeHLKxd+CnaWM4hJbkEHpPw7exAqExmGH3Oet6Dk/D5MJsKjJ/LGXCkrp8Q5KzKJWOws 21jCCyesqgvJ2evUMHDbMlojYUaUkcVYyWuXjlmbunh5n1NU3ntxjMk7iQX/gJMTw9js nxQm+FPUH8+euLp2zyxrvk30XiWvChojDIwHMsmwx3CjRWS/YcVAnXKTCSyfvub17Hcv SxLw== 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=Oq6dBFRRjNx39rw0o0biVI8Oo3vQR9do71fOgDnP+AU=; b=ITblYEH8UudsoAAauOZbzOrCP87KeItPurQWaxVtgqd3k22SsH4mhA9AJqdKkfOYd9 XDmiqhSS58f2HnEa8OOejCYC49piLOHMyQwgGJpzVJ2GSFggDGiwzTRzNAxzV+4rdaSs 1bNL2eG2vm4zqC/CAIz5+N2Mp0p4tSvVEiQhztRdjb5kTf9JNG1dbD3n2Y1Q3bRVTckP GfLg6yYvh2simLhoLNeCFoMV11n+VeN+7EEJAx7R/BvtWRiBcVAoD7o5XIkO8gwHdcrg tLDHm6XsFQXPS8tFdcfyaCE2tLCI+gfQ4A6ZONry0WfGgFrYxicDmPRjRWppZ73f+fGN VIGA== 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 s4si2793769ejr.361.2019.11.27.00.57.06; Wed, 27 Nov 2019 00:57:30 -0800 (PST) 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 S1726515AbfK0Iyy (ORCPT + 99 others); Wed, 27 Nov 2019 03:54:54 -0500 Received: from mx2.suse.de ([195.135.220.15]:50498 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726092AbfK0Iyy (ORCPT ); Wed, 27 Nov 2019 03:54:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 303A5AAF1; Wed, 27 Nov 2019 08:54:52 +0000 (UTC) Date: Wed, 27 Nov 2019 09:54:51 +0100 From: Petr Mladek To: Geert Uytterhoeven Cc: Rasmus Villemoes , Joe Perches , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Andrew Morton , Linux Kernel Mailing List , Andy Shevchenko , Jonathan Corbet Subject: Re: [PATCH v4 0/1] printf: add support for printing symbolic error names Message-ID: <20191127085451.ldrzaz4oy54rs7ug@pathway.suse.cz> References: <20190917065959.5560-1-linux@rasmusvillemoes.dk> <20191011133617.9963-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2019-11-26 15:04:06, Geert Uytterhoeven wrote: > Hi Rasmus, > > Nice idea! > > On Fri, Oct 11, 2019 at 3:38 PM Rasmus Villemoes > wrote: > > This is a bit much for under the ---, so a separate cover letter for > > this single patch. > > > > v4: Dropped Uwe's ack since it's changed quite a bit. Change > > errcode->errname as suggested by Petr. Make it 'default y if PRINTK' > > so it's available in the common case, while those who have gone to > > great lengths to shave their kernel to the bare minimum are not > > affected. > > > > Also require the caller to use %pe instead of printing all ERR_PTRs > > symbolically. I can see some value in having the call site explicitly > > indicate that they're printing an ERR_PTR (i.e., having the %pe), but > > I also still believe it would make sense to print ordinary %p, > > ERR_PTR() symbolically instead of as a random hash value that's not > > stable across reboots. But in the interest of getting this in, I'll > > leave that for now. It's easy enough to do later by just changing the > > "case 'e'" to do a break (with an updated comment), then do an > > IS_ERR() check after the switch. > > > > Something I've glossed over in previous versions, and nobody has > > commented on, is that I produced "ENOSPC" while the 'fallback' would > > print "-28" (i.e., there's no minus in the symbolic case). I don't > > care much either way, but here I've tried to show how I'd do it if we > > want the minus also in the symbolic case. At first, I tried just using > > the standard idiom > > > > if (buf < end) > > *buf = '-'; > > buf++; > > > > followed by string(sym, ...). However, that doesn't work very well if > > one wants to honour field width - for that to work, the whole string > > including - must come from the errname() lookup and be handled by > > string(). The simplest seemed to be to just unconditionally prefix all > > strings with "-" when building the tables, and then change errname() > > back to supporting both positive and negative error numbers. > > Still, it looks a bit wasteful to me to include the dash in each and every > string value. > > Do you think you can code the +/- logic in string_nocheck() in less than > the gain achieved by dropping the dashes from the tables? > (e.g. by using the SIGN spec.flags? ;-) > Or, do we need it? IS_ERR() doesn't consider positive values errors. > > Oh, what about the leading "E"? That one looks harder to get rid of, > though ;-) It would be nice. But too big hack is not worth it. Anybody who cares about saving 0.2kB would likely disable this feature completely. Feel to provide a patch so that we could see how good/bad it is. Best Regards, Petr