On 9/25/07, Vegard Nossum <vegard.nossum@gmail.com> wrote:No parameters if possible: As you said, one or two #define's in the beggining of the file can tell printk what to print as subsystem and driver/...; and the reason (printk_xxx) could tell the loglevel. For example: "detected", "registered" or "copyright" messages will have always some low level priority; and "errors" or "alerts" high priorities. This can help whenever selecting what loglevel priorities to log, as all drivers will log most common messages in the same loglevel. So, with your change to printk_xxx, we can add real meaning to the messages, and forget about selecting a priority for most common messages. And that does not break your idea of writing printk_yyy, being yyy all the priorities, as we will be able to use that functions for uncommon kind of messages. To clarify what I'm saying, here is an example: #define PRINTK_SUBSYSTEM "video" #define PRINTK_DRIVER "some123ag" ... printk_copyright("Pretty Systems Inc. (C) <some@body.com>"); ... printk_detected("Some Pro 123ag VGA"); ... printk_registered("Framebuffer /dev/fb1"); ... if (really_weird_stuff_happened) printk_emerg("Video card appears to be disconnected!"); As you see, each message will write to the correct priority. Even, things like "printk_copyright" could have a macro like: #define PRINTK_COPYRIGHT(who, year, email) printk_copyright(who " (C) " year " <" email ">"); But I think that its going too far. Right... But in the long time, it can help a lot. For now, every maintainer should add the #define line in each file and write the reason while changing the function name (that is something we will have to do anyway if you change printk). I would say 70% do it. Also, they just write the name of the subsystem/driver, a ':' and then a non-standard string. I mean, most of the messages are about a new detected device, an error encountered, a registered/mounted device/link, the copyright, the authors, ... Some of them say "registered XXX", others "XXX registered", other just say "new XXX" or split the message in two lines, etc. My point is: Most of the messages are inside five or six categories, so if people is ready to change/improve printk() API, let's finish all the duplication, as we usually do with code. Also, I think it could help a lot in the future if we categorize the messages by subsystem/driver and level/reason: then we could write more useful tools for debugging, logging... We could "grep" it, or select what we want to log, etc. I'm sure this idea is maybe overwhelming at first, but I think that in the future will help a lot. Linux is growing everyday more and more, and if printk() is about to change, as soon as we introduce new features, easier will be. Thanks for your interest in the idea. -- Miguel Ojeda http://maxextreme.googlepages.com/index.htm -
| Steven Rostedt | Re: Major regression on hackbench with SLUB |
| Jeremy Fitzhardinge | [PATCH 02 of 36] x86: add memory clobber to save/loadsegment |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Paul Jackson | Re: cpuset-remove-sched-domain-hooks-from-cpusets |
git: | |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Arjan van de Ven | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 03/37] dccp: List management for new feature negotiation |
| Jarek Poplawski | [PATCH iproute2] Re: HTB accuracy for high speed |
