diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2010-11-08 17:11:46 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2010-11-08 17:11:46 +0100 |
commit | 4e0aea6a96146115e2fb3b8c4a4c75325ad894d7 (patch) | |
tree | ddccccd975def8b0881dbd4b219a931a03ffd227 /include | |
parent | 7d878eb13a9b1e0e1a428c1ead2733b8453a3bb7 (diff) | |
download | android_external_fuse-4e0aea6a96146115e2fb3b8c4a4c75325ad894d7.tar.gz android_external_fuse-4e0aea6a96146115e2fb3b8c4a4c75325ad894d7.tar.bz2 android_external_fuse-4e0aea6a96146115e2fb3b8c4a4c75325ad894d7.zip |
libfuse: support zero copy writes in lowlevel interface
Add new ->write_buf() method to low level interface. This
allows passig a generic buffer, either containing a memory buffer
or a file descriptor. This allows implementing zero copy writes.
Add fuse_session_receive_buf() and fuse_session_process_buf()
which may be used in event loop implementations to replace
fuse_chan_recv() and fuse_session_process() respectively.
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse_common.h | 1 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 53 |
2 files changed, 54 insertions, 0 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h index 7c651ff..625a536 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -101,6 +101,7 @@ struct fuse_file_info { #define FUSE_CAP_DONT_MASK (1 << 6) #define FUSE_CAP_SPLICE_WRITE (1 << 7) #define FUSE_CAP_SPLICE_MOVE (1 << 8) +#define FUSE_CAP_SPLICE_READ (1 << 9) /** * Ioctl flags diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 5592544..9132846 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -877,6 +877,31 @@ struct fuse_lowlevel_ops { */ void (*poll) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct fuse_pollhandle *ph); + + /** + * Write data made available in a buffer + * + * This is a more generic version of the ->write() method. If + * FUSE_CAP_SPLICE_READ is set in fuse_conn_info.want and the + * kernel supports splicing from the fuse device, then the + * data will be made available in pipe for supporting zero + * copy data transfer. + * + * Introduced in version 2.9 + * + * Valid replies: + * fuse_reply_write + * fuse_reply_err + * + * @param req request handle + * @param ino the inode number + * @param bufv buffer containing the data + * @param off offset to write to + * @param fi file information + */ + void (*write_buf) (fuse_req_t req, fuse_ino_t ino, + struct fuse_bufvec *bufv, off_t off, + struct fuse_file_info *fi); }; /** @@ -1395,6 +1420,34 @@ void fuse_session_process(struct fuse_session *se, const char *buf, size_t len, struct fuse_chan *ch); /** + * Process a raw request supplied in a generic buffer + * + * This is a more generic version of fuse_session_process(). The + * fuse_buf may contain a memory buffer or a pipe file descriptor. + * + * @param se the session + * @param buf the fuse_buf containing the request + * @param ch channel on which the request was received + */ +void fuse_session_process_buf(struct fuse_session *se, + const struct fuse_buf *buf, struct fuse_chan *ch); + +/** + * Receive a raw request supplied in a generic buffer + * + * This is a more generic version of fuse_chan_recv(). The fuse_buf + * supplied to this function contains a suitably allocated memory + * buffer. This may be overwritten with a file descriptor buffer. + * + * @param se the session + * @param buf the fuse_buf to store the request in + * @param chp pointer to the channel + * @return the actual size of the raw request, or -errno on error + */ +int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf, + struct fuse_chan **chp); + +/** * Destroy a session * * @param se the session |