/***************20121012*********************/
#include <linux/init.h>
#include <linux/module.h>
/*when use by downing*/
static int hello_init(void)
{
printk(KERN_ALERT "hello, world \n");
return 0;
}
/*use when remove*/
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world \n");
}
module_init(hello_init);
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
//特殊的宏,采用自由许可证 如果没有,内核在装载该模块时会产生抱怨
/*when use by downing*/
static int hello_init(void)
{
printk(KERN_ALERT "hello, world \n");
return 0;
}
/*use when remove*/
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world \n");
}
module_init(hello_init);
module_init(hello_exit);
/*后记*/
/*编写驱动程序退出时,必须撤出初始化函数所做的一切,这与应用程序的最大不同。否则,在系统重新引导之前某些东西就会残留在系统*/