[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <122e.46fcb9d3.ac322@altium.nl>
Date: Fri, 28 Sep 2007 08:22:43 -0000
From: dick.streefland@...ium.nl (Dick Streefland)
To: linux-kernel@...r.kernel.org
Subject: Re: [RFC] New kernel-message logging API (take 2)
"Vegard Nossum" <vegard.nossum@...il.com> wrote:
| It should be possible to optimize out multi-line (block) entries
| based on log-level filtering even though the log-level is only given
| in the first call (the initializer). It may take the shape of an
| if-block that spans several macros. This is not very elegant or robust
| if the macros are used incorrectly, however. Aborting a message can
| also be hard this way (since the abort would usually appear inside an
| if-statement that tests for some abnormal condition, thus appear in a
| different block, and thoroughly mess up the bracket order).
|
| Example: {
| #define kprint_block_init(block, loglevel) \
| if(loglevel > CONFIG_KPRINT_LOGLEVEL_MAX) { \
| kprint_real_block_init(block, loglevel);
|
| #define kprint_block(block, fmt, ...) \
| kprint_real_block(block, fmt, ## __VA_ARGS__);
|
| #define kprint_block_flush(block) \
| kprint_real_block_flush(block); \
| }
As you point out yourself, this is not very elegant or robust. In fact,
it is very dangerous. Why not simply pass the loglevel to each macro?
--
Dick Streefland //// Altium BV
dick.streefland@...ium.nl (@ @) http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------
-
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