当前位置: 技术问答>linux和unix
这么一个简单的驱动程序框架,为什么不能编译通过?
来源: 互联网 发布时间:2015-07-19
本文导语: 我正在学习编写驱动程序,下面是个简单的例子hello.c : #include #include #include int hello_major=0; static int hello_open(struct inode *, struct file *); static int hello_release(struct inode *, struct file *); static struct file_operat...
我正在学习编写驱动程序,下面是个简单的例子hello.c :
#include
#include
#include
int hello_major=0;
static int hello_open(struct inode *, struct file *);
static int hello_release(struct inode *, struct file *);
static struct file_operations hello_fops=
{
open: hello_open,
release: hello_release,
};
int hello_open(struct inode *inode, struct file *filp)
{
return 0;
}
int hello_release(struct inode *inode, struct file *filp)
{
return 0;
}
int init_module(void)
{
int result;
SET_MODULE_OWNER(&hello_fops);
result = register_chrdev(hello_major, "hello",&hello_fops);
if(result
#include
#include
#include
int hello_major=0;
static int hello_open(struct inode *, struct file *);
static int hello_release(struct inode *, struct file *);
static struct file_operations hello_fops=
{
open: hello_open,
release: hello_release,
};
int hello_open(struct inode *inode, struct file *filp)
{
return 0;
}
int hello_release(struct inode *inode, struct file *filp)
{
return 0;
}
int init_module(void)
{
int result;
SET_MODULE_OWNER(&hello_fops);
result = register_chrdev(hello_major, "hello",&hello_fops);
if(result