libfuse: add poll_events to fuse_file_info
authorEnke Chen <enkechen@yahoo.com>
Thu, 7 Feb 2013 13:58:50 +0000 (14:58 +0100)
committerMiklos Szeredi <mszeredi@suse.cz>
Thu, 7 Feb 2013 13:58:50 +0000 (14:58 +0100)
Make requested poll events available to the filesystem.  If the requested
eventsare not available, then this field is zero.

ChangeLog
include/fuse_common.h
include/fuse_kernel.h
lib/fuse.c
lib/fuse_lowlevel.c

index d3e629c9c7c61379e4c0c9121f470a8819aa4f21..83438b13984b274569025944caf59a8004ea8370 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
        * libfuse: add readdirplus support in fuse_lowlevel_ops.  Patch by
        Feng Shuo
 
+       * libfuse: add poll_events to fuse_file_info.  Patch by Enke Chen
+
 2013-02-06  Miklos Szeredi <miklos@szeredi.hu>
 
        * libfuse: set close-on-exec flag on pipe file descriptors.  Patch
index c8a2409964965eaa2a426246e8a21c039c6f7128..cb2d8cf852ceaa9d6d88eeb2bba5200222ef98df 100644 (file)
@@ -84,6 +84,11 @@ struct fuse_file_info {
 
        /** Lock owner id.  Available in locking operations and flush */
        uint64_t lock_owner;
+
+       /** Requested poll events.  Available in ->poll.  Only set on kernels
+           which support it.  If unsupported, this field is set to zero.
+           Introduced in version 3.0 */
+       uint32_t poll_events;
 };
 
 /**
index 28fefbbf9fa3c852152824731cdc5cc442d172c3..baee03e9043876139aef109c46c56a9b8af772e2 100644 (file)
@@ -89,6 +89,7 @@
  *
  * 7.21
  *  - add FUSE_READDIRPLUS
+ *  - send the requested events in POLL request
  */
 
 #ifndef _LINUX_FUSE_H
@@ -620,7 +621,7 @@ struct fuse_poll_in {
        __u64   fh;
        __u64   kh;
        __u32   flags;
-       __u32   padding;
+       __u32   events;
 };
 
 struct fuse_poll_out {
index 6e3c43190136a0d813985eeb1d5221607779508e..401a263defed4e179956ddf39e84edf56ec9b673 100644 (file)
@@ -2196,8 +2196,9 @@ int fuse_fs_poll(struct fuse_fs *fs, const char *path,
                int res;
 
                if (fs->debug)
-                       fprintf(stderr, "poll[%llu] ph: %p\n",
-                               (unsigned long long) fi->fh, ph);
+                       fprintf(stderr, "poll[%llu] ph: %p, events 0x%x\n",
+                               (unsigned long long) fi->fh, ph,
+                               fi->poll_events);
 
                res = fs->op.poll(path, fi, ph, reventsp);
 
index feaa076b415101b20de7da57e115e41b1d256cf7..2ac9aab65034e5b76416417b2c4c97f37ae20a9b 100644 (file)
@@ -1746,6 +1746,7 @@ static void do_poll(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
        memset(&fi, 0, sizeof(fi));
        fi.fh = arg->fh;
        fi.fh_old = fi.fh;
+       fi.poll_events = arg->events;
 
        if (req->f->op.poll) {
                struct fuse_pollhandle *ph = NULL;