阅读:1523回复:2
谁可以帮我看看这个驱动的问题呀????
#define MODULE
#include<linux/init.h> #include<linux/module.h> #include<linux/fs.h> MODULE_LICENSE("GPL"); /*struct file_operations f_op={ //llseek: NULL, //read: NULL, //write: NULL, //ioctl:NULL, .open=test_open, //release: NULL };*/ unsigned int fs=0; static int test_open(struct inode *inode,struct file *file) { printk("open"); return 0; } static void test_release(struct inode *indoe,struct file *file) { printk("release"); } struct file_operations f_op={ struct module *owner; NULL; NULL; NULL; NULL; NULL; NULL; NULL; NULL; test_open; NULL; test_release; NULL; NULL; NULL; NULL; NULL; }; int my_module() { int res; res=register_chrdev(0,"pan",&f_op); if(res<0) { printk("can't get"); return res; } fs=res; printk("hello,pansiyi\n"); return 0; } void my_clean() { unregister_chrdev(fs,"pan"); printk("bye,pansiyi\n"); } module_init(my_module); module_exit(my_clean); 我的平台是RED HAT9.0,2.4.20的内核 |
|
沙发#
发布于:2007-03-14 19:26
什么问题啊?
|
|
|
板凳#
发布于:2007-03-14 19:27
struct file_operations f_op={
struct module *owner; NULL; NULL; NULL; NULL; NULL; NULL; NULL; NULL; test_open; NULL; test_release; NULL; NULL; NULL; NULL; NULL; }; 中的struct module *owner是什么意思啊 |
|
|