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>
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user