From: Thadeu Lima de Souza Cascardo Date: Sat, 5 Dec 2009 22:19:43 +0000 (-0200) Subject: Added some comments about what our code do. X-Git-Tag: v1.0.0 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fkernel%2Fsamples%2F01.hello%2F.git;a=commitdiff_plain;h=f3a30ce8f7efac8eb603d30d03cdce85eb26d970;hp=255ebb43f8f13212b2200a0fef754c37f2de8597 Added some comments about what our code do. --- diff --git a/hello.c b/hello.c index 01e8c26..25c722d 100644 --- a/hello.c +++ b/hello.c @@ -1,17 +1,24 @@ +/* Must be included by every module. */ #include +/* Should be declared to not taint the kernel. */ MODULE_LICENSE("GPL"); +/* Our init function: returns 0 if successfull, an error code, otherwise. */ static int hello_init(void) { + /* printk is just like printf, but without floating point support. */ printk(KERN_ALERT "Hello, world!\n"); return 0; } +/* Our exit function: static is good, so we do not pollute namespace. */ static void hello_exit(void) { + /* KERN_ALERT is a string macro prepended to our message. */ printk(KERN_ALERT "Goodbye, cruel world!\n"); } +/* Here, we declare our module init and exit functions. */ module_init(hello_init); module_exit(hello_exit);