Re: [RFC][PATCH] printk: Add %pb to print bitmaps

From: Peter Zijlstra
Date: Wed May 09 2012 - 16:58:52 EST

On Wed, 2012-05-09 at 12:07 -0700, Andrew Morton wrote:
> On Wed, 09 May 2012 15:27:23 +0200
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > + * - 'b' For a bitmap, consumes 2 args, second is int
> There's a pretty widespread convention that %b is used to print in
> binary: printf("%b", 10) -> 1010. Regrettably it isn't part of
> standard C, but it's often supported anyway. Perl's printf does this
> as well. Perl uses %B also.
> If we later want to add binary printing to kernel print(), we'd presumably
> use %pb, to match this precedent.

I'd expect something like %ub, %p would take a pointer to a value.

Too bad both %b and %B generate a warning, it would be rather trivial to
add base 2 number stuff.

> So perhaps it would be better to avoid consuming `b' for bitmaps?

With %.*pb not actually working I could use %pC to mean a cpumask and
skip the generic bitmap stuff.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at