diff options
author | Christoph Hellwig | 2018-03-05 07:26:05 -0800 |
---|---|---|
committer | Christoph Hellwig | 2018-05-26 09:16:44 +0200 |
commit | 9965ed174e7d38896e5d2582159d8ef31ecd4cb5 (patch) | |
tree | 955bfa805fff87c169a4814deaf311b90cca84b2 /fs/select.c | |
parent | 6e8b704df58407aad7607053cb1b5ead4ac4a0bc (diff) |
fs: add new vfs_poll and file_can_poll helpers
These abstract out calls to the poll method in preparation for changes
in how we poll.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/select.c')
-rw-r--r-- | fs/select.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/select.c b/fs/select.c index 25da26253485..e30def680b2e 100644 --- a/fs/select.c +++ b/fs/select.c @@ -502,14 +502,10 @@ static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) continue; f = fdget(i); if (f.file) { - const struct file_operations *f_op; - f_op = f.file->f_op; - mask = DEFAULT_POLLMASK; - if (f_op->poll) { - wait_key_set(wait, in, out, - bit, busy_flag); - mask = (*f_op->poll)(f.file, wait); - } + wait_key_set(wait, in, out, bit, + busy_flag); + mask = vfs_poll(f.file, wait); + fdput(f); if ((mask & POLLIN_SET) && (in & bit)) { res_in |= bit; @@ -825,13 +821,10 @@ static inline __poll_t do_pollfd(struct pollfd *pollfd, poll_table *pwait, /* userland u16 ->events contains POLL... bitmap */ filter = demangle_poll(pollfd->events) | EPOLLERR | EPOLLHUP; - mask = DEFAULT_POLLMASK; - if (f.file->f_op->poll) { - pwait->_key = filter | busy_flag; - mask = f.file->f_op->poll(f.file, pwait); - if (mask & busy_flag) - *can_busy_poll = true; - } + pwait->_key = filter | busy_flag; + mask = vfs_poll(f.file, pwait); + if (mask & busy_flag) + *can_busy_poll = true; mask &= filter; /* Mask out unneeded events. */ fdput(f); |