#include
#include
#include
#include
#define DRIVER_AUTHOR "winnie@quanta"
#define DRIVER_DESC "hello"
static int myinit = 3;
module_param(myinit, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(myinit, "An integer");
static int __init hello_init(void)
{
printk(KERN_INFO "hello init myinit= %d \n", myinit);
if(myinit==0)
printk(KERN_INFO "@@myinit is zero = %d \n", myinit);
else
printk(KERN_INFO "@@myinit other = %d \n", myinit);
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_INFO "hellp exit \n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
insmod proc.ko myinit=10
沒有留言:
張貼留言