linux-dev/hello.c

26 lines
569 B
C

#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Inex Code");
MODULE_DESCRIPTION("A hello world");
MODULE_VERSION("0.0.2");
static char *whom = "world";
module_param(whom, charp, 0);
static int howmany = 1;
module_param(howmany, int, 0);
static int __init hello_init(void) {
int i;
for (i = 0; i < howmany; i++)
printk(KERN_INFO "Hello %s.\n", whom);
return 1;
}
static void __exit hello_goodbye(void) {
printk(KERN_INFO "Goodbye cruel %s.\n", whom);
}
module_init(hello_init);
module_exit(hello_goodbye);