aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2010-11-08 21:13:32 +0100
committerMiklos Szeredi <mszeredi@suse.cz>2010-11-08 21:13:32 +0100
commit3f41e8f2c3d700930e1e604b2e9116f9f827283f (patch)
tree151ce225bc4a3379a09a98af78acee7388f473a4 /include
parentd04e0ea8ff63ce39127672b4dac3b52a9cc653b2 (diff)
downloadandroid_external_fuse-3f41e8f2c3d700930e1e604b2e9116f9f827283f.tar.gz
android_external_fuse-3f41e8f2c3d700930e1e604b2e9116f9f827283f.tar.bz2
android_external_fuse-3f41e8f2c3d700930e1e604b2e9116f9f827283f.zip
libfuse: add retrieve request
Retrieve data stored in the kernel buffers for a given inode.
Diffstat (limited to 'include')
-rw-r--r--include/fuse_kernel.h21
-rw-r--r--include/fuse_lowlevel.h39
2 files changed, 60 insertions, 0 deletions
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index 25d3555..c7c99a5 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -66,6 +66,7 @@
*
* 7.15
* - add store notify
+ * - add retrieve notify
*/
#ifndef _LINUX_FUSE_H
@@ -285,6 +286,7 @@ enum fuse_opcode {
FUSE_DESTROY = 38,
FUSE_IOCTL = 39,
FUSE_POLL = 40,
+ FUSE_NOTIFY_REPLY = 41,
/* CUSE specific operations */
CUSE_INIT = 4096,
@@ -295,6 +297,7 @@ enum fuse_notify_code {
FUSE_NOTIFY_INVAL_INODE = 2,
FUSE_NOTIFY_INVAL_ENTRY = 3,
FUSE_NOTIFY_STORE = 4,
+ FUSE_NOTIFY_RETRIEVE = 5,
FUSE_NOTIFY_CODE_MAX,
};
@@ -610,4 +613,22 @@ struct fuse_notify_store_out {
__u32 padding;
};
+struct fuse_notify_retrieve_out {
+ __u64 notify_unique;
+ __u64 nodeid;
+ __u64 offset;
+ __u32 size;
+ __u32 padding;
+};
+
+/* Matches the size of fuse_write_in */
+struct fuse_notify_retrieve_in {
+ __u64 dummy1;
+ __u64 offset;
+ __u32 size;
+ __u32 dummy2;
+ __u64 dummy3;
+ __u64 dummy4;
+};
+
#endif /* _LINUX_FUSE_H */
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 0a8fdf1..8f31471 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -902,6 +902,17 @@ struct fuse_lowlevel_ops {
void (*write_buf) (fuse_req_t req, fuse_ino_t ino,
struct fuse_bufvec *bufv, off_t off,
struct fuse_file_info *fi);
+
+ /**
+ * Callback function for the retrieve request
+ *
+ * @param cookie user data supplied to fuse_lowlevel_notify_retrieve()
+ * @param ino the inode number supplied to fuse_lowlevel_notify_retrieve()
+ * @param offset the offset supplied to fuse_lowlevel_notify_retrieve()
+ * @param bufv the buffer containing the returned data
+ */
+ void (*retrieve_reply) (void *cookie, fuse_ino_t ino, off_t offset,
+ struct fuse_bufvec *bufv);
};
/**
@@ -1248,6 +1259,34 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
off_t offset, struct fuse_bufvec *bufv,
enum fuse_buf_copy_flags flags);
+/**
+ * Retrieve data from the kernel buffers
+ *
+ * Retrieve data in the kernel buffers belonging to the given inode.
+ * If successful then the retrieve_reply() method will be called with
+ * the returned data.
+ *
+ * Only present pages are returned in the retrieve reply. Retrieving
+ * stops when it finds a non-present page and only data prior to that is
+ * returned.
+ *
+ * If this function returns an error, then the retrieve will not be
+ * completed and no reply will be sent.
+ *
+ * This function doesn't change the dirty state of pages in the kernel
+ * buffer. For dirty pages the write() method will be called
+ * regardless of having been retrieved previously.
+ *
+ * @param ch the channel through which to send the invalidation
+ * @param ino the inode number
+ * @param size the number of bytes to retrieve
+ * @param offset the starting offset into the file to retrieve from
+ * @param cookie user data to supply to the reply callback
+ * @return zero for success, -errno for failure
+ */
+int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
+ size_t size, off_t offset, void *cookie);
+
/* ----------------------------------------------------------- *
* Utility functions *