[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150126135005.GG23123@twins.programming.kicks-ass.net>
Date: Mon, 26 Jan 2015 14:50:05 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Tejun Heo <tj@...nel.org>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [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@...nel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists