diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2011-12-06 18:06:18 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2011-12-06 18:06:18 +0100 |
commit | 4b2157c44e6ad7e692fcffb7450143e83151d36b (patch) | |
tree | 9b75b0fdab1ea4be8f435a69a1497cc744ad56eb /include | |
parent | e3f95263a703d45f091dcf9655806978d2577797 (diff) | |
download | android_external_fuse-4b2157c44e6ad7e692fcffb7450143e83151d36b.tar.gz android_external_fuse-4b2157c44e6ad7e692fcffb7450143e83151d36b.tar.bz2 android_external_fuse-4b2157c44e6ad7e692fcffb7450143e83151d36b.zip |
Add mmap() and munmap() methods to low level API
Currently this is only useful for CUSE. Also update retrieve_reply()
method.
Diffstat (limited to 'include')
-rw-r--r-- | include/cuse_lowlevel.h | 7 | ||||
-rw-r--r-- | include/fuse_kernel.h | 25 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 53 |
3 files changed, 83 insertions, 2 deletions
diff --git a/include/cuse_lowlevel.h b/include/cuse_lowlevel.h index e147fa2..b8824fb 100644 --- a/include/cuse_lowlevel.h +++ b/include/cuse_lowlevel.h @@ -63,6 +63,13 @@ struct cuse_lowlevel_ops { const void *in_buf, size_t in_bufsz, size_t out_bufsz); void (*poll) (fuse_req_t req, struct fuse_file_info *fi, struct fuse_pollhandle *ph); + void (*mmap) (fuse_req_t req, uint64_t addr, size_t length, + int prot, int flags, off_t offset, + struct fuse_file_info *fi); + void (*munmap) (fuse_req_t req, uint64_t map_id, size_t length, + struct fuse_file_info *fi); + void (*retrieve_reply) (fuse_req_t req, void *cookie, uint64_t map_id, + off_t offset, struct fuse_bufvec *bufv); }; struct fuse_session *cuse_lowlevel_new(struct fuse_args *args, diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h index eb8c790..039eb1f 100644 --- a/include/fuse_kernel.h +++ b/include/fuse_kernel.h @@ -79,6 +79,7 @@ * * 7.18 * - add FUSE_IOCTL_DIR flag + * - add FUSE_MMAP and FUSE_MUNMAP */ #ifndef _LINUX_FUSE_H @@ -308,6 +309,8 @@ enum fuse_opcode { FUSE_POLL = 40, FUSE_NOTIFY_REPLY = 41, FUSE_BATCH_FORGET = 42, + FUSE_MMAP = 43, + FUSE_MUNMAP = 44, /* CUSE specific operations */ CUSE_INIT = 4096, @@ -600,6 +603,28 @@ struct fuse_notify_poll_wakeup_out { __u64 kh; }; +struct fuse_mmap_in { + __u64 fh; + __u64 addr; + __u64 len; + __u32 prot; + __u32 flags; + __u64 offset; +}; + +struct fuse_mmap_out { + __u64 mapid; /* Mmap ID, same namespace as Inode ID */ + __u64 size; /* Size of memory region */ + __u64 reserved; +}; + +struct fuse_munmap_in { + __u64 fh; + __u64 mapid; + __u64 size; /* Size of memory region */ + __u64 reserved; +}; + struct fuse_in_header { __u32 len; __u32 opcode; diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 51aea39..6435937 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -911,13 +911,19 @@ struct fuse_lowlevel_ops { /** * Callback function for the retrieve request * + * Introduced in version 2.9 + * + * Valid replies: + * fuse_reply_none + * + * @param req request handle * @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); + void (*retrieve_reply) (fuse_req_t req, void *cookie, fuse_ino_t ino, + off_t offset, struct fuse_bufvec *bufv); /** * Forget about multiple inodes @@ -951,6 +957,37 @@ struct fuse_lowlevel_ops { */ void (*flock) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, int op); + + /** + * Direct mmap (CUSE only for now) + * + * @param req request handle + * @param ino the inode number + * @param addr starting address (in clients address space) + * @param length length of the mapping + * @param prot desired memory protection of the mapping + * @param flags mmap flags + * @param fi file information + * + * Introduced in version 2.9 + */ + void (*mmap) (fuse_req_t req, fuse_ino_t ino, uint64_t addr, + size_t length, int prot, int flags, off_t offset, + struct fuse_file_info *fi); + + /** + * Direct munmap (CUSE only for now) + * + * @param req request handle + * @param ino the inode number + * @param map_id identifies the mapping + * @param length length of the mapping + * @param fi file information + * + * Introduced in version 2.9 + */ + void (*munmap) (fuse_req_t req, fuse_ino_t ino, uint64_t map_id, + size_t length, struct fuse_file_info *fi); }; /** @@ -1234,6 +1271,18 @@ int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov, */ int fuse_reply_poll(fuse_req_t req, unsigned revents); +/** + * Reply to an mmap request + * + * Possible requests: + * mmap + * + * @param req request handle + * @param map_id identifies the mapping + * @param length length of the mapping (from zero offset) + */ +int fuse_reply_mmap(fuse_req_t req, uint64_t map_id, size_t length); + /* ----------------------------------------------------------- * * Notification * * ----------------------------------------------------------- */ |