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 /fs/fuse/dev.c | |
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 'fs/fuse/dev.c')
-rw-r--r-- | fs/fuse/dev.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ffd670bb8c8c..6176e444c76e 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -816,10 +816,29 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov, | |||
816 | return err; | 816 | return err; |
817 | } | 817 | } |
818 | 818 | ||
819 | static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size, | ||
820 | struct fuse_copy_state *cs) | ||
821 | { | ||
822 | struct fuse_notify_poll_wakeup_out outarg; | ||
823 | int err; | ||
824 | |||
825 | if (size != sizeof(outarg)) | ||
826 | return -EINVAL; | ||
827 | |||
828 | err = fuse_copy_one(cs, &outarg, sizeof(outarg)); | ||
829 | if (err) | ||
830 | return err; | ||
831 | |||
832 | return fuse_notify_poll_wakeup(fc, &outarg); | ||
833 | } | ||
834 | |||
819 | static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, | 835 | static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, |
820 | unsigned int size, struct fuse_copy_state *cs) | 836 | unsigned int size, struct fuse_copy_state *cs) |
821 | { | 837 | { |
822 | switch (code) { | 838 | switch (code) { |
839 | case FUSE_NOTIFY_POLL: | ||
840 | return fuse_notify_poll(fc, size, cs); | ||
841 | |||
823 | default: | 842 | default: |
824 | return -EINVAL; | 843 | return -EINVAL; |
825 | } | 844 | } |