Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-16 Thread Uwe Kleine-König
On 9/16/19 3:23 PM, Rasmus Villemoes wrote: > On 16/09/2019 14.23, Uwe Kleine-König wrote: >> Hello Rasmus, >> >> On 9/9/19 10:38 PM, 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 i

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-16 Thread Rasmus Villemoes
On 16/09/2019 14.23, Uwe Kleine-König wrote: > Hello Rasmus, > > On 9/9/19 10:38 PM, 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 is yet >> another attempt. Rather than adding anoth

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-16 Thread Uwe Kleine-König
Hello Rasmus, On 9/9/19 10:38 PM, 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 is yet > another attempt. Rather than adding another %p extension, simply teach > plain %p to convert ER

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-15 Thread Pavel Machek
On Mon 2019-09-09 22:38:25, 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 is yet > another attempt. Rather than adding another %p extension, simply teach > plain %p to convert ERR_PTRs.

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-11 Thread Rasmus Villemoes
On 11/09/2019 11.37, Uwe Kleine-König wrote: > On 9/11/19 8:43 AM, Rasmus Villemoes wrote: >> On 11/09/2019 02.15, Joe Perches wrote: >>> On Tue, 2019-09-10 at 18:26 +0300, Andy Shevchenko wrote: On Mon, Sep 9, 2019 at 11:39 PM Rasmus Villemoes wrote: > +{ > + /* Might as w

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-11 Thread Uwe Kleine-König
On 9/11/19 8:43 AM, Rasmus Villemoes wrote: > On 11/09/2019 02.15, Joe Perches wrote: >> On Tue, 2019-09-10 at 18:26 +0300, Andy Shevchenko wrote: >>> On Mon, Sep 9, 2019 at 11:39 PM Rasmus Villemoes >>> wrote: > +#define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = #err +#

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-10 Thread Rasmus Villemoes
On 11/09/2019 02.15, Joe Perches wrote: > On Tue, 2019-09-10 at 18:26 +0300, Andy Shevchenko wrote: >> On Mon, Sep 9, 2019 at 11:39 PM Rasmus Villemoes >> wrote: >>> +#define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = #err >>> +#define E(err) [err - 512 + BUILD_BUG_ON_ZERO(err < 51

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-10 Thread Joe Perches
On Tue, 2019-09-10 at 18:26 +0300, Andy Shevchenko wrote: > On Mon, Sep 9, 2019 at 11:39 PM 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 is yet > > another attempt. Rather than

Re: [PATCH v2] printf: add support for printing symbolic error codes

2019-09-10 Thread Andy Shevchenko
On Mon, Sep 9, 2019 at 11:39 PM 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 is yet > another attempt. Rather than adding another %p extension, simply teach > plain %p to convert ER

[PATCH v2] printf: add support for printing symbolic error codes

2019-09-09 Thread Rasmus Villemoes
It has been suggested several times to extend vsnprintf() to be able to convert the numeric value of ENOSPC to print "ENOSPC". This is yet another attempt. Rather than adding another %p extension, simply teach plain %p to convert ERR_PTRs. While the primary use case is if (IS_ERR(foo)) { pr_