lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120509172220.GA8135@gmail.com>
Date:	Wed, 9 May 2012 19:22:20 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Joe Perches <joe@...ches.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Igor Mammedov <imammedo@...hat.com>,
	Jiang Liu <liuj97@...il.com>, linux-kernel@...r.kernel.org,
	pjt@...gle.com, tglx@...utronix.de, seto.hidetoshi@...fujitsu.com,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [RFC][PATCH] printk: Add %pb to print bitmaps


* Joe Perches <joe@...ches.com> wrote:

> On Wed, 2012-05-09 at 18:06 +0200, Peter Zijlstra wrote:
> > On Wed, 2012-05-09 at 17:41 +0200, Ingo Molnar wrote:
> > > * Peter Zijlstra <peterz@...radead.org> wrote:
> > > 
> > > > On Wed, 2012-05-09 at 16:15 +0200, Ingo Molnar wrote:
> > > > > > I guess I should use %.*pb and keep the field_width in case someone
> > > > > > manages to actually make bitmap_scnlistprintf() conform to it. The
> > > > > > precision is unused anyway.
> > > > > 
> > > > > That's a cute trick, and it's intuitive as well. 
> > > > 
> > > > kernel/sched/core.c:5570:3: warning: precision used with ā€˜%pā€™ gnu_printf format [-Wformat]
> > > > 
> > > > /me curses a bit.. anybody?
> > > 
> > > Yeah, that's a floating point precision thing (or for strings, 
> > > right-align) - could you use %30pb, etc?
> > 
> > %*pb you mean? Yeah that works, field width is allowed for %p. It does
> > mean we cannot ever make bitmaps respect field width though.
> 
> You could also fill a new struct with info
> about the bitmap and pass a pointer to that.
> 
> struct print_bitmap_info {
> 	int foo;
> 	int precision;
> 	int width;
> 	void *bitmap;
> };
> ...
> 	struct print_bitmap_info bi;
> 	bi.foo = bar;
> 	...
> 	bi.bitmap = &bitmap;
> ...
> 	printk("%pb", &bi);

That defeats the whole purpose of avoiding extra complexity and 
preparation - just passing in the bitmap pointer is the most 
natural, most intuitive type to use.

Thanks,

	Ingo
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ