-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathhello3.c
More file actions
29 lines (25 loc) · 683 Bytes
/
Copy pathhello3.c
File metadata and controls
29 lines (25 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* Illustrating the __init, __initdata and __exit macros.
*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
#include <linux/init.h> /* Needed for the macros */
/*
* Data gets initalized during the insertion process itself.
*/
static int hello3_data __initdata = 3;
static int __init hello_3_init(void)
{
printk(KERN_INFO "Hello, world %d\n", hello3_data);
return 0;
}
static void __exit hello_3_exit(void)
{
printk(KERN_INFO "Goodbye, world 3\n");
}
/*
* Macros defined in the kernel itself for
* calling functions during insertion and deletion
*/
module_init(hello_3_init);
module_exit(hello_3_exit);