diff options
| author | Christoph Hellwig <hch@lst.de> | 2018-03-05 10:26:05 -0500 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2018-05-26 03:16:44 -0400 |
| 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) | |||
| 74 | pt->_key = ~(__poll_t)0; /* all events enabled */ | 74 | pt->_key = ~(__poll_t)0; /* all events enabled */ |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | static inline bool file_can_poll(struct file *file) | ||
| 78 | { | ||
| 79 | return file->f_op->poll; | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline __poll_t vfs_poll(struct file *file, struct poll_table_struct *pt) | ||
| 83 | { | ||
| 84 | if (unlikely(!file->f_op->poll)) | ||
| 85 | return DEFAULT_POLLMASK; | ||
| 86 | return file->f_op->poll(file, pt); | ||
| 87 | } | ||
| 88 | |||
| 77 | struct poll_table_entry { | 89 | struct poll_table_entry { |
| 78 | struct file *filp; | 90 | struct file *filp; |
| 79 | __poll_t key; | 91 | __poll_t key; |
