aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-03-05 10:26:05 -0500
committerChristoph Hellwig <hch@lst.de>2018-05-26 03:16:44 -0400
commit9965ed174e7d38896e5d2582159d8ef31ecd4cb5 (patch)
tree955bfa805fff87c169a4814deaf311b90cca84b2 /net/9p
parent6e8b704df58407aad7607053cb1b5ead4ac4a0bc (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 'net/9p')
-rw-r--r--net/9p/trans_fd.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 0cfba919d167..3811775692d0 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -231,7 +231,7 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
231static __poll_t 231static __poll_t
232p9_fd_poll(struct p9_client *client, struct poll_table_struct *pt, int *err) 232p9_fd_poll(struct p9_client *client, struct poll_table_struct *pt, int *err)
233{ 233{
234 __poll_t ret, n; 234 __poll_t ret;
235 struct p9_trans_fd *ts = NULL; 235 struct p9_trans_fd *ts = NULL;
236 236
237 if (client && client->status == Connected) 237 if (client && client->status == Connected)
@@ -243,19 +243,9 @@ p9_fd_poll(struct p9_client *client, struct poll_table_struct *pt, int *err)
243 return EPOLLERR; 243 return EPOLLERR;
244 } 244 }
245 245
246 if (!ts->rd->f_op->poll) 246 ret = vfs_poll(ts->rd, pt);
247 ret = DEFAULT_POLLMASK; 247 if (ts->rd != ts->wr)
248 else 248 ret = (ret & ~EPOLLOUT) | (vfs_poll(ts->wr, pt) & ~EPOLLIN);
249 ret = ts->rd->f_op->poll(ts->rd, pt);
250
251 if (ts->rd != ts->wr) {
252 if (!ts->wr->f_op->poll)
253 n = DEFAULT_POLLMASK;
254 else
255 n = ts->wr->f_op->poll(ts->wr, pt);
256 ret = (ret & ~EPOLLOUT) | (n & ~EPOLLIN);
257 }
258
259 return ret; 249 return ret;
260} 250}
261 251