On Wednesday 19 September 2007 1:03:09 pm Tim Bird wrote:Cool! Could you update http://www.selenic.com/linux-tiny/ to mention the new maintainer and new URLs? I've been playing with an idea for a while to improve the printk() situation, but it's a more intrusive change than I've had time to bang on. Right now, the first argument to printk() is a loglevel, but it's handled via string concatenation. I'd like to change that to be an integer, and make it an actual comma-separated first argument. (Mandatory, not optional.) So instead of: printk(KERN_NOTICE "Fruit=%d\n", banana); It would now be: printk(KERN_NOTICE, "Fruit=%d\n", banana); Change the header from: #define KERN_NOTICE "<5>" to: #define KERN_NOTICE 5 Then you can change the printk guts to do something vaguely like (untested): #define printk(arg1, arg2, ...) actual_printk("<" #arg1 ">" arg2, __VA_ARGS__) And so far no behavior has changed. But now the _fun_ part is, you can add a config symbol for "what is the minimum loglevel I care about?" Set that as a number from 0-9. And then you can define the printk to do: #define printk(level, str, ...) \ do { \ if (level < CONFIG_PRINTK_DOICARE) \ actual_printk("<" #level ">" str, __VA_ARGS__); \ } while(0); And viola (however you spell that, I think I'm using the stringed instrument but it's french and I'm not trying to type a diacritical mark anyway), the compiler's dead code eliminator zaps the printks you don't care about so they don't bloat the kernel image. But this doesn't _completely_ eliminate printks, so you can still get the panic() calls and such. You tweak precisly how much bloat you want, using the granularity information that's already there in the source code... Opinions? Rob -- "One of my most productive days was throwing away 1000 lines of code." - Ken Thompson. -
| Arnd Bergmann | Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures |
| Andrew Morton | 2.6.23-rc1-mm2 |
| Nick Piggin | [patch 3/6] mm: fix fault vs invalidate race for linear mappings |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Herbert Xu | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| David Miller | Re: [BUG] New Kernel Bugs |
