author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Thu, 16 Apr 2009 12:49:13 +0200 | |
changeset 54 | c064ce9f40f5 |
parent 50 | a38f102556e5 |
child 77 | 49e0babccb23 |
permissions | -rw-r--r-- |
50
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
1 |
/* |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
2 |
* hello-1.c - The simplest kernel module. |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
3 |
*/ |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
4 |
#include <linux/module.h> /* Needed by all modules */ |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
5 |
#include <linux/kernel.h> /* Needed for KERN_INFO */ |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
6 |
|
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
7 |
int init_module (void) |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
8 |
{ |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
9 |
printk (KERN_INFO "Hello world 1.\n"); |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
10 |
|
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
11 |
/* |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
12 |
* A non 0 return means init_module failed; module can't be loaded. |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
13 |
*/ |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
14 |
return 0; |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
15 |
} |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
16 |
|
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
17 |
void cleanup_module (void) |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
18 |
{ |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
19 |
printk (KERN_INFO "Goodbye world 1.\n"); |
a38f102556e5
khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
20 |
} |