pansiyi
驱动牛犊
驱动牛犊
  • 注册日期2006-02-26
  • 最后登录2009-12-16
  • 粉丝0
  • 关注0
  • 积分193分
  • 威望50点
  • 贡献值0点
  • 好评度19点
  • 原创分0分
  • 专家分0分
阅读:1506回复:2

谁可以帮我看看这个驱动的问题呀????

楼主#
更多 发布于:2007-03-14 11:56
  #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的内核
cyliu
论坛版主
论坛版主
  • 注册日期2003-06-13
  • 最后登录2014-04-11
  • 粉丝5
  • 关注0
  • 积分1238分
  • 威望2531点
  • 贡献值0点
  • 好评度577点
  • 原创分14分
  • 专家分10分
沙发#
发布于:2007-03-14 19:26
什么问题啊?
走走看看开源好 Solaris vs Linux
cyliu
论坛版主
论坛版主
  • 注册日期2003-06-13
  • 最后登录2014-04-11
  • 粉丝5
  • 关注0
  • 积分1238分
  • 威望2531点
  • 贡献值0点
  • 好评度577点
  • 原创分14分
  • 专家分10分
板凳#
发布于: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是什么意思啊
走走看看开源好 Solaris vs Linux
游客

返回顶部