Messages in this thread | | | Subject | Re: [RFC/PATCH] Documentation of kernel messages | From | Joe Perches <> | Date | Wed, 13 Jun 2007 12:04:56 -0700 |
| |
On Wed, 2007-06-13 at 20:18 +0200, holzheu wrote: > But they unfortunately do not solve our problem. We need an identifier > for a documented message in order to find the right description for a > message.
I believe it better to simply add __FILE__ & __LINE__ to the macro rather than some other externally specified unique identifier that adds developer overhead and easily gets stale.
If you go overboard, you could do something like:
#define dev_dbg(dev, format, arg...) \ dev_printk(KERN_DEBUG, dev, DBG_FMT format DBG_ARG, ## arg)
#define dev_err(dev, format, arg...) \ dev_printk(KERN_ERR, dev, PR_FMT format PR_ARG, ## arg)
etc...
and use config variables to control what additional info is printk'ed.
Go overboard without a life preserver and add __TIMESTAMP__ too.
/* */ #if defined DBG_FMT #undef DBG_FMT #endif #if defined DBG_ARG #undef DBG_ARG #endif
#if defined DBG_FILE && defined DBG_FUNCTION && defined DBG_LINE #define DBG_FMT "(%s:%s:%u) " #define DBG_ARG , __FILE__ , __FUNCTION__ , __LINE__ #elif defined DBG_FILE && defined DBG_FUNCTION && !defined DBG_LINE #define DBG_FMT "(%s:%s) " #define DBG_ARG , __FILE__ , __FUNCTION__ #elif defined DBG_FILE && !defined DBG_FUNCTION && defined DBG_LINE #define DBG_FMT "(%s:%u) " #define DBG_ARG , __FILE__ , __LINE__ #elif defined DBG_FILE && !defined DBG_FUNCTION && !defined DBG_LINE #define DBG_FMT "(%s) " #define DBG_ARG , __FILE__ #elif !defined DBG_FILE && defined DBG_FUNCTION && defined DBG_LINE #define DBG_FMT "(%s:%u) " #define DBG_ARG , __FUNCTION__ , __LINE__ #elif !defined DBG_FILE && defined DBG_FUNCTION && !defined DBG_LINE #define DBG_FMT "(%s) " #define DBG_ARG , __FUNCTION__ #elif !defined DBG_FILE && !defined DBG_FUNCTION && defined DBG_LINE #define DBG_FMT "(%u) " #define DBG_ARG , __LINE__ #else #define DBG_FMT #define DBG_ARG #endif
/* */
#if defined PR_FMT #undef PR_FMT #endif #if defined PR_ARG #undef PR_ARG #endif
#if defined PR_FILE && defined PR_FUNCTION && defined PR_LINE #define PR_FMT "(%s:%s:%u) " #define PR_ARG , __FILE__ , __FUNCTION__ , __LINE__ #elif defined PR_FILE && defined PR_FUNCTION && !defined PR_LINE #define PR_FMT "(%s:%s) " #define PR_ARG , __FILE__ , __FUNCTION__ #elif defined PR_FILE && !defined PR_FUNCTION && defined PR_LINE #define PR_FMT "(%s:%u) " #define PR_ARG , __FILE__ , __LINE__ #elif defined PR_FILE && !defined PR_FUNCTION && !defined PR_LINE #define PR_FMT "(%s) " #define PR_ARG , __FILE__ #elif !defined PR_FILE && defined PR_FUNCTION && defined PR_LINE #define PR_FMT "(%s:%u) " #define PR_ARG , __FUNCTION__ , __LINE__ #elif !defined PR_FILE && defined PR_FUNCTION && !defined PR_LINE #define PR_FMT "(%s) " #define PR_ARG , __FUNCTION__ #elif !defined PR_FILE && !defined PR_FUNCTION && defined PR_LINE #define PR_FMT "(%u) " #define PR_ARG , __LINE__ #else #define PR_FMT #define PR_ARG #endif
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |