From: dick.streefland@altium.nl (Dick Streefland)
To: linux-kernel@vger.kernel.org
Subject: Re: [RFC] New kernel-message logging API (take 2)
Date: Fri, 28 Sep 2007 08:22:43 -0000 [thread overview]
Message-ID: <122e.46fcb9d3.ac322@altium.nl> (raw)
In-Reply-To: 19f34abd0709271418l471cf7b9gf24161190772fac@mail.gmail.com
"Vegard Nossum" <vegard.nossum@gmail.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@altium.nl (@ @) http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------
next prev parent reply other threads:[~2007-09-28 8:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-27 21:18 [RFC] New kernel-message logging API (take 2) Vegard Nossum
2007-09-28 1:38 ` linux
2007-09-28 7:31 ` Geert Uytterhoeven
2007-09-28 7:44 ` Kyle Moffett
2007-09-28 11:49 ` Vegard Nossum
2007-09-28 11:46 ` Vegard Nossum
2007-09-28 8:22 ` Dick Streefland [this message]
2007-09-28 9:45 ` Jan Engelhardt
2007-09-28 11:59 ` Vegard Nossum
2007-09-28 12:11 ` Vegard Nossum
2007-09-28 13:30 ` Miguel Ojeda
2007-09-28 13:55 ` Vegard Nossum
2007-09-28 14:00 ` Miguel Ojeda
2007-09-28 16:30 ` Rob Landley
2007-09-28 16:41 ` Vegard Nossum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=122e.46fcb9d3.ac322@altium.nl \
--to=dick.streefland@altium.nl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox