There is one reason to keep the macro: It allows you to remove the code
entirely by not defining DEBUG.  That doesn't really matter much to me
right now but it might to someone.

With DEBUG:

-rwxrwxr-x    1 tyson    tyson       41974 Jan 30 16:47 linuxbios.strip*

Without DEBUG:

-rwxrwxr-x    1 tyson    tyson       33718 Jan 30 20:55 linuxbios.strip*

That is a pretty substantial difference.

It actually might be better of we made a single DBG macro that didn't
hard code the debug level:

#define DBG(x...) printk(x)

...or we could make its name more meaningful:

#ifdef DEBUG
#define PRINTK(x...) printk(x)
#else
#define PRINTK(x...)
#endif

As for adding more levels or renaming the existing ones, I don't have
any strong feelings.  Either is "incompatible" with the way things are
done in the kernel.  What really matters here is that we all use it
consistently and actually think about what log level to apply to each
message.

Ty

Eric Seppanen wrote:
> 
> Why add more code to cover up the fact that the DBG macro is
> inappropriately always using the _DEBUG loglevel?  Why not just get rid of
> the macro and use printk with whatever the priority you want is?  If
> there's seven log levels and everybody's using #7, why not start using 1-6
> instead of adding two more?
> 
> Admittedly, though, it might make sense to rename some of the loglevels so
> that they make more sense in this context-- there's probably no need for
> four distinct levels of error in linuxbios (where most errors are probably
> critical, failing to boot the system).
> 
> On Tue, Jan 30, 2001 at 02:57:46PM -0500, [EMAIL PROTECTED] wrote:
> > While doing some debugging I found that I had something close to an all
> > or nothing option for debug output.  ...and all was a LOT!
> >
> > As a result I made the following changes to printk.h:
> >
> > diff -ur freebios-010119.orig/src/include/printk.h 
>freebios-010119.devel/src/include/printk.h
> > --- freebios-010119.orig/src/include/printk.h   Fri Dec  1 03:59:46 2000
> > +++ freebios-010119.devel/src/include/printk.h  Fri Jan 19 14:48:57 2001
> > @@ -10,15 +10,23 @@
> >  #define KERN_WARNING    "<4>"   /* warning conditions                   */
> >  #define KERN_NOTICE     "<5>"   /* normal but significant condition     */
> >  #define KERN_INFO       "<6>"   /* informational                        */
> > -#define KERN_DEBUG      "<7>"   /* debug-level messages                 */
> > +#define KERN_VERBOSE    "<7>"   /* debug-level messages                 */
> > +#define KERN_DEBUG      "<8>"   /* debug-level messages                 */
> > +#define KERN_SPEW       "<9>"   /* debug-level messages                 */
> >
> >  extern int console_loglevel;
> >  int printk(const char *fmt, ...);
> >
> >  #ifdef DEBUG
> >  #define DBG(x...) printk(KERN_DEBUG x)
> > +#define DBG7(x...) printk(KERN_VERBOSE x)
> > +#define DBG8(x...) printk(KERN_DEBUG x)
> > +#define DBG9(x...) printk(KERN_SPEW x)
> >  #else
> >  #define DBG(x...)
> > +#define DBG7(x...)
> > +#define DBG8(x...)
> > +#define DBG9(x...)
> >  #endif
> >
> >  #endif
> >
> > I then went through the code and replaced most cases of DBG with one of
> > the other DBG? macros.  Is this a change that is supported by others?
> > Or will people just hate me for submitting the patch?
> >
> > As it stands now, level 6 provides next to nothing and level 7 blabs
> > about every PCI I/O operation and tons of other stuff.
> >
> > Thanks!
> > Ty
> >
> > --
> > Tyson D Sawyer                             iRobot Corporation
> > Senior Systems Engineer                    Real World Interface Div.
> > [EMAIL PROTECTED]                         Robots for the Real World
> > 603-532-6900 ext 206                       http://www.irobot.com

-- 
Tyson D Sawyer                             iRobot Corporation
Senior Systems Engineer                    Real World Interface Div.
[EMAIL PROTECTED]                         Robots for the Real World
603-532-6900 ext 206                       http://www.irobot.com

Reply via email to