mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
ep_send_events_proc(): fold into the caller
... and get rid of struct ep_send_events_data - not needed anymore. The weird way of passing the arguments in (and real return value out - nominal return value of ep_send_events_proc() is ignored) was due to the signature forced on ep_scan_ready_list() callbacks. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
443f1a0422
commit
ff07952aed
@ -233,13 +233,6 @@ struct ep_pqueue {
|
|||||||
struct epitem *epi;
|
struct epitem *epi;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Used by the ep_send_events() function as callback private data */
|
|
||||||
struct ep_send_events_data {
|
|
||||||
int maxevents;
|
|
||||||
struct epoll_event __user *events;
|
|
||||||
int res;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration options available inside /proc/sys/fs/epoll/
|
* Configuration options available inside /proc/sys/fs/epoll/
|
||||||
*/
|
*/
|
||||||
@ -1570,18 +1563,17 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __poll_t ep_send_events_proc(struct eventpoll *ep, struct list_head *head,
|
static int ep_send_events(struct eventpoll *ep,
|
||||||
void *priv)
|
struct epoll_event __user *events, int maxevents)
|
||||||
{
|
{
|
||||||
struct ep_send_events_data *esed = priv;
|
|
||||||
__poll_t revents;
|
|
||||||
struct epitem *epi, *tmp;
|
struct epitem *epi, *tmp;
|
||||||
struct epoll_event __user *uevent = esed->events;
|
LIST_HEAD(txlist);
|
||||||
struct wakeup_source *ws;
|
|
||||||
poll_table pt;
|
poll_table pt;
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
init_poll_funcptr(&pt, NULL);
|
init_poll_funcptr(&pt, NULL);
|
||||||
esed->res = 0;
|
|
||||||
|
ep_start_scan(ep, 0, false, &txlist);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can loop without lock because we are passed a task private list.
|
* We can loop without lock because we are passed a task private list.
|
||||||
@ -1590,8 +1582,11 @@ static __poll_t ep_send_events_proc(struct eventpoll *ep, struct list_head *head
|
|||||||
*/
|
*/
|
||||||
lockdep_assert_held(&ep->mtx);
|
lockdep_assert_held(&ep->mtx);
|
||||||
|
|
||||||
list_for_each_entry_safe(epi, tmp, head, rdllink) {
|
list_for_each_entry_safe(epi, tmp, &txlist, rdllink) {
|
||||||
if (esed->res >= esed->maxevents)
|
struct wakeup_source *ws;
|
||||||
|
__poll_t revents;
|
||||||
|
|
||||||
|
if (res >= maxevents)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1622,16 +1617,16 @@ static __poll_t ep_send_events_proc(struct eventpoll *ep, struct list_head *head
|
|||||||
if (!revents)
|
if (!revents)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (__put_user(revents, &uevent->events) ||
|
if (__put_user(revents, &events->events) ||
|
||||||
__put_user(epi->event.data, &uevent->data)) {
|
__put_user(epi->event.data, &events->data)) {
|
||||||
list_add(&epi->rdllink, head);
|
list_add(&epi->rdllink, &txlist);
|
||||||
ep_pm_stay_awake(epi);
|
ep_pm_stay_awake(epi);
|
||||||
if (!esed->res)
|
if (!res)
|
||||||
esed->res = -EFAULT;
|
res = -EFAULT;
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
esed->res++;
|
res++;
|
||||||
uevent++;
|
events++;
|
||||||
if (epi->event.events & EPOLLONESHOT)
|
if (epi->event.events & EPOLLONESHOT)
|
||||||
epi->event.events &= EP_PRIVATE_BITS;
|
epi->event.events &= EP_PRIVATE_BITS;
|
||||||
else if (!(epi->event.events & EPOLLET)) {
|
else if (!(epi->event.events & EPOLLET)) {
|
||||||
@ -1650,24 +1645,9 @@ static __poll_t ep_send_events_proc(struct eventpoll *ep, struct list_head *head
|
|||||||
ep_pm_stay_awake(epi);
|
ep_pm_stay_awake(epi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ep_send_events(struct eventpoll *ep,
|
|
||||||
struct epoll_event __user *events, int maxevents)
|
|
||||||
{
|
|
||||||
struct ep_send_events_data esed;
|
|
||||||
LIST_HEAD(txlist);
|
|
||||||
|
|
||||||
esed.maxevents = maxevents;
|
|
||||||
esed.events = events;
|
|
||||||
|
|
||||||
ep_start_scan(ep, 0, false, &txlist);
|
|
||||||
ep_send_events_proc(ep, &txlist, &esed);
|
|
||||||
ep_done_scan(ep, 0, false, &txlist);
|
ep_done_scan(ep, 0, false, &txlist);
|
||||||
|
|
||||||
return esed.res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct timespec64 ep_set_mstimeout(long ms)
|
static inline struct timespec64 ep_set_mstimeout(long ms)
|
||||||
|
Loading…
Reference in New Issue
Block a user