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: <20070929182909.GA19943@uranus.ravnborg.org>
Date:	Sat, 29 Sep 2007 20:29:09 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	Randy Dunlap <randy.dunlap@...cle.com>
Cc:	Erez Zadok <ezk@...sunysb.edu>, torvalds@...ux-foundation.org,
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	"Kok, Auke" <auke-jan.h.kok@...el.com>,
	Kyle Moffett <mrmacman_g4@....com>,
	Jan Engelhardt <jengelh@...putergmbh.de>,
	Adrian Bunk <bunk@...nel.org>, roel <12o3l@...cali.nl>
Subject: Re: [PATCH 1/3] CodingStyle updates

On Sat, Sep 29, 2007 at 11:01:29AM -0700, Randy Dunlap wrote:
> On Fri, 28 Sep 2007 17:32:00 -0400 Erez Zadok wrote:
> 
> > 1. Updates chapter 13 (printing kernel messages) to expand on the use of
> >    pr_debug()/pr_info(), what to avoid, and how to hook your debug code with
> >    kernel.h.
> > 
> > Signed-off-by: Erez Zadok <ezk@...sunysb.edu>
> > ---
> >  Documentation/CodingStyle |   88 +++++++++++++++++++++++++++++++++++++++++++-
> >  1 files changed, 86 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> > index 7f1730f..00b29e4 100644
> > --- a/Documentation/CodingStyle
> > +++ b/Documentation/CodingStyle
> > @@ -643,8 +643,26 @@ Printing numbers in parentheses (%d) adds no value and should be avoided.
> >  There are a number of driver model diagnostic macros in <linux/device.h>
> >  which you should use to make sure messages are matched to the right device
> >  and driver, and are tagged with the right level:  dev_err(), dev_warn(),
> > -dev_info(), and so forth.  For messages that aren't associated with a
> > -particular device, <linux/kernel.h> defines pr_debug() and pr_info().
> > +dev_info(), and so forth.
> > +
> > +A number of people often like to define their own debugging printf's,
> > +wrapping printk's in #ifdef's that get turned on only when subsystem
> > +debugging is compiled in (e.g., dprintk, Dprintk, DPRINTK, etc.).  Please
> > +don't reinvent the wheel but use existing mechanisms.  For messages that
> > +aren't associated with a particular device, <linux/kernel.h> defines
> > +pr_debug() and pr_info(); the latter two translate to printk(KERN_DEBUG) and
> > +printk(KERN_INFO), respectively.  However, to get pr_debug() to actually
> > +emit the message, you'll need to turn on DEBUG in your code, which can be
> > +done as follows in your subsystem Makefile:
> > +
> > +ifeq ($(CONFIG_WHATEVER_DEBUG),y)
> > +EXTRA_CFLAGS += -DDEBUG
> > +endif
The abvoe hurst my eyes each time I see it.
Lately I have considered extending the kbuild syntax a bit.

Introducing
ccflags-y
asflags-y

[with same functionality as the EXTRA_CFLAGS, EXTRA_AFLAGS]
would allow us to do:

ccflags-$(CONFIG_WHATEVER_DEBUG) := -DDEBUG

Much nicer IMHO.

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