lkml.org 
[lkml]   [2015]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/32] lib/vsprintf: implement bitmap printing through '%*pb[l]'
On Sat, Jan 24, 2015 at 09:03:08AM -0500, Tejun Heo wrote:

> There have been a couple different attempts at making this easier.
>
> 1. Way back, PeterZ tried printk '%pb' extension with the precision
> for bit width - '%.*pb'. This was intuitive and made sense but
> unfortunately triggered a compile warning about using precision
> for a pointer.
>
> http://lkml.kernel.org/g/1336577562.2527.58.camel@twins

> So, this patch is another attempt at teaching printk and friends how
> to print bitmaps. It's almost identical to what PeterZ tried with
> precision but it uses the field width for the number of bits instead
> of precision. The format used is '%*pb[l]', with the optional
> trailing 'l' specifying list format instead of hex masks.

> This is a valid format string and doesn't trigger compiler warnings;
> however, it does make it impossible to specify output field width when
> printing bitmaps.

> I think this is an acceptable trade-off given how
> much easier it makes printing bitmaps and that we don't have any
> in-kernel user which is using the field width specification.

Yeah, I suppose this is indeed the best we can do; and loosing the width
thing (which is a rarely used feature for in kernel things) seems
acceptable indeed. We did mention the option back then, but didn't
pursue it.

I like the extra 'l' fmt option.

> Signed-off-by: Tejun Heo <tj@kernel.org>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>


\
 
 \ /
  Last update: 2015-01-26 15:01    [W:0.316 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site