diff options
author | Yuri Per <yuri@acronis.com> | 2019-11-03 11:44:31 +0200 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2019-11-03 09:44:31 +0000 |
commit | d735af94fa54a5555ce725f1d4e6b97b812b6603 (patch) | |
tree | cb21ee1eceb66e1c85a5c78ae7aa4a5f9438274a /include | |
parent | b9c584370aa489ac00b1e8a0454c61f30c0531af (diff) | |
download | libfuse-d735af94fa54a5555ce725f1d4e6b97b812b6603.tar.gz |
Implement lseek operation (#457)
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse.h | 7 | ||||
-rw-r--r-- | include/fuse_lowlevel.h | 33 |
2 files changed, 40 insertions, 0 deletions
diff --git a/include/fuse.h b/include/fuse.h index 2d2291c..883f6e5 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -776,6 +776,11 @@ struct fuse_operations { off_t offset_in, const char *path_out, struct fuse_file_info *fi_out, off_t offset_out, size_t size, int flags); + + /** + * Find next data or hole after the specified offset + */ + off_t (*lseek) (const char *, off_t off, int whence, struct fuse_file_info *); }; /** Extra context that may be needed by some filesystems @@ -1197,6 +1202,8 @@ ssize_t fuse_fs_copy_file_range(struct fuse_fs *fs, const char *path_in, const char *path_out, struct fuse_file_info *fi_out, off_t off_out, size_t len, int flags); +off_t fuse_fs_lseek(struct fuse_fs *fs, const char *path, off_t off, int whence, + struct fuse_file_info *fi); void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn, struct fuse_config *cfg); void fuse_fs_destroy(struct fuse_fs *fs); diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 2073460..18c6363 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -1218,6 +1218,27 @@ struct fuse_lowlevel_ops { fuse_ino_t ino_out, off_t off_out, struct fuse_file_info *fi_out, size_t len, int flags); + + /** + * Find next data or hole after the specified offset + * + * If this request is answered with an error code of ENOSYS, this is + * treated as a permanent failure, i.e. all future lseek() requests will + * fail with the same error code without being send to the filesystem + * process. + * + * Valid replies: + * fuse_reply_lseek + * fuse_reply_err + * + * @param req request handle + * @param ino the inode number + * @param off offset to start search from + * @param whence either SEEK_DATA or SEEK_HOLE + * @param fi file information + */ + void (*lseek) (fuse_req_t req, fuse_ino_t ino, off_t off, int whence, + struct fuse_file_info *fi); }; /** @@ -1569,6 +1590,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 with offset + * + * Possible requests: + * lseek + * + * @param req request handle + * @param off offset of next data or hole + * @return zero for success, -errno for failure to send reply + */ +int fuse_reply_lseek(fuse_req_t req, off_t off); + /* ----------------------------------------------------------- * * Notification * * ----------------------------------------------------------- */ |