diff options
author | Christoph Hellwig <hch@lst.de> | 2018-03-05 07:26:05 -0800 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-26 09:16:44 +0200 |
commit | 9965ed174e7d38896e5d2582159d8ef31ecd4cb5 (patch) | |
tree | 955bfa805fff87c169a4814deaf311b90cca84b2 /include/linux/poll.h | |
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 'include/linux/poll.h')
-rw-r--r-- | include/linux/poll.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/poll.h b/include/linux/poll.h index a3576da63377..7e0fdcf905d2 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -74,6 +74,18 @@ static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) pt->_key = ~(__poll_t)0; /* all events enabled */ } +static inline bool file_can_poll(struct file *file) +{ + return file->f_op->poll; +} + +static inline __poll_t vfs_poll(struct file *file, struct poll_table_struct *pt) +{ + if (unlikely(!file->f_op->poll)) + return DEFAULT_POLLMASK; + return file->f_op->poll(file, pt); +} + struct poll_table_entry { struct file *filp; __poll_t key; |