expected declaration specifiers or ‘...’ before ‘poll_table’

wxsperfect 2010-12-14 09:55:26
在写字符驱动的时候遇到这样的问题:
头文件
1 #include <linux/module.h>
2 #include <linux/types.h>
3 #include <linux/fs.h>
4 #include <linux/errno.h>
5 #include <linux/mm.h>
6 #include <linux/sched.h>
7 #include <linux/init.h>
8 #include <linux/cdev.h>
9 #include <asm/io.h>
10 #include <asm/system.h>
11 #include <asm/uaccess.h>
12 #include <asm/io.h>
13
14 #define GLOBALFIFO_SIZE 0x1000
15 #define MEM_CLEAR 0x1
16 #define GLOBALFIFO_MAJOR 250
其中的poll函数实现如下:
static unsigned int
184 globalfifo_poll(struct file *filp, poll_table *wait)
185 {
186 unsigned int mask = 0;
187 struct globalfifo_dev *dev = filp->private_data;
188 down(&dev->sem);
189
190 poll_wait(filp,&dev->r_wait,wait);
191 poll_wait(filp,&dev->w_wait,wait);
192
193 if (dev->current_len != 0)
194 mask |= POLLIN | POLLRDNORM;
195 if (dev->current_len != GLOBALFIFO_SIZE)
196 mask |= POLLOUT | POLLWRNORM;
197
198 up(&dev->sem);
199 return mask;
200 }

file_operations 实现如下:
static const struct file_operations globalfifo_fops = {
203 .owner = THIS_MODULE,
204 .llseek = globalfifo_llseek,
205 .read = globalfifo_read,
206 .write = globalfifo_write,
207 .ioctl = globalfifo_ioctl,
208 .poll = globalfifo_poll,
209 .open = globalfifo_open,
210 .release = globalfifo_release,
211 };


在没有写poll之前我这个驱动能够加载和运行。
...全文
198 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Young_Xu 2011-04-01
  • 打赏
  • 举报
回复
偶也碰到了这个问题,在网上找了很久都没找到要包含哪一个头文件。

偶然中看到了这个帖子,1楼的方法受用!!
bluejays 2010-12-15
  • 打赏
  • 举报
回复
好像是少了头文件,加上这个再试试
#include <linux/poll.h>
wxsperfect 2010-12-15
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 bluejays 的回复:]
好像是少了头文件,加上这个再试试
#include <linux/poll.h>
[/Quote]

加了也不行~~~~郁闷~~~

4,441

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧