diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2010-11-10 11:41:21 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2010-11-10 11:41:21 +0100 |
commit | 63322038855660cc106c8f87a2ae42bcac37a4af (patch) | |
tree | 36445b71a1cc00b5f30e3f1da4b08d7fea644caa /include | |
parent | df31f2b11efd0d024f12c7035ab0d3646ad9c7c6 (diff) | |
download | android_external_fuse-63322038855660cc106c8f87a2ae42bcac37a4af.tar.gz android_external_fuse-63322038855660cc106c8f87a2ae42bcac37a4af.tar.bz2 android_external_fuse-63322038855660cc106c8f87a2ae42bcac37a4af.zip |
add read_buf method to high level API
Add a new read_buf() method to the highlevel API. This allows
returning a generic buffer from the read method, which in turn allows
zero copy reads.
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/fuse.h b/include/fuse.h index c2708cf..ff8c253 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -524,6 +524,25 @@ struct fuse_operations { */ int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off, struct fuse_file_info *); + + /** Store data from an open file in a buffer + * + * Similar to the read() method, but data is stored and + * returned in a generic buffer. + * + * No actual copying of data has to take place, the source + * file descriptor may simply be stored in the buffer for + * later data transfer. + * + * The buffer must be allocated dynamically and stored at the + * location pointed to by bufp. If the buffer contains memory + * regions, they too must be allocated using malloc(). The + * allocated memory will be freed by the caller. + * + * Introduced in version 2.9 + */ + int (*read_buf) (const char *, struct fuse_bufvec **bufp, + size_t size, off_t off, struct fuse_file_info *); }; /** Extra context that may be needed by some filesystems @@ -735,6 +754,9 @@ int fuse_fs_open(struct fuse_fs *fs, const char *path, struct fuse_file_info *fi); int fuse_fs_read(struct fuse_fs *fs, const char *path, char *buf, size_t size, off_t off, struct fuse_file_info *fi); +int fuse_fs_read_buf(struct fuse_fs *fs, const char *path, + struct fuse_bufvec **bufp, size_t size, off_t off, + struct fuse_file_info *fi); int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *buf, size_t size, off_t off, struct fuse_file_info *fi); int fuse_fs_write_buf(struct fuse_fs *fs, const char *path, |