|
错误:
parse error before ';' token 第82行(在源代码中已经做标记,在file_operation chd_fops中的第一行)
源码:#define __NO_VERSION__
#include <linux/version.h>
#include <linux/config.h>
char kernel_version [] = UTS_RELEASE;/*kernel version*/
#include <linux/types.h>
#include <linux/mm.h> /* for verity_area */
#include <linux/errno.h>
#include <asm/segment.h> /* for put_usr*/
#include<linux/param.h>
#include<linux/user.h>
#include<linux/fs.h>
#include<linux/kernel.h>
#include<linux/module.h>
static int chd_write(struct inode*inode,struct file *filp,const char *buf,int count)
{
return count;
}
static int chd_open(struct inode *inode,struct file *filp)
{
MOD_INC_USE_COUNT;
return 0;
}
static void chd_release()
{
MOD_DEC_USE_COUNT;
}
static int chd_read(struct inode *inode,struct file *filp,const char *buf,int count)
{
int left;
if (verify_area(VERIFY_WRITE,buf,count) == -EFAULT )
return -EFAULT;
for(left = count ; left > 0 ; left--)
{
put_user(1,buf);/*?*/
buf++;
}
return count;
}
struct file_operations chd_fops =
{
NULL; /*第82行*/
NULL;
chd_read;
chd_write;
NULL;
NULL;
NULL;
NULL;
chd_open;
NULL;
chd_release;
NULL;
NULL;
NULL;
NULL;
NULL;
NULL;
NULL;
};
int init_module()
{
int rec=module_register_chrdev(0,"chd",&chd_fops);
if (rec<0)
{
printk("the device init is erro!\n");
return 1;
}
return 0;
}
int cleanup_module()
{
int urc=module_unregister_chrdev(rec,"chd");
if( urc<0)
{
printk("erro unregister the module !!\n");
return 1;
}
return 0;
}
MODULE_LICENSE("GPL") |
|