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  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]
Date:	Tue, 10 Nov 2009 08:39:09 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Joe Perches <joe@...ches.com>,
	Naohiro Ooiwa <nooiwa@...aclelinux.com>,
	Hiroshi Shimamoto <h-shimamoto@...jp.nec.com>,
	roland@...hat.com, Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>, oleg@...hat.com
Subject: Re: [PATCH] kernel.h: Add printk_ratelimited and pr_<level>_rl


* Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:

> On Tue, 2009-11-10 at 06:17 +0100, Ingo Molnar wrote:
> > * Andrew Morton <akpm@...ux-foundation.org> wrote:
> > 
> > > On Fri, 30 Oct 2009 16:21:47 -0700
> > > Joe Perches <joe@...ches.com> wrote:
> > > 
> > > > +#define pr_emerg_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_alert_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_crit_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_err_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_warning_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_notice_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_info_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
> > > 
> > > Would prefer pr_emerg_ratelimited personally.  It's longer, but one 
> > > doesn't ask "wtf does _rl" mean and it avoids having two identifiers 
> > > which refer to the same thing.
> > 
> > Yeah. It will be rarely used so that it wont ever really be 'obvious at 
> > a glance', even to folks well versed in kernel source code details.
> 
> Is there a reason for all this pr_ nonsense? will we depricate printk()?

Yes, pr_*() has established itself as a printk shortcut. The benefits 
of:

  pr_info("stuff\n");

versus:

  printk(KERN_INFO "stuff\n");

are sufficiently large:

 - it's shorter by 9 characters (more than a level of indentation)

 - you cannot forget to add a KERN_ prefix - which is required for 98% 
   of all printks but which is forgotten from 50% of the submitted 
   patches.

so pr_*(), while named in a sucky way (all 2 letter abbrevs are sucky), 
has advantages, makes stuff more readable and reduces churn.

printk wont go away as an ad-hoc print-this tool. (Nor will we convert 
most of the remaining 18,000+ uses of printk() in the kernel, so 
printk() will be with us forever i guess.)

	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