aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2008-12-08 19:26:53 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2008-12-08 19:26:53 +0000
commit5f722fa8f6561c964fd0bd651b4602ac0f7bc3b4 (patch)
tree47a21b51e3d8319b1c929c461a4934d62134164d /include
parentecfa5263ab5b19a58d53a7116fb079f3b956b918 (diff)
downloadandroid_external_fuse-5f722fa8f6561c964fd0bd651b4602ac0f7bc3b4.tar.gz
android_external_fuse-5f722fa8f6561c964fd0bd651b4602ac0f7bc3b4.tar.bz2
android_external_fuse-5f722fa8f6561c964fd0bd651b4602ac0f7bc3b4.zip
* Implement poll support. Patch by Tejun Heo
Diffstat (limited to 'include')
-rw-r--r--include/fuse.h26
-rw-r--r--include/fuse_common.h8
-rw-r--r--include/fuse_kernel.h31
-rw-r--r--include/fuse_lowlevel.h52
4 files changed, 115 insertions, 2 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 2016ccc..e1b863c 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -469,11 +469,30 @@ struct fuse_operations {
* _IOC_READ in area and if both are set in/out area. In all
* non-NULL cases, the area is of _IOC_SIZE(@cmd) bytes.
*
- * Introduced in version 2.9
+ * Introduced in version 2.8
*/
int (*ioctl) (const char *, int cmd, void *arg,
struct fuse_file_info *, unsigned int flags, void *data);
+ /**
+ * Poll for IO readiness events
+ *
+ * Note: If @ph is non-NULL, the client should notify
+ * when IO readiness events occur by calling
+ * fuse_notify_poll() with the specified @ph.
+ *
+ * Regardless of the number of times poll with a non-NULL @ph
+ * is received, single notification is enough to clear all.
+ * Notifying more times incurs overhead but doesn't harm
+ * correctness.
+ *
+ * The callee is responsible for destroying @ph with
+ * fuse_pollhandle_destroy() when no longer in use.
+ *
+ * Introduced in version 2.8
+ */
+ int (*poll) (const char *, struct fuse_file_info *,
+ struct fuse_pollhandle *ph, unsigned *reventsp);
};
/** Extra context that may be needed by some filesystems
@@ -708,9 +727,14 @@ int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
uint64_t *idx);
int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, int cmd, void *arg,
struct fuse_file_info *fi, unsigned int flags, void *data);
+int fuse_fs_poll(struct fuse_fs *fs, const char *path,
+ struct fuse_file_info *fi, struct fuse_pollhandle *ph,
+ unsigned *reventsp);
void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn);
void fuse_fs_destroy(struct fuse_fs *fs);
+int fuse_notify_poll(struct fuse_pollhandle *ph);
+
/**
* Create a new fuse filesystem object
*
diff --git a/include/fuse_common.h b/include/fuse_common.h
index fb18b61..b05ed21 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -159,6 +159,7 @@ struct fuse_conn_info {
struct fuse_session;
struct fuse_chan;
+struct fuse_pollhandle;
/**
* Create a FUSE mountpoint
@@ -219,6 +220,13 @@ int fuse_daemonize(int foreground);
*/
int fuse_version(void);
+/**
+ * Destroy poll handle
+ *
+ * @param ph the poll handle
+ */
+void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
+
/* ----------------------------------------------------------- *
* Signal handling *
* ----------------------------------------------------------- */
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index eb28a35..df558e3 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -49,6 +49,8 @@
*
* 7.11
* - add IOCTL message
+ * - add unsolicited notification support
+ * - add POLL message and NOTIFY_POLL notification
*/
#ifndef _LINUX_FUSE_H
@@ -191,6 +193,13 @@ struct fuse_file_lock {
#define FUSE_IOCTL_MAX_IOV 256
+/**
+ * Poll flags
+ *
+ * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
+ */
+#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
+
enum fuse_opcode {
FUSE_LOOKUP = 1,
FUSE_FORGET = 2, /* no reply */
@@ -229,6 +238,12 @@ enum fuse_opcode {
FUSE_BMAP = 37,
FUSE_DESTROY = 38,
FUSE_IOCTL = 39,
+ FUSE_POLL = 40,
+};
+
+enum fuse_notify_code {
+ FUSE_NOTIFY_POLL = 1,
+ FUSE_NOTIFY_CODE_MAX,
};
/* The read buffer is required to be at least 8k, but may be much larger */
@@ -445,6 +460,22 @@ struct fuse_ioctl_out {
__u32 out_iovs;
};
+struct fuse_poll_in {
+ __u64 fh;
+ __u64 kh;
+ __u32 flags;
+ __u32 padding;
+};
+
+struct fuse_poll_out {
+ __u32 revents;
+ __u32 padding;
+};
+
+struct fuse_notify_poll_wakeup_out {
+ __u64 kh;
+};
+
struct fuse_in_header {
__u32 len;
__u32 opcode;
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index e17274f..0b83214 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -817,7 +817,7 @@ struct fuse_lowlevel_ops {
* restricted ioctls, kernel prepares in/out data area
* according to the information encoded in @cmd.
*
- * Introduced in version 2.9
+ * Introduced in version 2.8
*
* Valid replies:
* fuse_reply_ioctl_retry
@@ -837,6 +837,35 @@ struct fuse_lowlevel_ops {
void (*ioctl) (fuse_req_t req, fuse_ino_t ino, int cmd, void *arg,
struct fuse_file_info *fi, unsigned *flagsp,
const void *in_buf, size_t in_bufsz, size_t out_bufszp);
+
+ /**
+ * Poll for IO readiness
+ *
+ * Introduced in version 2.8
+ *
+ * Note: If @ph is non-NULL, the client should notify
+ * when IO readiness events occur by calling
+ * fuse_lowelevel_notify_poll() with the specified @ph.
+ *
+ * Regardless of the number of times poll with a non-NULL @ph
+ * is received, single notification is enough to clear all.
+ * Notifying more times incurs overhead but doesn't harm
+ * correctness.
+ *
+ * The callee is responsible for destroying @ph with
+ * fuse_pollhandle_destroy() when no longer in use.
+ *
+ * Valid replies:
+ * fuse_reply_poll
+ * fuse_reply_err
+ *
+ * @param req request handle
+ * @param ino the inode number
+ * @param fi file information
+ * @param ph poll handle to be used for notification
+ */
+ void (*poll) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
+ struct fuse_pollhandle *ph);
};
/**
@@ -1084,6 +1113,27 @@ int fuse_reply_ioctl_retry(fuse_req_t req,
*/
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, size_t size);
+/**
+ * Reply with poll result event mask
+ *
+ * @param req request handle
+ * @param revents poll result event mask
+ */
+int fuse_reply_poll(fuse_req_t req, unsigned revents);
+
+/* ----------------------------------------------------------- *
+ * Notification *
+ * ----------------------------------------------------------- */
+
+/**
+ * Notify IO readiness event
+ *
+ * For more information, please read comment for poll operation.
+ *
+ * @param ph poll handle to notify IO readiness event for
+ */
+int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph);
+
/* ----------------------------------------------------------- *
* Utility functions *
* ----------------------------------------------------------- */