[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linux kernel module programming guide
On Tue, Apr 01, 2003 at 11:48:03AM -0800, Peter Jay Salzman wrote:
> a new version of the linux kernel module programming guide (lkmpg) was
> submitted to tldp and is now available.
quick browsing ...
> enable CONFIG_MODVERSION in
it's CONFIG_MODVERSIONS
> One exception is chapter (fixme),
...
> [2] This file used to be called conf.modules before linux 2.0, but this name
> is now deprecated.
remove this note ?
> int init_module(void)
> void cleanup_module(void)
I think you should use module_init() etc. right up front. If you insist,
you could add a chapter on 2.2, but I do not see *any* point in
supporting 2.2 in this document.
> printk("<1>Hello world 1.\n");
Why do you tell the user what the KERN_* macros do right up front ?
Instead, just use KERN_ALERT or whatever everywhere, and add a note on
what it actually does near the end, if you like.
> __SMP__: This must be defined if the kernel was compiled to support symmetrical multiprocessing
Isn't used any more. Remove. This whole section is wrong, see
kernelnewbies.org/faq/#compmod
Section 3.1.1 explains something already explained in chapter 2
> You can even write modules to replace the kernel's system calls, which
> we'll do shortly.
This is not a sensible thing to cover in this document IMO.
> to be experts in memory managements
typo
> However, there's also a C99 way of assigning to elements of a
> structure.
You should clarify that this is preferred
> 4.1.4. Unregistering A Device
Needs a discussion on .owner instead of the MOD_INC gunk
#if defined(CONFIG_MODVERSIONS) && ! defined(MODVERSIONS)
#include <linux/modversions.h>
#define MODVERSIONS
#endif
looks wrong
static int Major;
Kernel code doesn't look like this ... "major" instead. Pointing to the
coding style docs would be good. Goes for all the code there.
I suspect the section on procfs should be deleted or drastically
shortened : pointing to erikm's guide would be sufficient, along with a
couple of do's and dont's on when to use procfs vs. sysctl in 2.4 (never ;)
> NULL, /* mknod */
Use C99 initialisers as already mentioned
You should strongly discourage the use of ioctl
> module_interruptible_sleep_on[1].
The sleep_on family should be used. instead use the wait_event family
regards
john
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/