#include
#include
#include
#define AUTHOR "liubin m_pappercut@hotmail.com"
char *hello = "2";
char *goodbye = "3";
MODULE_PARM(hello, "s");
MODULE_PARM(goodbye, "s");
static int __init ini_parm(void)
{
printk(KERN_ALERT "%s\n", hello);
return 0;
}
static void __exit des_parm(void)
{
printk(KERN_ALERT "%s\n", goodbye);
}
module_init(ini_parm);
module_exit(des_parm);
MODULE_AUTHOR(AUTHOR);
会报错:
make -C /lib/modules/2.6.31.9-174.fc12.i686.PAE/build M=/root/liubin/module modules
make[1]: Entering directory `/usr/src/kernels/2.6.31.9-174.fc12.i686.PAE'
CC [M] /root/liubin/module/parm.o
/root/liubin/module/parm.c:13: 错误:expected ‘)’ before string constant
/root/liubin/module/parm.c:14: 错误:expected ‘)’ before string constant
make[2]: *** [/root/liubin/module/parm.o] 错误 1
make[1]: *** [_module_/root/liubin/module] 错误 2
make[1]: Leaving directory `/usr/src/kernels/2.6.31.9-174.fc12.i686.PAE'
make: *** [defalult] 错误 2
就是MODULE_PARM那2行出的问题。。请问谁知道怎么回事吗- -
pappercut 于 2010-01-23 08:22:11发表:
找到了。。2.6.11以后就编程module_param了。。。