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. -
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Ingo Molnar | Re: [RFT] x86 acpi: normalize segment descriptor register on resume |
| Andrew Morton | -mm merge plans for 2.6.23 |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
git: | |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| David Miller | Re: [GIT]: Networking |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Ingo Molnar | [bug] stuck localhost TCP connections, v2.6.26-rc3+ |
