Commit b95a7658 authored by Linus Torvalds's avatar Linus Torvalds

Merge

parents 42877042 1f688548
...@@ -651,10 +651,11 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len, ...@@ -651,10 +651,11 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
SOLD("LISTEN done"); SOLD("LISTEN done");
} }
if (!(filp->f_flags & O_NONBLOCK)) { if (!(filp->f_flags & O_NONBLOCK)) {
poll_table wait_table, *wait; struct poll_wqueues wait_table;
poll_table *wait;
poll_initwait(&wait_table); poll_initwait(&wait_table);
wait = &wait_table; wait = &wait_table.pt;
for(;;) { for(;;) {
SOLD("loop"); SOLD("loop");
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
......
...@@ -883,7 +883,7 @@ static int ep_insert(struct eventpoll *ep, struct pollfd *pfd, struct file *tfil ...@@ -883,7 +883,7 @@ static int ep_insert(struct eventpoll *ep, struct pollfd *pfd, struct file *tfil
/* Initialize the poll table using the queue callback */ /* Initialize the poll table using the queue callback */
epq.dpi = dpi; epq.dpi = dpi;
poll_initwait_ex(&epq.pt, ep_ptable_queue_proc, NULL); init_poll_funcptr(&epq.pt, ep_ptable_queue_proc);
/* /*
* Attach the item to the poll hooks and get current event bits. * Attach the item to the poll hooks and get current event bits.
...@@ -892,8 +892,6 @@ static int ep_insert(struct eventpoll *ep, struct pollfd *pfd, struct file *tfil ...@@ -892,8 +892,6 @@ static int ep_insert(struct eventpoll *ep, struct pollfd *pfd, struct file *tfil
*/ */
revents = tfile->f_op->poll(tfile, &epq.pt); revents = tfile->f_op->poll(tfile, &epq.pt);
poll_freewait(&epq.pt);
/* /*
* We have to check if something went wrong during the poll wait queue * We have to check if something went wrong during the poll wait queue
* install process. Namely an allocation for a wait queue failed due * install process. Namely an allocation for a wait queue failed due
......
...@@ -53,10 +53,18 @@ struct poll_table_page { ...@@ -53,10 +53,18 @@ struct poll_table_page {
* as all select/poll functions have to call it to add an entry to the * as all select/poll functions have to call it to add an entry to the
* poll table. * poll table.
*/ */
void __pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p);
void __pollfreewait(poll_table* pt) void poll_initwait(struct poll_wqueues *pwq)
{ {
struct poll_table_page * p = pt->table; init_poll_funcptr(&pwq->pt, __pollwait);
pwq->error = 0;
pwq->table = NULL;
}
void poll_freewait(struct poll_wqueues *pwq)
{
struct poll_table_page * p = pwq->table;
while (p) { while (p) {
struct poll_table_entry * entry; struct poll_table_entry * entry;
struct poll_table_page *old; struct poll_table_page *old;
...@@ -73,8 +81,9 @@ void __pollfreewait(poll_table* pt) ...@@ -73,8 +81,9 @@ void __pollfreewait(poll_table* pt)
} }
} }
void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) void __pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *_p)
{ {
struct poll_wqueues *p = container_of(_p, struct poll_wqueues, pt);
struct poll_table_page *table = p->table; struct poll_table_page *table = p->table;
if (!table || POLL_TABLE_FULL(table)) { if (!table || POLL_TABLE_FULL(table)) {
...@@ -165,7 +174,8 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds) ...@@ -165,7 +174,8 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
int do_select(int n, fd_set_bits *fds, long *timeout) int do_select(int n, fd_set_bits *fds, long *timeout)
{ {
poll_table table, *wait; struct poll_wqueues table;
poll_table *wait;
int retval, i, off; int retval, i, off;
long __timeout = *timeout; long __timeout = *timeout;
...@@ -178,7 +188,7 @@ int do_select(int n, fd_set_bits *fds, long *timeout) ...@@ -178,7 +188,7 @@ int do_select(int n, fd_set_bits *fds, long *timeout)
n = retval; n = retval;
poll_initwait(&table); poll_initwait(&table);
wait = &table; wait = &table.pt;
if (!__timeout) if (!__timeout)
wait = NULL; wait = NULL;
retval = 0; retval = 0;
...@@ -385,10 +395,10 @@ static void do_pollfd(unsigned int num, struct pollfd * fdpage, ...@@ -385,10 +395,10 @@ static void do_pollfd(unsigned int num, struct pollfd * fdpage,
} }
static int do_poll(unsigned int nfds, unsigned int nchunks, unsigned int nleft, static int do_poll(unsigned int nfds, unsigned int nchunks, unsigned int nleft,
struct pollfd *fds[], poll_table *wait, long timeout) struct pollfd *fds[], struct poll_wqueues *wait, long timeout)
{ {
int count; int count;
poll_table* pt = wait; poll_table* pt = &wait->pt;
for (;;) { for (;;) {
unsigned int i; unsigned int i;
...@@ -415,7 +425,7 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout) ...@@ -415,7 +425,7 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout)
{ {
int i, j, fdcount, err; int i, j, fdcount, err;
struct pollfd **fds; struct pollfd **fds;
poll_table table, *wait; struct poll_wqueues table, *wait;
int nchunks, nleft; int nchunks, nleft;
/* Do a sanity check on nfds ... */ /* Do a sanity check on nfds ... */
......
...@@ -10,49 +10,39 @@ ...@@ -10,49 +10,39 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
struct poll_table_page;
struct poll_table_struct; struct poll_table_struct;
/*
* structures and helpers for f_op->poll implementations
*/
typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *);
typedef void (*poll_free_proc)(struct poll_table_struct *);
typedef struct poll_table_struct { typedef struct poll_table_struct {
poll_queue_proc qproc; poll_queue_proc qproc;
poll_free_proc fproc;
int error;
struct poll_table_page * table;
} poll_table; } poll_table;
extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
extern void __pollfreewait(poll_table* pt);
static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
{ {
if (p && wait_address) if (p && wait_address)
p->qproc(filp, wait_address, p); p->qproc(filp, wait_address, p);
} }
static inline void poll_initwait_ex(poll_table* pt, poll_queue_proc qproc, poll_free_proc fproc) static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
{ {
pt->qproc = qproc; pt->qproc = qproc;
pt->fproc = fproc;
pt->error = 0;
pt->table = NULL;
}
static inline void poll_initwait(poll_table* pt)
{
poll_initwait_ex(pt, __pollwait, __pollfreewait);
} }
static inline void poll_freewait(poll_table* pt) /*
{ * Structures and helpers for sys_poll/sys_poll
*/
if (pt && pt->fproc) struct poll_wqueues {
pt->fproc(pt); poll_table pt;
} struct poll_table_page * table;
int error;
};
extern void poll_initwait(struct poll_wqueues *pwq);
extern void poll_freewait(struct poll_wqueues *pwq);
/* /*
* Scaleable version of the fd_set. * Scaleable version of the fd_set.
......
...@@ -269,8 +269,8 @@ EXPORT_SYMBOL(generic_fillattr); ...@@ -269,8 +269,8 @@ EXPORT_SYMBOL(generic_fillattr);
EXPORT_SYMBOL(generic_file_llseek); EXPORT_SYMBOL(generic_file_llseek);
EXPORT_SYMBOL(remote_llseek); EXPORT_SYMBOL(remote_llseek);
EXPORT_SYMBOL(no_llseek); EXPORT_SYMBOL(no_llseek);
EXPORT_SYMBOL(__pollwait); EXPORT_SYMBOL(poll_initwait);
EXPORT_SYMBOL(__pollfreewait); EXPORT_SYMBOL(poll_freewait);
EXPORT_SYMBOL(ROOT_DEV); EXPORT_SYMBOL(ROOT_DEV);
EXPORT_SYMBOL(find_get_page); EXPORT_SYMBOL(find_get_page);
EXPORT_SYMBOL(find_lock_page); EXPORT_SYMBOL(find_lock_page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment