diff options
author | Tejun Heo <tj@kernel.org> | 2008-11-26 06:03:55 -0500 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2008-11-26 06:03:55 -0500 |
commit | 95668a69a4bb862063c4d28a746e55107dee7b98 (patch) | |
tree | 0679e0f43274648bad70e694a9efb8bcfed55adc /include/linux/fuse.h | |
parent | 8599396b5062bf6bd2a0b433503849e2322df1c2 (diff) |
fuse: implement poll support
Implement poll support. Polled files are indexed using kh in a RB
tree rooted at fuse_conn->polled_files.
Client should send FUSE_NOTIFY_POLL notification once after processing
FUSE_POLL which has FUSE_POLL_SCHEDULE_NOTIFY set. Sending
notification unconditionally after the latest poll or everytime file
content might have changed is inefficient but won't cause malfunction.
fuse_file_poll() can sleep and requires patches from the following
thread which allows f_op->poll() to sleep.
http://thread.gmane.org/gmane.linux.kernel/726176
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'include/linux/fuse.h')
-rw-r--r-- | include/linux/fuse.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index abde9949e2c0..5650cf033e73 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
@@ -163,6 +163,13 @@ struct fuse_file_lock { | |||
163 | 163 | ||
164 | #define FUSE_IOCTL_MAX_IOV 256 | 164 | #define FUSE_IOCTL_MAX_IOV 256 |
165 | 165 | ||
166 | /** | ||
167 | * Poll flags | ||
168 | * | ||
169 | * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify | ||
170 | */ | ||
171 | #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) | ||
172 | |||
166 | enum fuse_opcode { | 173 | enum fuse_opcode { |
167 | FUSE_LOOKUP = 1, | 174 | FUSE_LOOKUP = 1, |
168 | FUSE_FORGET = 2, /* no reply */ | 175 | FUSE_FORGET = 2, /* no reply */ |
@@ -201,9 +208,11 @@ enum fuse_opcode { | |||
201 | FUSE_BMAP = 37, | 208 | FUSE_BMAP = 37, |
202 | FUSE_DESTROY = 38, | 209 | FUSE_DESTROY = 38, |
203 | FUSE_IOCTL = 39, | 210 | FUSE_IOCTL = 39, |
211 | FUSE_POLL = 40, | ||
204 | }; | 212 | }; |
205 | 213 | ||
206 | enum fuse_notify_code { | 214 | enum fuse_notify_code { |
215 | FUSE_NOTIFY_POLL = 1, | ||
207 | FUSE_NOTIFY_CODE_MAX, | 216 | FUSE_NOTIFY_CODE_MAX, |
208 | }; | 217 | }; |
209 | 218 | ||
@@ -421,6 +430,22 @@ struct fuse_ioctl_out { | |||
421 | __u32 out_iovs; | 430 | __u32 out_iovs; |
422 | }; | 431 | }; |
423 | 432 | ||
433 | struct fuse_poll_in { | ||
434 | __u64 fh; | ||
435 | __u64 kh; | ||
436 | __u32 flags; | ||
437 | __u32 padding; | ||
438 | }; | ||
439 | |||
440 | struct fuse_poll_out { | ||
441 | __u32 revents; | ||
442 | __u32 padding; | ||
443 | }; | ||
444 | |||
445 | struct fuse_notify_poll_wakeup_out { | ||
446 | __u64 kh; | ||
447 | }; | ||
448 | |||
424 | struct fuse_in_header { | 449 | struct fuse_in_header { |
425 | __u32 len; | 450 | __u32 len; |
426 | __u32 opcode; | 451 | __u32 opcode; |