LWN.net Logo

A kernel message catalog

A kernel message catalog

Posted Aug 7, 2008 9:20 UTC (Thu) by dark (subscriber, #8483)
Parent article: A kernel message catalog

I notice that "XPRAM_MAX_DEVS" in the check became "32" in the tag description. This means that if XPRAM_MAX_DEVS changes, someone will have to remember to update its value in any descriptions that use it. I think this will get painful.

In this case it's not that hard because XPRAM_MAX_DEVS is defined as a literal number 32 and is defined in the same file, so you could put a comment there saying what descriptions need to be updated if its value changes. In the general case, such limits might live in separate header files, their values might be architecture-dependent or depend on other limits, etc. It will be difficult to keep descriptions in sync with the code if they often contain such values.

I think the right thing to do for this particular message is to put XPRAM_MAX_DEVS into the printk itself ("%d is not a valid number of XPRAM devices, should be between 1 and %d") and then have the description say something like "must be in the specified range". Will this approach work in general?


(Log in to post comments)

A kernel message catalog

Posted Aug 7, 2008 23:15 UTC (Thu) by vomlehn (subscriber, #45588) [Link]

Yes, that would work, but note we are now raising the bar for kernel development. Rather than
just slamming out any old message in a printk, kernel developers will now need to carefully
consider the associated English (or Chinese or Klingon) text of the expanded message. I'd like
to believe that we can do this, but I'm concerned that past history suggests we are not that
good at this kind of thing. I see lots of reluctance from people to put many comments in code
based on how rarely they get updated when the code changes.

Note that I think that having good kernel error messages is a *very* good thing. But it's
harder than what we've been doing and I think doing it half-way may very well be worse than
not doing it all.

A kernel message catalog

Posted Aug 8, 2008 8:23 UTC (Fri) by dark (subscriber, #8483) [Link]

I think doing it half-way would still be an improvement, if the effect is that googling for "xpram.1" will always bring up relevant pages :)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds