aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlessio Balsini <balsini@google.com>2022-01-24 17:56:28 +0000
committerAlessio Balsini <balsini@google.com>2022-01-24 18:21:33 +0000
commitcd66eb8d16e0542241b1b9403e1f9fd563f786dd (patch)
tree2cab7816ace50b5f1a8ada440be0efc0cdc1a7c8 /include
parent819883ecfa11e3caba6121c2f630111a5e2accca (diff)
parentd709c24cbd9e1041264c551c2a4445e654eaf429 (diff)
downloadlibfuse-cd66eb8d16e0542241b1b9403e1f9fd563f786dd.tar.gz
Tagged release. Test: MediaProviderTests Bug: 216129364 Signed-off-by: Alessio Balsini <balsini@google.com> Change-Id: I1fcb0684f88e6160943f0d0d3ab797be13695e61
Diffstat (limited to 'include')
-rw-r--r--include/fuse.h55
-rw-r--r--include/fuse_common.h44
-rw-r--r--include/fuse_kernel.h10
-rw-r--r--include/fuse_lowlevel.h27
4 files changed, 99 insertions, 37 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 883f6e5..9e6c633 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -48,9 +48,12 @@ enum fuse_readdir_flags {
* FUSE_FILL_DIR_FLAGS for the filler function. The filesystem may also
* just ignore this flag completely.
*/
- FUSE_READDIR_PLUS = (1 << 0),
+ FUSE_READDIR_PLUS = (1 << 0)
};
+/**
+ * Readdir flags, passed to fuse_fill_dir_t callback.
+ */
enum fuse_fill_dir_flags {
/**
* "Plus" mode: all file attributes are valid
@@ -61,7 +64,7 @@ enum fuse_fill_dir_flags {
* It is okay to set FUSE_FILL_DIR_PLUS if FUSE_READDIR_PLUS is not set
* and vice versa.
*/
- FUSE_FILL_DIR_PLUS = (1 << 1),
+ FUSE_FILL_DIR_PLUS = (1 << 1)
};
/** Function to add an entry in a readdir() operation
@@ -74,7 +77,7 @@ enum fuse_fill_dir_flags {
*
* @param buf the buffer passed to the readdir() operation
* @param name the file name of the directory entry
- * @param stat file attributes, can be NULL
+ * @param stbuf file attributes, can be NULL
* @param off offset of the next entry or zero
* @param flags fill flags
* @return 1 if buffer is full, zero otherwise
@@ -121,7 +124,7 @@ struct fuse_config {
/**
* The timeout in seconds for which a negative lookup will be
* cached. This means, that if file did not exist (lookup
- * retuned ENOENT), the lookup will only be redone after the
+ * returned ENOENT), the lookup will only be redone after the
* timeout, and the file/directory will be assumed to not
* exist until then. A value of zero means that negative
* lookups are not cached.
@@ -255,8 +258,8 @@ struct fuse_config {
/**
* If this option is given the file-system handlers for the
* following operations will not receive path information:
- * read, write, flush, release, fsync, readdir, releasedir,
- * fsyncdir, lock, ioctl and poll.
+ * read, write, flush, release, fallocate, fsync, readdir,
+ * releasedir, fsyncdir, lock, ioctl and poll.
*
* For the truncate, getattr, chmod, chown and utimens
* operations the path will be provided only if the struct
@@ -361,14 +364,14 @@ struct fuse_operations {
/** Change the permission bits of a file
*
- * `fi` will always be NULL if the file is not currenlty open, but
+ * `fi` will always be NULL if the file is not currently open, but
* may also be NULL if the file is open.
*/
int (*chmod) (const char *, mode_t, struct fuse_file_info *fi);
/** Change the owner and group of a file
*
- * `fi` will always be NULL if the file is not currenlty open, but
+ * `fi` will always be NULL if the file is not currently open, but
* may also be NULL if the file is open.
*
* Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is
@@ -378,7 +381,7 @@ struct fuse_operations {
/** Change the size of a file
*
- * `fi` will always be NULL if the file is not currenlty open, but
+ * `fi` will always be NULL if the file is not currently open, but
* may also be NULL if the file is open.
*
* Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is
@@ -407,8 +410,8 @@ struct fuse_operations {
* - When writeback caching is disabled, the filesystem is
* expected to properly handle the O_APPEND flag and ensure
* that each write is appending to the end of the file.
- *
- * - When writeback caching is enabled, the kernel will
+ *
+ * - When writeback caching is enabled, the kernel will
* handle O_APPEND. However, unless all changes to the file
* come through the kernel this will not work reliably. The
* filesystem should thus either ignore the O_APPEND flag
@@ -648,7 +651,7 @@ struct fuse_operations {
* This supersedes the old utime() interface. New applications
* should use this.
*
- * `fi` will always be NULL if the file is not currenlty open, but
+ * `fi` will always be NULL if the file is not currently open, but
* may also be NULL if the file is open.
*
* See the utimensat(2) man page for details.
@@ -664,6 +667,10 @@ struct fuse_operations {
*/
int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
+#if FUSE_USE_VERSION < 35
+ int (*ioctl) (const char *, int cmd, void *arg,
+ struct fuse_file_info *, unsigned int flags, void *data);
+#else
/**
* Ioctl
*
@@ -682,6 +689,7 @@ struct fuse_operations {
*/
int (*ioctl) (const char *, unsigned int cmd, void *arg,
struct fuse_file_info *, unsigned int flags, void *data);
+#endif
/**
* Poll for IO readiness events
@@ -767,9 +775,10 @@ struct fuse_operations {
* additional cost of transferring data through the FUSE kernel module
* to user space (glibc) and then back into the FUSE filesystem again.
*
- * In case this method is not implemented, glibc falls back to reading
- * data from the source and writing to the destination. Effectively
- * doing an inefficient copy of the data.
+ * In case this method is not implemented, applications are expected to
+ * fall back to a regular file copy. (Some glibc versions did this
+ * emulation automatically, but the emulation has been removed from all
+ * glibc release branches.)
*/
ssize_t (*copy_file_range) (const char *path_in,
struct fuse_file_info *fi_in,
@@ -850,7 +859,7 @@ struct fuse_context {
* 4: Mounting failed
* 5: Failed to daemonize (detach from session)
* 6: Failed to set up signal handlers
- * 7: An error occured during the life of the file system
+ * 7: An error occurred during the life of the file system
*
* @param argc the argument counter passed to the main() function
* @param argv the argument vector passed to the main() function
@@ -978,6 +987,10 @@ int fuse_loop(struct fuse *f);
*/
void fuse_exit(struct fuse *f);
+#if FUSE_USE_VERSION < 32
+int fuse_loop_mt_31(struct fuse *f, int clone_fd);
+#define fuse_loop_mt(f, clone_fd) fuse_loop_mt_31(f, clone_fd)
+#else
/**
* FUSE event loop with multiple threads
*
@@ -1009,10 +1022,6 @@ void fuse_exit(struct fuse *f);
*
* See also: fuse_loop()
*/
-#if FUSE_USE_VERSION < 32
-int fuse_loop_mt_31(struct fuse *f, int clone_fd);
-#define fuse_loop_mt(f, clone_fd) fuse_loop_mt_31(f, clone_fd)
-#else
int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config);
#endif
@@ -1189,9 +1198,15 @@ int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
const char *name);
int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
uint64_t *idx);
+#if FUSE_USE_VERSION < 35
+int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, int cmd,
+ void *arg, struct fuse_file_info *fi, unsigned int flags,
+ void *data);
+#else
int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, unsigned int cmd,
void *arg, struct fuse_file_info *fi, unsigned int flags,
void *data);
+#endif
int fuse_fs_poll(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi, struct fuse_pollhandle *ph,
unsigned *reventsp);
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 7ac28d7..3f836d7 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -23,9 +23,9 @@
#define FUSE_MAJOR_VERSION 3
/** Minor version of FUSE library interface */
-#define FUSE_MINOR_VERSION 2
+#define FUSE_MINOR_VERSION 10
-#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
+#define FUSE_MAKE_VERSION(maj, min) ((maj) * 100 + (min))
#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
#ifdef __cplusplus
@@ -352,6 +352,19 @@ struct fuse_loop_config {
#define FUSE_CAP_HANDLE_KILLPRIV (1 << 20)
/**
+ * Indicates that the kernel supports caching symlinks in its page cache.
+ *
+ * When this feature is enabled, symlink targets are saved in the page cache.
+ * You can invalidate a cached link by calling:
+ * `fuse_lowlevel_notify_inval_inode(se, ino, 0, 0);`
+ *
+ * This feature is disabled by default.
+ * If the kernel supports it (>= 4.20), you can enable this feature by
+ * setting this flag in the `want` field of the `fuse_conn_info` structure.
+ */
+#define FUSE_CAP_CACHE_SYMLINKS (1 << 23)
+
+/**
* Indicates support for zero-message opendirs. If this flag is set in
* the `capable` field of the `fuse_conn_info` structure, then the filesystem
* may return `ENOSYS` from the opendir() handler to indicate success. Further
@@ -364,6 +377,29 @@ struct fuse_loop_config {
#define FUSE_CAP_NO_OPENDIR_SUPPORT (1 << 24)
/**
+ * Indicates support for invalidating cached pages only on explicit request.
+ *
+ * If this flag is set in the `capable` field of the `fuse_conn_info` structure,
+ * then the FUSE kernel module supports invalidating cached pages only on
+ * explicit request by the filesystem through fuse_lowlevel_notify_inval_inode()
+ * or fuse_invalidate_path().
+ *
+ * By setting this flag in the `want` field of the `fuse_conn_info` structure,
+ * the filesystem is responsible for invalidating cached pages through explicit
+ * requests to the kernel.
+ *
+ * Note that setting this flag does not prevent the cached pages from being
+ * flushed by OS itself and/or through user actions.
+ *
+ * Note that if both FUSE_CAP_EXPLICIT_INVAL_DATA and FUSE_CAP_AUTO_INVAL_DATA
+ * are set in the `capable` field of the `fuse_conn_info` structure then
+ * FUSE_CAP_AUTO_INVAL_DATA takes precedence.
+ *
+ * This feature is disabled by default.
+ */
+#define FUSE_CAP_EXPLICIT_INVAL_DATA (1 << 25)
+
+/**
* Indicates support for passthrough mode access for read/write operations.
*
* If this flag is set in the `capable` field of the `fuse_conn_info`
@@ -629,7 +665,7 @@ enum fuse_buf_flags {
* until .size bytes have been copied or an error or EOF is
* detected.
*/
- FUSE_BUF_FD_RETRY = (1 << 3),
+ FUSE_BUF_FD_RETRY = (1 << 3)
};
/**
@@ -671,7 +707,7 @@ enum fuse_buf_copy_flags {
* is full or empty). See SPLICE_F_NONBLOCK in the splice(2)
* man page.
*/
- FUSE_BUF_SPLICE_NONBLOCK= (1 << 4),
+ FUSE_BUF_SPLICE_NONBLOCK= (1 << 4)
};
/**
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index 2c8e141..70278fa 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -424,11 +424,11 @@ enum fuse_opcode {
FUSE_LSEEK = 46,
FUSE_COPY_FILE_RANGE = 47,
- /* CUSE specific operations */
- CUSE_INIT = 4096,
+ /* Android specific operations */
+ FUSE_CANONICAL_PATH = 2016,
- /* Android specific operations */
- FUSE_CANONICAL_PATH = 2016,
+ /* CUSE specific operations */
+ CUSE_INIT = 4096
};
enum fuse_notify_code {
@@ -438,7 +438,7 @@ enum fuse_notify_code {
FUSE_NOTIFY_STORE = 4,
FUSE_NOTIFY_RETRIEVE = 5,
FUSE_NOTIFY_DELETE = 6,
- FUSE_NOTIFY_CODE_MAX,
+ FUSE_NOTIFY_CODE_MAX
};
/* The read buffer is required to be at least 8k, but may be much larger */
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index d203157..c591f71 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -14,7 +14,7 @@
* Low level API
*
* IMPORTANT: you should define FUSE_USE_VERSION before including this
- * header. To use the newest API define it to 31 (recommended for any
+ * header. To use the newest API define it to 35 (recommended for any
* new application).
*/
@@ -713,7 +713,7 @@ struct fuse_lowlevel_ops {
* values that was previously returned by readdir() for the same
* directory handle. In this case, readdir() should skip over entries
* coming before the position defined by the off_t value. If entries
- * are added or removed while the directory handle is open, they filesystem
+ * are added or removed while the directory handle is open, the filesystem
* may still include the entries that have been removed, and may not
* report the entries that have been created. However, addition or
* removal of entries must never cause readdir() to skip over unrelated
@@ -1006,6 +1006,11 @@ struct fuse_lowlevel_ops {
void (*bmap) (fuse_req_t req, fuse_ino_t ino, size_t blocksize,
uint64_t idx);
+#if FUSE_USE_VERSION < 35
+ void (*ioctl) (fuse_req_t req, fuse_ino_t ino, int cmd,
+ void *arg, struct fuse_file_info *fi, unsigned flags,
+ const void *in_buf, size_t in_bufsz, size_t out_bufsz);
+#else
/**
* Ioctl
*
@@ -1037,6 +1042,7 @@ struct fuse_lowlevel_ops {
void (*ioctl) (fuse_req_t req, fuse_ino_t ino, unsigned int cmd,
void *arg, struct fuse_file_info *fi, unsigned flags,
const void *in_buf, size_t in_bufsz, size_t out_bufsz);
+#endif
/**
* Poll for IO readiness
@@ -1261,9 +1267,9 @@ struct fuse_lowlevel_ops {
* Reply with an error code or success.
*
* Possible requests:
- * all except forget
+ * all except forget, forget_multi, retrieve_reply
*
- * Whereever possible, error codes should be chosen from the list of
+ * Wherever possible, error codes should be chosen from the list of
* documented error conditions in the corresponding system calls
* manpage.
*
@@ -1991,6 +1997,11 @@ int fuse_session_mount(struct fuse_session *se, const char *mountpoint);
*/
int fuse_session_loop(struct fuse_session *se);
+#if FUSE_USE_VERSION < 32
+int fuse_session_loop_mt_31(struct fuse_session *se, int clone_fd);
+#define fuse_session_loop_mt(se, clone_fd) fuse_session_loop_mt_31(se, clone_fd)
+#else
+#if (!defined(__UCLIBC__) && !defined(__APPLE__))
/**
* Enter a multi-threaded event loop.
*
@@ -2002,11 +2013,11 @@ int fuse_session_loop(struct fuse_session *se);
* @param config session loop configuration
* @return see fuse_session_loop()
*/
-#if FUSE_USE_VERSION < 32
-int fuse_session_loop_mt_31(struct fuse_session *se, int clone_fd);
-#define fuse_session_loop_mt(se, clone_fd) fuse_session_loop_mt_31(se, clone_fd)
-#else
int fuse_session_loop_mt(struct fuse_session *se, struct fuse_loop_config *config);
+#else
+int fuse_session_loop_mt_32(struct fuse_session *se, struct fuse_loop_config *config);
+#define fuse_session_loop_mt(se, config) fuse_session_loop_mt_32(se, config)
+#endif
#endif
/**