- 论坛徽章:
- 0
|
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
MODULE_LICENSE("GPL");
#define MAJOR_NUM 254 //主设备号
static int globalvar_open(struct inode *inode, struct file *file);
static ssize_t globalvar_read(struct file *, char *, size_t, loff_t*);
static ssize_t globalvar_write(struct file *, const char *, size_t, loff_t*);
//初始化字符设备驱动的file_operations结构体
static struct file_operations globalvar_fops = {
.read = globalvar_read,
.write = globalvar_write,
.open = globalvar_open
};
这样安装始化 file_operations,结果用gcc进行编译出现以下错误.(错误见附件)
用下面另一种方法初始化,也出现一样的错误,
static struct file_operations globalvar_fops = {
read: globalvar_read,
write: globalvar_write,
open: globalvar_open
};
请问是什么原因导致的?谢谢!
我的系统是:
Linux Red Hat9.0 Kernel 2.4.20-8
gcc 版本: 3.2.2 20030222
[ 本帖最后由 hs_49 于 2007-4-3 17:15 编辑 ] |
|