Rob Landley <[email protected]> wrote:
| I'm proposing allowing an ignore_loglevel to remove the unused messages at
| compile time so they don't take up space. Doing that requires the levels to
| be integers so they can be compared with < or >, and the remaining changes
| follow logically. (To me, anyway...)
Gcc seems to be smart enough to do contant folding on string
subscripts, so you don't need to change any of the printk()s.
Here is what I mean:
#include <stdio.h>
#define actual_printk printf
#define KERN_ERR "<3>" /* error conditions */
#define KERN_WARNING "<4>" /* warning conditions */
#define KERN_NOTICE "<5>" /* normal but significant condition */
#define printk(str, ...) \
do { \
if ((str)[0] != '<' || (str)[1] < '5') \
actual_printk((str), __VA_ARGS__); \
} while(0);
int main(void)
{
printk(KERN_ERR "error %d\n", 1);
printk(KERN_WARNING "warning %d\n", 2);
printk(KERN_NOTICE "notice %d\n", 3);
printk("no level %d\n", 4);
return 0;
}
--
Dick Streefland //// Altium BV
[email protected] (@ @) http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]