cyclerror
驱动牛犊
驱动牛犊
  • 注册日期2004-01-16
  • 最后登录2005-03-01
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:672回复:0

大家帮帮忙!

楼主#
更多 发布于:2004-01-16 14:06
小弟刚开始学习编写linux设备驱动,下面代码在redhat 9.0下编译无法通过,错误+警告很多,实在是打击信心,请各位帮我看看问题出在那儿?
编译命令为:gcc -D__kernel__ -DMODULE -Wall -O2 -c module.c -o module.o

//module.c

#include <linux/fs.h>
#include<linux/module.h>

#if defined(CONFIG_SMP)
#define __SMP__
#endif
#if defined(CONFIG_MODVERSTONS)
#define MODVERSIONS
#include<linux/modversions.h>
#endif

#include<linux/kernel.h>

static struct file_operations test_fops = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};

int init_module(void)
{
register_chrdev(42,\"test\",&test_fops);
return 0;
}

void cleanup_module(void)
{
unregister_chrdev(42, \"test\");
}
游客

返回顶部