aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am7
-rw-r--r--include/fuse.h204
-rw-r--r--include/fuse_common.h103
-rw-r--r--include/fuse_common_compat.h26
-rw-r--r--include/fuse_compat.h201
-rw-r--r--include/fuse_kernel.h478
-rw-r--r--include/fuse_lowlevel.h307
-rw-r--r--include/fuse_lowlevel_compat.h155
-rw-r--r--include/fuse_opt.h5
-rw-r--r--include/old/fuse.h9
-rw-r--r--include/ulockmgr.h24
11 files changed, 441 insertions, 1078 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 663e164..ffbfafa 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,17 +1,12 @@
## Process this file with automake to produce Makefile.in
-fuseincludedir=$(includedir)/fuse
+fuseincludedir=$(includedir)/fuse3
fuseinclude_HEADERS = \
fuse.h \
- fuse_compat.h \
fuse_common.h \
- fuse_common_compat.h \
fuse_lowlevel.h \
- fuse_lowlevel_compat.h \
fuse_opt.h \
cuse_lowlevel.h
-include_HEADERS = old/fuse.h ulockmgr.h
-
noinst_HEADERS = fuse_kernel.h
diff --git a/include/fuse.h b/include/fuse.h
index c657e67..b8a9307 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -13,21 +13,13 @@
*
* This file defines the library interface of FUSE
*
- * IMPORTANT: you should define FUSE_USE_VERSION before including this
- * header. To use the newest API define it to 26 (recommended for any
- * new application), to use the old API define it to 21 (default) 22
- * or 25, to use the even older 1.X API define it to 11.
+ * IMPORTANT: you should define FUSE_USE_VERSION before including this header.
*/
-#ifndef FUSE_USE_VERSION
-#define FUSE_USE_VERSION 21
-#endif
-
#include "fuse_common.h"
#include <fcntl.h>
#include <time.h>
-#include <utime.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
@@ -44,9 +36,6 @@ extern "C" {
/** Handle for a FUSE filesystem */
struct fuse;
-/** Structure containing a raw command */
-struct fuse_cmd;
-
/** Function to add an entry in a readdir() operation
*
* @param buf the buffer passed to the readdir() operation
@@ -58,11 +47,6 @@ struct fuse_cmd;
typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
const struct stat *stbuf, off_t off);
-/* Used by deprecated getdir() method */
-typedef struct fuse_dirhandle *fuse_dirh_t;
-typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
- ino_t ino);
-
/**
* The file system operations:
*
@@ -86,6 +70,24 @@ typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
* is also a snapshot of the relevant wiki pages in the doc/ folder.
*/
struct fuse_operations {
+ /**
+ * Flag indicating that the path need not be calculated for
+ * the following operations:
+ *
+ * read, write, flush, release, fsync, readdir, releasedir,
+ * fsyncdir, ftruncate, fgetattr, lock, ioctl and poll
+ *
+ * If this flag is set then the path will not be calculaged even if the
+ * file wasn't unlinked. However the path can still be non-NULL if it
+ * needs to be calculated for some other reason.
+ */
+ unsigned int flag_nopath:1;
+
+ /**
+ * Reserved flags, don't set
+ */
+ unsigned int flag_reserved:31;
+
/** Get file attributes.
*
* Similar to stat(). The 'st_dev' and 'st_blksize' fields are
@@ -104,9 +106,6 @@ struct fuse_operations {
*/
int (*readlink) (const char *, char *, size_t);
- /* Deprecated, use readdir() instead */
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
-
/** Create a file node
*
* This is called for creation of all non-directory, non-symlink
@@ -115,7 +114,7 @@ struct fuse_operations {
*/
int (*mknod) (const char *, mode_t, dev_t);
- /** Create a directory
+ /** Create a directory
*
* Note that the mode argument may not have the type specification
* bits set, i.e. S_ISDIR(mode) can be false. To obtain the
@@ -147,12 +146,6 @@ struct fuse_operations {
/** Change the size of a file */
int (*truncate) (const char *, off_t);
- /** Change the access and/or modification times of a file
- *
- * Deprecated, use utimens() instead.
- */
- int (*utime) (const char *, struct utimbuf *);
-
/** File open operation
*
* No creation (O_CREAT, O_EXCL) and by default also no
@@ -282,16 +275,12 @@ struct fuse_operations {
/** Read directory
*
- * This supersedes the old getdir() interface. New applications
- * should use this.
- *
* The filesystem may choose between two modes of operation:
*
* 1) The readdir implementation ignores the offset parameter, and
* passes zero to the filler function's offset. The filler
* function will not return '1' (unless an error happens), so the
- * whole directory is read in a single readdir operation. This
- * works just like the old getdir() method.
+ * whole directory is read in a single readdir operation.
*
* 2) The readdir implementation keeps track of the offsets of the
* directory entries. It uses the offset parameter and always
@@ -454,43 +443,6 @@ struct fuse_operations {
int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
/**
- * Flag indicating that the filesystem can accept a NULL path
- * as the first argument for the following operations:
- *
- * read, write, flush, release, fsync, readdir, releasedir,
- * fsyncdir, ftruncate, fgetattr, lock, ioctl and poll
- *
- * If this flag is set these operations continue to work on
- * unlinked files even if "-ohard_remove" option was specified.
- */
- unsigned int flag_nullpath_ok:1;
-
- /**
- * Flag indicating that the path need not be calculated for
- * the following operations:
- *
- * read, write, flush, release, fsync, readdir, releasedir,
- * fsyncdir, ftruncate, fgetattr, lock, ioctl and poll
- *
- * Closely related to flag_nullpath_ok, but if this flag is
- * set then the path will not be calculaged even if the file
- * wasn't unlinked. However the path can still be non-NULL if
- * it needs to be calculated for some other reason.
- */
- unsigned int flag_nopath:1;
-
- /**
- * Flag indicating that the filesystem accepts special
- * UTIME_NOW and UTIME_OMIT values in its utimens operation.
- */
- unsigned int flag_utime_omit_ok:1;
-
- /**
- * Reserved flags, don't set
- */
- unsigned int flag_reserved:29;
-
- /**
* Ioctl
*
* flags will have FUSE_IOCTL_COMPAT set for 32bit ioctls in
@@ -637,6 +589,8 @@ struct fuse_context {
* @param op the file system operation
* @param user_data user data supplied in the context during the init() method
* @return 0 on success, nonzero on failure
+ *
+ * Example usage, see hello.c
*/
/*
int fuse_main(int argc, char *argv[], const struct fuse_operations *op,
@@ -683,6 +637,8 @@ void fuse_destroy(struct fuse *f);
*
* @param f the FUSE handle
* @return 0 if no error occurred, -1 otherwise
+ *
+ * See also: fuse_loop()
*/
int fuse_loop(struct fuse *f);
@@ -703,8 +659,24 @@ void fuse_exit(struct fuse *f);
* Calling this function requires the pthreads library to be linked to
* the application.
*
+ * Note: using fuse_loop() instead of fuse_loop_mt() means you are running in
+ * single-threaded mode, and that you will not have to worry about reentrancy,
+ * though you will have to worry about recursive lookups. In single-threaded
+ * mode, FUSE will wait for one callback to return before calling another.
+ *
+ * Enabling multiple threads, by using fuse_loop_mt(), will cause FUSE to make
+ * multiple simultaneous calls into the various callback functions given by your
+ * fuse_operations record.
+ *
+ * If you are using multiple threads, you can enjoy all the parallel execution
+ * and interactive response benefits of threads, and you get to enjoy all the
+ * benefits of race conditions and locking bugs, too. Ensure that any code used
+ * in the callback funtion of fuse_operations is also thread-safe.
+ *
* @param f the FUSE handle
* @return 0 if no error occurred, -1 otherwise
+ *
+ * See also: fuse_loop()
*/
int fuse_loop_mt(struct fuse *f);
@@ -746,16 +718,6 @@ int fuse_getgroups(int size, gid_t list[]);
int fuse_interrupted(void);
/**
- * Obsolete, doesn't do anything
- *
- * @return -EINVAL
- */
-int fuse_invalidate(struct fuse *f, const char *path);
-
-/* Deprecated, don't use */
-int fuse_is_lib_option(const char *opt);
-
-/**
* The real main function
*
* Do not call this directly, use fuse_main()
@@ -964,93 +926,9 @@ void fuse_register_module(struct fuse_module *mod);
fuse_register_module(&mod); \
}
-
-/* ----------------------------------------------------------- *
- * Advanced API for event handling, don't worry about this... *
- * ----------------------------------------------------------- */
-
-/* NOTE: the following functions are deprecated, and will be removed
- from the 3.0 API. Use the lowlevel session functions instead */
-
-/** Function type used to process commands */
-typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);
-
-/** This is the part of fuse_main() before the event loop */
-struct fuse *fuse_setup(int argc, char *argv[],
- const struct fuse_operations *op, size_t op_size,
- char **mountpoint, int *multithreaded,
- void *user_data);
-
-/** This is the part of fuse_main() after the event loop */
-void fuse_teardown(struct fuse *fuse, char *mountpoint);
-
-/** Read a single command. If none are read, return NULL */
-struct fuse_cmd *fuse_read_cmd(struct fuse *f);
-
-/** Process a single command */
-void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd);
-
-/** Multi threaded event loop, which calls the custom command
- processor function */
-int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data);
-
-/** Return the exited flag, which indicates if fuse_exit() has been
- called */
-int fuse_exited(struct fuse *f);
-
-/** This function is obsolete and implemented as a no-op */
-void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
-
/** Get session from fuse object */
struct fuse_session *fuse_get_session(struct fuse *f);
-/* ----------------------------------------------------------- *
- * Compatibility stuff *
- * ----------------------------------------------------------- */
-
-#if FUSE_USE_VERSION < 26
-# include "fuse_compat.h"
-# undef fuse_main
-# if FUSE_USE_VERSION == 25
-# define fuse_main(argc, argv, op) \
- fuse_main_real_compat25(argc, argv, op, sizeof(*(op)))
-# define fuse_new fuse_new_compat25
-# define fuse_setup fuse_setup_compat25
-# define fuse_teardown fuse_teardown_compat22
-# define fuse_operations fuse_operations_compat25
-# elif FUSE_USE_VERSION == 22
-# define fuse_main(argc, argv, op) \
- fuse_main_real_compat22(argc, argv, op, sizeof(*(op)))
-# define fuse_new fuse_new_compat22
-# define fuse_setup fuse_setup_compat22
-# define fuse_teardown fuse_teardown_compat22
-# define fuse_operations fuse_operations_compat22
-# define fuse_file_info fuse_file_info_compat
-# elif FUSE_USE_VERSION == 24
-# error Compatibility with high-level API version 24 not supported
-# else
-# define fuse_dirfil_t fuse_dirfil_t_compat
-# define __fuse_read_cmd fuse_read_cmd
-# define __fuse_process_cmd fuse_process_cmd
-# define __fuse_loop_mt fuse_loop_mt_proc
-# if FUSE_USE_VERSION == 21
-# define fuse_operations fuse_operations_compat2
-# define fuse_main fuse_main_compat2
-# define fuse_new fuse_new_compat2
-# define __fuse_setup fuse_setup_compat2
-# define __fuse_teardown fuse_teardown_compat22
-# define __fuse_exited fuse_exited
-# define __fuse_set_getcontext_func fuse_set_getcontext_func
-# else
-# define fuse_statfs fuse_statfs_compat1
-# define fuse_operations fuse_operations_compat1
-# define fuse_main fuse_main_compat1
-# define fuse_new fuse_new_compat1
-# define FUSE_DEBUG FUSE_DEBUG_COMPAT1
-# endif
-# endif
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/include/fuse_common.h b/include/fuse_common.h
index a4d980d..765e0a3 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -1,5 +1,4 @@
-/*
- FUSE: Filesystem in Userspace
+/* FUSE: Filesystem in Userspace
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU LGPLv2.
@@ -20,19 +19,14 @@
#include <sys/types.h>
/** Major version of FUSE library interface */
-#define FUSE_MAJOR_VERSION 2
+#define FUSE_MAJOR_VERSION 3
/** Minor version of FUSE library interface */
-#define FUSE_MINOR_VERSION 9
+#define FUSE_MINOR_VERSION 0
#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
-/* This interface uses 64 bit off_t */
-#if _FILE_OFFSET_BITS != 64
-#error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -40,18 +34,15 @@ extern "C" {
/**
* Information about open files
*
- * Changed in version 2.5
+ * Changed in version 3.0
*/
struct fuse_file_info {
/** Open flags. Available in open() and release() */
int flags;
- /** Old file handle, don't use */
- unsigned long fh_old;
-
/** In case of a write operation indicates if this was caused by a
writepage */
- int writepage;
+ unsigned int writepage : 1;
/** Can be filled in by open, to use direct I/O on this file.
Introduced in version 2.4 */
@@ -85,6 +76,11 @@ struct fuse_file_info {
/** Lock owner id. Available in locking operations and flush */
uint64_t lock_owner;
+
+ /** Requested poll events. Available in ->poll. Only set on kernels
+ which support it. If unsupported, this field is set to zero.
+ Introduced in version 3.0 */
+ uint32_t poll_events;
};
/**
@@ -101,17 +97,20 @@ struct fuse_file_info {
* FUSE_CAP_SPLICE_READ: ability to use splice() to read from the fuse device
* FUSE_CAP_IOCTL_DIR: ioctl support on directories
*/
-#define FUSE_CAP_ASYNC_READ (1 << 0)
-#define FUSE_CAP_POSIX_LOCKS (1 << 1)
-#define FUSE_CAP_ATOMIC_O_TRUNC (1 << 3)
-#define FUSE_CAP_EXPORT_SUPPORT (1 << 4)
-#define FUSE_CAP_BIG_WRITES (1 << 5)
-#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)
-#define FUSE_CAP_FLOCK_LOCKS (1 << 10)
-#define FUSE_CAP_IOCTL_DIR (1 << 11)
+#define FUSE_CAP_ASYNC_READ (1 << 0)
+#define FUSE_CAP_POSIX_LOCKS (1 << 1)
+#define FUSE_CAP_ATOMIC_O_TRUNC (1 << 3)
+#define FUSE_CAP_EXPORT_SUPPORT (1 << 4)
+#define FUSE_CAP_BIG_WRITES (1 << 5)
+#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)
+#define FUSE_CAP_FLOCK_LOCKS (1 << 10)
+#define FUSE_CAP_IOCTL_DIR (1 << 11)
+#define FUSE_CAP_AUTO_INVAL_DATA (1 << 12)
+#define FUSE_CAP_READDIRPLUS (1 << 13)
+#define FUSE_CAP_READDIRPLUS_AUTO (1 << 14)
/**
* Ioctl flags
@@ -449,8 +448,15 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
* Stores session in a global variable. May only be called once per
* process until fuse_remove_signal_handlers() is called.
*
+ * Once either of the POSIX signals arrives, the exit_handler() in
+ * fuse_signals.c is called:
+ * \snippet fuse_signals.c doxygen_exit_handler
+ *
* @param se the session to exit
* @return 0 on success, -1 on failure
+ *
+ * See also:
+ * fuse_remove_signal_handlers()
*/
int fuse_set_signal_handlers(struct fuse_session *se);
@@ -461,6 +467,9 @@ int fuse_set_signal_handlers(struct fuse_session *se);
* be called again.
*
* @param se the same session as given in fuse_set_signal_handlers()
+ *
+ * See also:
+ * fuse_set_signal_handlers()
*/
void fuse_remove_signal_handlers(struct fuse_session *se);
@@ -468,38 +477,26 @@ void fuse_remove_signal_handlers(struct fuse_session *se);
* Compatibility stuff *
* ----------------------------------------------------------- */
-#if FUSE_USE_VERSION < 26
-# ifdef __FreeBSD__
-# if FUSE_USE_VERSION < 25
-# error On FreeBSD API version 25 or greater must be used
-# endif
-# endif
-# include "fuse_common_compat.h"
-# undef FUSE_MINOR_VERSION
-# undef fuse_main
-# define fuse_unmount fuse_unmount_compat22
-# if FUSE_USE_VERSION == 25
-# define FUSE_MINOR_VERSION 5
-# define fuse_mount fuse_mount_compat25
-# elif FUSE_USE_VERSION == 24 || FUSE_USE_VERSION == 22
-# define FUSE_MINOR_VERSION 4
-# define fuse_mount fuse_mount_compat22
-# elif FUSE_USE_VERSION == 21
-# define FUSE_MINOR_VERSION 1
-# define fuse_mount fuse_mount_compat22
-# elif FUSE_USE_VERSION == 11
-# warning Compatibility with API version 11 is deprecated
-# undef FUSE_MAJOR_VERSION
-# define FUSE_MAJOR_VERSION 1
-# define FUSE_MINOR_VERSION 1
-# define fuse_mount fuse_mount_compat1
-# else
-# error Compatibility with API version other than 21, 22, 24, 25 and 11 not supported
-# endif
+#if !defined(FUSE_USE_VERSION) || FUSE_USE_VERSION < 30
+# error only API version 30 or greater is supported
#endif
#ifdef __cplusplus
}
#endif
+
+/*
+ * This interface uses 64 bit off_t.
+ *
+ * On 32bit systems please add -D_FILE_OFFSET_BITS=64 to your compile flags!
+ */
+
+#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus
+_Static_assert(sizeof(off_t) == 8, "fuse: off_t must be 64bit");
+#else
+struct _fuse_off_t_must_be_64bit_dummy_struct \
+ { unsigned _fuse_off_t_must_be_64bit:((sizeof(off_t) == 8) ? 1 : -1); };
+#endif
+
#endif /* _FUSE_COMMON_H_ */
diff --git a/include/fuse_common_compat.h b/include/fuse_common_compat.h
deleted file mode 100644
index 34440ff..0000000
--- a/include/fuse_common_compat.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU LGPLv2.
- See the file COPYING.LIB.
-*/
-
-/* these definitions provide source compatibility to prior versions.
- Do not include this file directly! */
-
-struct fuse_file_info_compat {
- int flags;
- unsigned long fh;
- int writepage;
- unsigned int direct_io : 1;
- unsigned int keep_cache : 1;
-};
-
-int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args);
-
-int fuse_mount_compat22(const char *mountpoint, const char *opts);
-
-int fuse_mount_compat1(const char *mountpoint, const char *args[]);
-
-void fuse_unmount_compat22(const char *mountpoint);
diff --git a/include/fuse_compat.h b/include/fuse_compat.h
deleted file mode 100644
index e7497a9..0000000
--- a/include/fuse_compat.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU LGPLv2.
- See the file COPYING.LIB.
-*/
-
-/* these definitions provide source compatibility to prior versions.
- Do not include this file directly! */
-
-struct fuse_operations_compat25 {
- int (*getattr) (const char *, struct stat *);
- int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
- int (*mknod) (const char *, mode_t, dev_t);
- int (*mkdir) (const char *, mode_t);
- int (*unlink) (const char *);
- int (*rmdir) (const char *);
- int (*symlink) (const char *, const char *);
- int (*rename) (const char *, const char *);
- int (*link) (const char *, const char *);
- int (*chmod) (const char *, mode_t);
- int (*chown) (const char *, uid_t, gid_t);
- int (*truncate) (const char *, off_t);
- int (*utime) (const char *, struct utimbuf *);
- int (*open) (const char *, struct fuse_file_info *);
- int (*read) (const char *, char *, size_t, off_t,
- struct fuse_file_info *);
- int (*write) (const char *, const char *, size_t, off_t,
- struct fuse_file_info *);
- int (*statfs) (const char *, struct statvfs *);
- int (*flush) (const char *, struct fuse_file_info *);
- int (*release) (const char *, struct fuse_file_info *);
- int (*fsync) (const char *, int, struct fuse_file_info *);
- int (*setxattr) (const char *, const char *, const char *, size_t, int);
- int (*getxattr) (const char *, const char *, char *, size_t);
- int (*listxattr) (const char *, char *, size_t);
- int (*removexattr) (const char *, const char *);
- int (*opendir) (const char *, struct fuse_file_info *);
- int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
- struct fuse_file_info *);
- int (*releasedir) (const char *, struct fuse_file_info *);
- int (*fsyncdir) (const char *, int, struct fuse_file_info *);
- void *(*init) (void);
- void (*destroy) (void *);
- int (*access) (const char *, int);
- int (*create) (const char *, mode_t, struct fuse_file_info *);
- int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
- int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
-};
-
-struct fuse *fuse_new_compat25(int fd, struct fuse_args *args,
- const struct fuse_operations_compat25 *op,
- size_t op_size);
-
-int fuse_main_real_compat25(int argc, char *argv[],
- const struct fuse_operations_compat25 *op,
- size_t op_size);
-
-struct fuse *fuse_setup_compat25(int argc, char *argv[],
- const struct fuse_operations_compat25 *op,
- size_t op_size, char **mountpoint,
- int *multithreaded, int *fd);
-
-void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint);
-
-#if !defined(__FreeBSD__) && !defined(__NetBSD__)
-#include <sys/statfs.h>
-
-struct fuse_operations_compat22 {
- int (*getattr) (const char *, struct stat *);
- int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
- int (*mknod) (const char *, mode_t, dev_t);
- int (*mkdir) (const char *, mode_t);
- int (*unlink) (const char *);
- int (*rmdir) (const char *);
- int (*symlink) (const char *, const char *);
- int (*rename) (const char *, const char *);
- int (*link) (const char *, const char *);
- int (*chmod) (const char *, mode_t);
- int (*chown) (const char *, uid_t, gid_t);
- int (*truncate) (const char *, off_t);
- int (*utime) (const char *, struct utimbuf *);
- int (*open) (const char *, struct fuse_file_info_compat *);
- int (*read) (const char *, char *, size_t, off_t,
- struct fuse_file_info_compat *);
- int (*write) (const char *, const char *, size_t, off_t,
- struct fuse_file_info_compat *);
- int (*statfs) (const char *, struct statfs *);
- int (*flush) (const char *, struct fuse_file_info_compat *);
- int (*release) (const char *, struct fuse_file_info_compat *);
- int (*fsync) (const char *, int, struct fuse_file_info_compat *);
- int (*setxattr) (const char *, const char *, const char *, size_t, int);
- int (*getxattr) (const char *, const char *, char *, size_t);
- int (*listxattr) (const char *, char *, size_t);
- int (*removexattr) (const char *, const char *);
- int (*opendir) (const char *, struct fuse_file_info_compat *);
- int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
- struct fuse_file_info_compat *);
- int (*releasedir) (const char *, struct fuse_file_info_compat *);
- int (*fsyncdir) (const char *, int, struct fuse_file_info_compat *);
- void *(*init) (void);
- void (*destroy) (void *);
-};
-
-struct fuse *fuse_new_compat22(int fd, const char *opts,
- const struct fuse_operations_compat22 *op,
- size_t op_size);
-
-struct fuse *fuse_setup_compat22(int argc, char *argv[],
- const struct fuse_operations_compat22 *op,
- size_t op_size, char **mountpoint,
- int *multithreaded, int *fd);
-
-int fuse_main_real_compat22(int argc, char *argv[],
- const struct fuse_operations_compat22 *op,
- size_t op_size);
-
-typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int type);
-struct fuse_operations_compat2 {
- int (*getattr) (const char *, struct stat *);
- int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t_compat);
- int (*mknod) (const char *, mode_t, dev_t);
- int (*mkdir) (const char *, mode_t);
- int (*unlink) (const char *);
- int (*rmdir) (const char *);
- int (*symlink) (const char *, const char *);
- int (*rename) (const char *, const char *);
- int (*link) (const char *, const char *);
- int (*chmod) (const char *, mode_t);
- int (*chown) (const char *, uid_t, gid_t);
- int (*truncate) (const char *, off_t);
- int (*utime) (const char *, struct utimbuf *);
- int (*open) (const char *, int);
- int (*read) (const char *, char *, size_t, off_t);
- int (*write) (const char *, const char *, size_t, off_t);
- int (*statfs) (const char *, struct statfs *);
- int (*flush) (const char *);
- int (*release) (const char *, int);
- int (*fsync) (const char *, int);
- int (*setxattr) (const char *, const char *, const char *,
- size_t, int);
- int (*getxattr) (const char *, const char *, char *, size_t);
- int (*listxattr) (const char *, char *, size_t);
- int (*removexattr) (const char *, const char *);
-};
-
-int fuse_main_compat2(int argc, char *argv[],
- const struct fuse_operations_compat2 *op);
-
-struct fuse *fuse_new_compat2(int fd, const char *opts,
- const struct fuse_operations_compat2 *op);
-
-struct fuse *fuse_setup_compat2(int argc, char *argv[],
- const struct fuse_operations_compat2 *op,
- char **mountpoint, int *multithreaded, int *fd);
-
-struct fuse_statfs_compat1 {
- long block_size;
- long blocks;
- long blocks_free;
- long files;
- long files_free;
- long namelen;
-};
-
-struct fuse_operations_compat1 {
- int (*getattr) (const char *, struct stat *);
- int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t_compat);
- int (*mknod) (const char *, mode_t, dev_t);
- int (*mkdir) (const char *, mode_t);
- int (*unlink) (const char *);
- int (*rmdir) (const char *);
- int (*symlink) (const char *, const char *);
- int (*rename) (const char *, const char *);
- int (*link) (const char *, const char *);
- int (*chmod) (const char *, mode_t);
- int (*chown) (const char *, uid_t, gid_t);
- int (*truncate) (const char *, off_t);
- int (*utime) (const char *, struct utimbuf *);
- int (*open) (const char *, int);
- int (*read) (const char *, char *, size_t, off_t);
- int (*write) (const char *, const char *, size_t, off_t);
- int (*statfs) (struct fuse_statfs_compat1 *);
- int (*release) (const char *, int);
- int (*fsync) (const char *, int);
-};
-
-#define FUSE_DEBUG_COMPAT1 (1 << 1)
-
-struct fuse *fuse_new_compat1(int fd, int flags,
- const struct fuse_operations_compat1 *op);
-
-void fuse_main_compat1(int argc, char *argv[],
- const struct fuse_operations_compat1 *op);
-
-#endif /* __FreeBSD__ || __NetBSD__ */
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index c632b58..706d035 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -83,17 +83,23 @@
*
* 7.19
* - add FUSE_FALLOCATE
+ *
+ * 7.20
+ * - add FUSE_AUTO_INVAL_DATA
+ *
+ * 7.21
+ * - add FUSE_READDIRPLUS
+ * - send the requested events in POLL request
*/
#ifndef _LINUX_FUSE_H
#define _LINUX_FUSE_H
-#include <sys/types.h>
-#define __u64 uint64_t
-#define __s64 int64_t
-#define __u32 uint32_t
-#define __s32 int32_t
-#define __u16 uint16_t
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <stdint.h>
+#endif
/*
* Version negotiation:
@@ -119,7 +125,7 @@
#define FUSE_KERNEL_VERSION 7
/** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 19
+#define FUSE_KERNEL_MINOR_VERSION 21
/** The node ID of the root inode */
#define FUSE_ROOT_ID 1
@@ -128,42 +134,42 @@
userspace works under 64bit kernels */
struct fuse_attr {
- __u64 ino;
- __u64 size;
- __u64 blocks;
- __u64 atime;
- __u64 mtime;
- __u64 ctime;
- __u32 atimensec;
- __u32 mtimensec;
- __u32 ctimensec;
- __u32 mode;
- __u32 nlink;
- __u32 uid;
- __u32 gid;
- __u32 rdev;
- __u32 blksize;
- __u32 padding;
+ uint64_t ino;
+ uint64_t size;
+ uint64_t blocks;
+ uint64_t atime;
+ uint64_t mtime;
+ uint64_t ctime;
+ uint32_t atimensec;
+ uint32_t mtimensec;
+ uint32_t ctimensec;
+ uint32_t mode;
+ uint32_t nlink;
+ uint32_t uid;
+ uint32_t gid;
+ uint32_t rdev;
+ uint32_t blksize;
+ uint32_t padding;
};
struct fuse_kstatfs {
- __u64 blocks;
- __u64 bfree;
- __u64 bavail;
- __u64 files;
- __u64 ffree;
- __u32 bsize;
- __u32 namelen;
- __u32 frsize;
- __u32 padding;
- __u32 spare[6];
+ uint64_t blocks;
+ uint64_t bfree;
+ uint64_t bavail;
+ uint64_t files;
+ uint64_t ffree;
+ uint32_t bsize;
+ uint32_t namelen;
+ uint32_t frsize;
+ uint32_t padding;
+ uint32_t spare[6];
};
struct fuse_file_lock {
- __u64 start;
- __u64 end;
- __u32 type;
- __u32 pid; /* tgid */
+ uint64_t start;
+ uint64_t end;
+ uint32_t type;
+ uint32_t pid; /* tgid */
};
/**
@@ -194,10 +200,21 @@ struct fuse_file_lock {
/**
* INIT request/reply flags
*
+ * FUSE_ASYNC_READ: asynchronous read requests
* FUSE_POSIX_LOCKS: remote locking for POSIX file locks
+ * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
+ * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
* FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
+ * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
* FUSE_DONT_MASK: don't apply umask to file mode on create operations
+ * FUSE_SPLICE_WRITE: kernel supports splice write on the device
+ * FUSE_SPLICE_MOVE: kernel supports splice move on the device
+ * FUSE_SPLICE_READ: kernel supports splice read on the device
* FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
+ * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
+ * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
+ * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
+ * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
*/
#define FUSE_ASYNC_READ (1 << 0)
#define FUSE_POSIX_LOCKS (1 << 1)
@@ -206,7 +223,14 @@ struct fuse_file_lock {
#define FUSE_EXPORT_SUPPORT (1 << 4)
#define FUSE_BIG_WRITES (1 << 5)
#define FUSE_DONT_MASK (1 << 6)
+#define FUSE_SPLICE_WRITE (1 << 7)
+#define FUSE_SPLICE_MOVE (1 << 8)
+#define FUSE_SPLICE_READ (1 << 9)
#define FUSE_FLOCK_LOCKS (1 << 10)
+#define FUSE_HAS_IOCTL_DIR (1 << 11)
+#define FUSE_AUTO_INVAL_DATA (1 << 12)
+#define FUSE_DO_READDIRPLUS (1 << 13)
+#define FUSE_READDIRPLUS_AUTO (1 << 14)
/**
* CUSE INIT request/reply flags
@@ -313,6 +337,7 @@ enum fuse_opcode {
FUSE_NOTIFY_REPLY = 41,
FUSE_BATCH_FORGET = 42,
FUSE_FALLOCATE = 43,
+ FUSE_READDIRPLUS = 44,
/* CUSE specific operations */
CUSE_INIT = 4096,
@@ -334,143 +359,143 @@ enum fuse_notify_code {
#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
struct fuse_entry_out {
- __u64 nodeid; /* Inode ID */
- __u64 generation; /* Inode generation: nodeid:gen must
- be unique for the fs's lifetime */
- __u64 entry_valid; /* Cache timeout for the name */
- __u64 attr_valid; /* Cache timeout for the attributes */
- __u32 entry_valid_nsec;
- __u32 attr_valid_nsec;
+ uint64_t nodeid; /* Inode ID */
+ uint64_t generation; /* Inode generation: nodeid:gen must
+ be unique for the fs's lifetime */
+ uint64_t entry_valid; /* Cache timeout for the name */
+ uint64_t attr_valid; /* Cache timeout for the attributes */
+ uint32_t entry_valid_nsec;
+ uint32_t attr_valid_nsec;
struct fuse_attr attr;
};
struct fuse_forget_in {
- __u64 nlookup;
+ uint64_t nlookup;
};
struct fuse_forget_one {
- __u64 nodeid;
- __u64 nlookup;
+ uint64_t nodeid;
+ uint64_t nlookup;
};
struct fuse_batch_forget_in {
- __u32 count;
- __u32 dummy;
+ uint32_t count;
+ uint32_t dummy;
};
struct fuse_getattr_in {
- __u32 getattr_flags;
- __u32 dummy;
- __u64 fh;
+ uint32_t getattr_flags;
+ uint32_t dummy;
+ uint64_t fh;
};
#define FUSE_COMPAT_ATTR_OUT_SIZE 96
struct fuse_attr_out {
- __u64 attr_valid; /* Cache timeout for the attributes */
- __u32 attr_valid_nsec;
- __u32 dummy;
+ uint64_t attr_valid; /* Cache timeout for the attributes */
+ uint32_t attr_valid_nsec;
+ uint32_t dummy;
struct fuse_attr attr;
};
#define FUSE_COMPAT_MKNOD_IN_SIZE 8
struct fuse_mknod_in {
- __u32 mode;
- __u32 rdev;
- __u32 umask;
- __u32 padding;
+ uint32_t mode;
+ uint32_t rdev;
+ uint32_t umask;
+ uint32_t padding;
};
struct fuse_mkdir_in {
- __u32 mode;
- __u32 umask;
+ uint32_t mode;
+ uint32_t umask;
};
struct fuse_rename_in {
- __u64 newdir;
+ uint64_t newdir;
};
struct fuse_link_in {
- __u64 oldnodeid;
+ uint64_t oldnodeid;
};
struct fuse_setattr_in {
- __u32 valid;
- __u32 padding;
- __u64 fh;
- __u64 size;
- __u64 lock_owner;
- __u64 atime;
- __u64 mtime;
- __u64 unused2;
- __u32 atimensec;
- __u32 mtimensec;
- __u32 unused3;
- __u32 mode;
- __u32 unused4;
- __u32 uid;
- __u32 gid;
- __u32 unused5;
+ uint32_t valid;
+ uint32_t padding;
+ uint64_t fh;
+ uint64_t size;
+ uint64_t lock_owner;
+ uint64_t atime;
+ uint64_t mtime;
+ uint64_t unused2;
+ uint32_t atimensec;
+ uint32_t mtimensec;
+ uint32_t unused3;
+ uint32_t mode;
+ uint32_t unused4;
+ uint32_t uid;
+ uint32_t gid;
+ uint32_t unused5;
};
struct fuse_open_in {
- __u32 flags;
- __u32 unused;
+ uint32_t flags;
+ uint32_t unused;
};
struct fuse_create_in {
- __u32 flags;
- __u32 mode;
- __u32 umask;
- __u32 padding;
+ uint32_t flags;
+ uint32_t mode;
+ uint32_t umask;
+ uint32_t padding;
};
struct fuse_open_out {
- __u64 fh;
- __u32 open_flags;
- __u32 padding;
+ uint64_t fh;
+ uint32_t open_flags;
+ uint32_t padding;
};
struct fuse_release_in {
- __u64 fh;
- __u32 flags;
- __u32 release_flags;
- __u64 lock_owner;
+ uint64_t fh;
+ uint32_t flags;
+ uint32_t release_flags;
+ uint64_t lock_owner;
};
struct fuse_flush_in {
- __u64 fh;
- __u32 unused;
- __u32 padding;
- __u64 lock_owner;
+ uint64_t fh;
+ uint32_t unused;
+ uint32_t padding;
+ uint64_t lock_owner;
};
struct fuse_read_in {
- __u64 fh;
- __u64 offset;
- __u32 size;
- __u32 read_flags;
- __u64 lock_owner;
- __u32 flags;
- __u32 padding;
+ uint64_t fh;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t read_flags;
+ uint64_t lock_owner;
+ uint32_t flags;
+ uint32_t padding;
};
#define FUSE_COMPAT_WRITE_IN_SIZE 24
struct fuse_write_in {
- __u64 fh;
- __u64 offset;
- __u32 size;
- __u32 write_flags;
- __u64 lock_owner;
- __u32 flags;
- __u32 padding;
+ uint64_t fh;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t write_flags;
+ uint64_t lock_owner;
+ uint32_t flags;
+ uint32_t padding;
};
struct fuse_write_out {
- __u32 size;
- __u32 padding;
+ uint32_t size;
+ uint32_t padding;
};
#define FUSE_COMPAT_STATFS_SIZE 48
@@ -480,32 +505,32 @@ struct fuse_statfs_out {
};
struct fuse_fsync_in {
- __u64 fh;
- __u32 fsync_flags;
- __u32 padding;
+ uint64_t fh;
+ uint32_t fsync_flags;
+ uint32_t padding;
};
struct fuse_setxattr_in {
- __u32 size;
- __u32 flags;
+ uint32_t size;
+ uint32_t flags;
};
struct fuse_getxattr_in {
- __u32 size;
- __u32 padding;
+ uint32_t size;
+ uint32_t padding;
};
struct fuse_getxattr_out {
- __u32 size;
- __u32 padding;
+ uint32_t size;
+ uint32_t padding;
};
struct fuse_lk_in {
- __u64 fh;
- __u64 owner;
+ uint64_t fh;
+ uint64_t owner;
struct fuse_file_lock lk;
- __u32 lk_flags;
- __u32 padding;
+ uint32_t lk_flags;
+ uint32_t padding;
};
struct fuse_lk_out {
@@ -513,179 +538,190 @@ struct fuse_lk_out {
};
struct fuse_access_in {
- __u32 mask;
- __u32 padding;
+ uint32_t mask;
+ uint32_t padding;
};
struct fuse_init_in {
- __u32 major;
- __u32 minor;
- __u32 max_readahead;
- __u32 flags;
+ uint32_t major;
+ uint32_t minor;
+ uint32_t max_readahead;
+ uint32_t flags;
};
struct fuse_init_out {
- __u32 major;
- __u32 minor;
- __u32 max_readahead;
- __u32 flags;
- __u16 max_background;
- __u16 congestion_threshold;
- __u32 max_write;
+ uint32_t major;
+ uint32_t minor;
+ uint32_t max_readahead;
+ uint32_t flags;
+ uint16_t max_background;
+ uint16_t congestion_threshold;
+ uint32_t max_write;
};
#define CUSE_INIT_INFO_MAX 4096
struct cuse_init_in {
- __u32 major;
- __u32 minor;
- __u32 unused;
- __u32 flags;
+ uint32_t major;
+ uint32_t minor;
+ uint32_t unused;
+ uint32_t flags;
};
struct cuse_init_out {
- __u32 major;
- __u32 minor;
- __u32 unused;
- __u32 flags;
- __u32 max_read;
- __u32 max_write;
- __u32 dev_major; /* chardev major */
- __u32 dev_minor; /* chardev minor */
- __u32 spare[10];
+ uint32_t major;
+ uint32_t minor;
+ uint32_t unused;
+ uint32_t flags;
+ uint32_t max_read;
+ uint32_t max_write;
+ uint32_t dev_major; /* chardev major */
+ uint32_t dev_minor; /* chardev minor */
+ uint32_t spare[10];
};
struct fuse_interrupt_in {
- __u64 unique;
+ uint64_t unique;
};
struct fuse_bmap_in {
- __u64 block;
- __u32 blocksize;
- __u32 padding;
+ uint64_t block;
+ uint32_t blocksize;
+ uint32_t padding;
};
struct fuse_bmap_out {
- __u64 block;
+ uint64_t block;
};
struct fuse_ioctl_in {
- __u64 fh;
- __u32 flags;
- __u32 cmd;
- __u64 arg;
- __u32 in_size;
- __u32 out_size;
+ uint64_t fh;
+ uint32_t flags;
+ uint32_t cmd;
+ uint64_t arg;
+ uint32_t in_size;
+ uint32_t out_size;
};
struct fuse_ioctl_iovec {
- __u64 base;
- __u64 len;
+ uint64_t base;
+ uint64_t len;
};
struct fuse_ioctl_out {
- __s32 result;
- __u32 flags;
- __u32 in_iovs;
- __u32 out_iovs;
+ int32_t result;
+ uint32_t flags;
+ uint32_t in_iovs;
+ uint32_t out_iovs;
};
struct fuse_poll_in {
- __u64 fh;
- __u64 kh;
- __u32 flags;
- __u32 padding;
+ uint64_t fh;
+ uint64_t kh;
+ uint32_t flags;
+ uint32_t events;
};
struct fuse_poll_out {
- __u32 revents;
- __u32 padding;
+ uint32_t revents;
+ uint32_t padding;
};
struct fuse_notify_poll_wakeup_out {
- __u64 kh;
+ uint64_t kh;
};
struct fuse_fallocate_in {
- __u64 fh;
- __u64 offset;
- __u64 length;
- __u32 mode;
- __u32 padding;
+ uint64_t fh;
+ uint64_t offset;
+ uint64_t length;
+ uint32_t mode;
+ uint32_t padding;
};
struct fuse_in_header {
- __u32 len;
- __u32 opcode;
- __u64 unique;
- __u64 nodeid;
- __u32 uid;
- __u32 gid;
- __u32 pid;
- __u32 padding;
+ uint32_t len;
+ uint32_t opcode;
+ uint64_t unique;
+ uint64_t nodeid;
+ uint32_t uid;
+ uint32_t gid;
+ uint32_t pid;
+ uint32_t padding;
};
struct fuse_out_header {
- __u32 len;
- __s32 error;
- __u64 unique;
+ uint32_t len;
+ int32_t error;
+ uint64_t unique;
};
struct fuse_dirent {
- __u64 ino;
- __u64 off;
- __u32 namelen;
- __u32 type;
+ uint64_t ino;
+ uint64_t off;
+ uint32_t namelen;
+ uint32_t type;
char name[];
};
#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
-#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
+#define FUSE_DIRENT_ALIGN(x) \
+ (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
#define FUSE_DIRENT_SIZE(d) \
FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
+struct fuse_direntplus {
+ struct fuse_entry_out entry_out;
+ struct fuse_dirent dirent;
+};
+
+#define FUSE_NAME_OFFSET_DIRENTPLUS \
+ offsetof(struct fuse_direntplus, dirent.name)
+#define FUSE_DIRENTPLUS_SIZE(d) \
+ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
+
struct fuse_notify_inval_inode_out {
- __u64 ino;
- __s64 off;
- __s64 len;
+ uint64_t ino;
+ int64_t off;
+ int64_t len;
};
struct fuse_notify_inval_entry_out {
- __u64 parent;
- __u32 namelen;
- __u32 padding;
+ uint64_t parent;
+ uint32_t namelen;
+ uint32_t padding;
};
struct fuse_notify_delete_out {
- __u64 parent;
- __u64 child;
- __u32 namelen;
- __u32 padding;
+ uint64_t parent;
+ uint64_t child;
+ uint32_t namelen;
+ uint32_t padding;
};
struct fuse_notify_store_out {
- __u64 nodeid;
- __u64 offset;
- __u32 size;
- __u32 padding;
+ uint64_t nodeid;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t padding;
};
struct fuse_notify_retrieve_out {
- __u64 notify_unique;
- __u64 nodeid;
- __u64 offset;
- __u32 size;
- __u32 padding;
+ uint64_t notify_unique;
+ uint64_t nodeid;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t padding;
};
/* Matches the size of fuse_write_in */
struct fuse_notify_retrieve_in {
- __u64 dummy1;
- __u64 offset;
- __u32 size;
- __u32 dummy2;
- __u64 dummy3;
- __u64 dummy4;
+ uint64_t dummy1;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t dummy2;
+ uint64_t dummy3;
+ uint64_t dummy4;
};
#endif /* _LINUX_FUSE_H */
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 2036717..595f061 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -44,7 +44,7 @@ extern "C" {
#define FUSE_ROOT_ID 1
/** Inode number type */
-typedef unsigned long fuse_ino_t;
+typedef uint64_t fuse_ino_t;
/** Request pointer type */
typedef struct fuse_req *fuse_req_t;
@@ -88,7 +88,7 @@ struct fuse_entry_param {
* it as an error.
*
*/
- unsigned long generation;
+ uint64_t generation;
/** Inode attributes.
*
@@ -122,7 +122,7 @@ struct fuse_ctx {
};
struct fuse_forget_data {
- uint64_t ino;
+ fuse_ino_t ino;
uint64_t nlookup;
};
@@ -233,7 +233,7 @@ struct fuse_lowlevel_ops {
* @param ino the inode number
* @param nlookup the number of lookups to forget
*/
- void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
+ void (*forget) (fuse_req_t req, fuse_ino_t ino, uint64_t nlookup);
/**
* Get file attributes
@@ -600,6 +600,9 @@ struct fuse_lowlevel_ops {
*
* fi->fh will contain the value set by the opendir method, or
* will be undefined if the opendir method didn't set any value.
+ *
+ * Returning a directory entry from readdir() does not affect
+ * its lookup count.
*
* Valid replies:
* fuse_reply_buf
@@ -1016,6 +1019,36 @@ struct fuse_lowlevel_ops {
*/
void (*fallocate) (fuse_req_t req, fuse_ino_t ino, int mode,
off_t offset, off_t length, struct fuse_file_info *fi);
+
+ /**
+ * Read directory with attributes
+ *
+ * Send a buffer filled using fuse_add_direntry_plus(), with size not
+ * exceeding the requested size. Send an empty buffer on end of
+ * stream.
+ *
+ * fi->fh will contain the value set by the opendir method, or
+ * will be undefined if the opendir method didn't set any value.
+ *
+ * In contrast to readdir() (which does not affect the lookup
+ * counts), the lookup count of every entry returned by
+ * readdirplus() is increased by one.
+ *
+ * Introduced in version 3.0
+ *
+ * Valid replies:
+ * fuse_reply_buf
+ * fuse_reply_data
+ * fuse_reply_err
+ *
+ * @param req request handle
+ * @param ino the inode number
+ * @param size maximum number of bytes to send
+ * @param off offset to continue reading the directory stream
+ * @param fi file information
+ */
+ void (*readdirplus) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
+ struct fuse_file_info *fi);
};
/**
@@ -1150,6 +1183,11 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
* Possible requests:
* read, readdir, getxattr, listxattr
*
+ * Side effects:
+ * when used to return data from a readdirplus() (but not readdir())
+ * call, increments the lookup count of each returned entry by one
+ * on success.
+ *
* @param req request handle
* @param bufv buffer vector
* @param flags flags controlling the copy
@@ -1252,6 +1290,34 @@ size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,
off_t off);
/**
+ * Add a directory entry to the buffer with the attributes
+ *
+ * Buffer needs to be large enough to hold the entry. If it's not,
+ * then the entry is not filled in but the size of the entry is still
+ * returned. The caller can check this by comparing the bufsize
+ * parameter with the returned entry size. If the entry size is
+ * larger than the buffer size, the operation failed.
+ *
+ * From the 'stbuf' argument the st_ino field and bits 12-15 of the
+ * st_mode field are used. The other fields are ignored.
+ *
+ * Note: offsets do not necessarily represent physical offsets, and
+ * could be any marker, that enables the implementation to find a
+ * specific point in the directory stream.
+ *
+ * @param req request handle
+ * @param buf the point where the new entry will be added to the buffer
+ * @param bufsize remaining size of the buffer
+ * @param name the name of the entry
+ * @param e the directory entry
+ * @param off the offset of the next entry
+ * @return the space needed for the entry
+ */
+size_t fuse_add_direntry_plus(fuse_req_t req, char *buf, size_t bufsize,
+ const char *name,
+ const struct fuse_entry_param *e, off_t off);
+
+/**
* Reply to ask for data fetch and output buffer preparation. ioctl
* will be retried with the specified input data fetched and output
* buffer prepared.
@@ -1491,9 +1557,6 @@ int fuse_req_interrupted(fuse_req_t req);
* Filesystem setup *
* ----------------------------------------------------------- */
-/* Deprecated, don't use */
-int fuse_lowlevel_is_lib_option(const char *opt);
-
/**
* Create a low level session
*
@@ -1502,6 +1565,9 @@ int fuse_lowlevel_is_lib_option(const char *opt);
* @param op_size sizeof(struct fuse_lowlevel_ops)
* @param userdata user data
* @return the created session object, or NULL on failure
+ *
+ * Example: See hello_ll.c:
+ * \snippet hello_ll.c doxygen_fuse_lowlevel_usage
*/
struct fuse_session *fuse_lowlevel_new(struct fuse_args *args,
const struct fuse_lowlevel_ops *op,
@@ -1512,61 +1578,8 @@ struct fuse_session *fuse_lowlevel_new(struct fuse_args *args,
* ----------------------------------------------------------- */
/**
- * Session operations
- *
- * This is used in session creation
- */
-struct fuse_session_ops {
- /**
- * Hook to process a request (mandatory)
- *
- * @param data user data passed to fuse_session_new()
- * @param buf buffer containing the raw request
- * @param len request length
- * @param ch channel on which the request was received
- */
- void (*process) (void *data, const char *buf, size_t len,
- struct fuse_chan *ch);
-
- /**
- * Hook for session exit and reset (optional)
- *
- * @param data user data passed to fuse_session_new()
- * @param val exited status (1 - exited, 0 - not exited)
- */
- void (*exit) (void *data, int val);
-
- /**
- * Hook for querying the current exited status (optional)
- *
- * @param data user data passed to fuse_session_new()
- * @return 1 if exited, 0 if not exited
- */
- int (*exited) (void *data);
-
- /**
- * Hook for cleaning up the channel on destroy (optional)
- *
- * @param data user data passed to fuse_session_new()
- */
- void (*destroy) (void *data);
-};
-
-/**
- * Create a new session
- *
- * @param op session operations
- * @param data user data
- * @return new session object, or NULL on failure
- */
-struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data);
-
-/**
* Assign a channel to a session
*
- * Note: currently only a single channel may be assigned. This may
- * change in the future
- *
* If a session is destroyed, the assigned channel is also destroyed
*
* @param se the session
@@ -1575,7 +1588,7 @@ struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data);
void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch);
/**
- * Remove a channel from a session
+ * Remove the channel from a session
*
* If the channel is not assigned to a session, then this is a no-op
*
@@ -1584,35 +1597,17 @@ void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch);
void fuse_session_remove_chan(struct fuse_chan *ch);
/**
- * Iterate over the channels assigned to a session
- *
- * The iterating function needs to start with a NULL channel, and
- * after that needs to pass the previously returned channel to the
- * function.
- *
- * @param se the session
- * @param ch the previous channel, or NULL
- * @return the next channel, or NULL if no more channels exist
- */
-struct fuse_chan *fuse_session_next_chan(struct fuse_session *se,
- struct fuse_chan *ch);
-
-/**
- * Process a raw request
+ * Return channel assigned to the session
*
* @param se the session
- * @param buf buffer containing the raw request
- * @param len request length
- * @param ch channel on which the request was received
+ * @return the channel
*/
-void fuse_session_process(struct fuse_session *se, const char *buf, size_t len,
- struct fuse_chan *ch);
+struct fuse_chan *fuse_session_chan(struct fuse_session *se);
/**
* 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.
+ * 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
@@ -1624,17 +1619,16 @@ void fuse_session_process_buf(struct fuse_session *se,
/**
* 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
+ * 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
+ * @param ch 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);
+ struct fuse_chan *ch);
/**
* Destroy a session
@@ -1644,7 +1638,10 @@ int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf,
void fuse_session_destroy(struct fuse_session *se);
/**
- * Exit a session
+ * Exit a session.
+ *
+ * This function is invoked by the POSIX signal handlers, when registered using:
+ * * fuse_set_signal_handlers()
*
* @param se the session
*/
@@ -1666,15 +1663,11 @@ void fuse_session_reset(struct fuse_session *se);
int fuse_session_exited(struct fuse_session *se);
/**
- * Get the user data provided to the session
+ * Enter a single threaded, blocking event loop.
*
- * @param se the session
- * @return the user data
- */
-void *fuse_session_data(struct fuse_session *se);
-
-/**
- * Enter a single threaded event loop
+ * Using POSIX signals this event loop can be exited but the session
+ * needs to be configued by issuing:
+ * fuse_set_signal_handlers() first.
*
* @param se the session
* @return 0 on success, -1 on error
@@ -1694,56 +1687,6 @@ int fuse_session_loop_mt(struct fuse_session *se);
* ----------------------------------------------------------- */
/**
- * Channel operations
- *
- * This is used in channel creation
- */
-struct fuse_chan_ops {
- /**
- * Hook for receiving a raw request
- *
- * @param ch pointer to the channel
- * @param buf the buffer to store the request in
- * @param size the size of the buffer
- * @return the actual size of the raw request, or -1 on error
- */
- int (*receive)(struct fuse_chan **chp, char *buf, size_t size);
-
- /**
- * Hook for sending a raw reply
- *
- * A return value of -ENOENT means, that the request was
- * interrupted, and the reply was discarded
- *
- * @param ch the channel
- * @param iov vector of blocks
- * @param count the number of blocks in vector
- * @return zero on success, -errno on failure
- */
- int (*send)(struct fuse_chan *ch, const struct iovec iov[],
- size_t count);
-
- /**
- * Destroy the channel
- *
- * @param ch the channel
- */
- void (*destroy)(struct fuse_chan *ch);
-};
-
-/**
- * Create a new channel
- *
- * @param op channel operations
- * @param fd file descriptor of the channel
- * @param bufsize the minimal receive buffer size
- * @param data user data
- * @return the new channel object, or NULL on failure
- */
-struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd,
- size_t bufsize, void *data);
-
-/**
* Query the file descriptor of the channel
*
* @param ch the channel
@@ -1752,84 +1695,12 @@ struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd,
int fuse_chan_fd(struct fuse_chan *ch);
/**
- * Query the minimal receive buffer size
- *
- * @param ch the channel
- * @return the buffer size passed to fuse_chan_new()
- */
-size_t fuse_chan_bufsize(struct fuse_chan *ch);
-
-/**
- * Query the user data
- *
- * @param ch the channel
- * @return the user data passed to fuse_chan_new()
- */
-void *fuse_chan_data(struct fuse_chan *ch);
-
-/**
- * Query the session to which this channel is assigned
- *
- * @param ch the channel
- * @return the session, or NULL if the channel is not assigned
- */
-struct fuse_session *fuse_chan_session(struct fuse_chan *ch);
-
-/**
- * Receive a raw request
- *
- * A return value of -ENODEV means, that the filesystem was unmounted
- *
- * @param ch pointer to the channel
- * @param buf the buffer to store the request in
- * @param size the size of the buffer
- * @return the actual size of the raw request, or -errno on error
- */
-int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size);
-
-/**
- * Send a raw reply
- *
- * A return value of -ENOENT means, that the request was
- * interrupted, and the reply was discarded
- *
- * @param ch the channel
- * @param iov vector of blocks
- * @param count the number of blocks in vector
- * @return zero on success, -errno on failure
- */
-int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[],
- size_t count);
-
-/**
* Destroy a channel
*
* @param ch the channel
*/
void fuse_chan_destroy(struct fuse_chan *ch);
-/* ----------------------------------------------------------- *
- * Compatibility stuff *
- * ----------------------------------------------------------- */
-
-#if FUSE_USE_VERSION < 26
-# include "fuse_lowlevel_compat.h"
-# define fuse_chan_ops fuse_chan_ops_compat24
-# define fuse_chan_new fuse_chan_new_compat24
-# if FUSE_USE_VERSION == 25
-# define fuse_lowlevel_ops fuse_lowlevel_ops_compat25
-# define fuse_lowlevel_new fuse_lowlevel_new_compat25
-# elif FUSE_USE_VERSION == 24
-# define fuse_lowlevel_ops fuse_lowlevel_ops_compat
-# define fuse_lowlevel_new fuse_lowlevel_new_compat
-# define fuse_file_info fuse_file_info_compat
-# define fuse_reply_statfs fuse_reply_statfs_compat
-# define fuse_reply_open fuse_reply_open_compat
-# else
-# error Compatibility with low-level API version < 24 not supported
-# endif
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/include/fuse_lowlevel_compat.h b/include/fuse_lowlevel_compat.h
deleted file mode 100644
index 8de220b..0000000
--- a/include/fuse_lowlevel_compat.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU LGPLv2.
- See the file COPYING.LIB.
-*/
-
-/* these definitions provide source compatibility to prior versions.
- Do not include this file directly! */
-
-struct fuse_lowlevel_ops_compat25 {
- void (*init) (void *userdata);
- void (*destroy) (void *userdata);
- void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
- void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
- void (*getattr) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi);
- void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
- int to_set, struct fuse_file_info *fi);
- void (*readlink) (fuse_req_t req, fuse_ino_t ino);
- void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode, dev_t rdev);
- void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode);
- void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
- void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
- void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
- const char *name);
- void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
- fuse_ino_t newparent, const char *newname);
- void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
- const char *newname);
- void (*open) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi);
- void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
- struct fuse_file_info *fi);
- void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
- size_t size, off_t off, struct fuse_file_info *fi);
- void (*flush) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi);
- void (*release) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi);
- void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
- struct fuse_file_info *fi);
- void (*opendir) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi);
- void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
- struct fuse_file_info *fi);
- void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi);
- void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
- struct fuse_file_info *fi);
- void (*statfs) (fuse_req_t req);
- void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
- const char *value, size_t size, int flags);
- void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
- size_t size);
- void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size);
- void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name);
- void (*access) (fuse_req_t req, fuse_ino_t ino, int mask);
- void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode, struct fuse_file_info *fi);
-};
-
-struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args,
- const struct fuse_lowlevel_ops_compat25 *op,
- size_t op_size, void *userdata);
-
-size_t fuse_dirent_size(size_t namelen);
-
-char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf,
- off_t off);
-
-#if !defined(__FreeBSD__) && !defined(__NetBSD__)
-
-#include <sys/statfs.h>
-
-struct fuse_lowlevel_ops_compat {
- void (*init) (void *userdata);
- void (*destroy) (void *userdata);
- void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
- void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
- void (*getattr) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info_compat *fi);
- void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
- int to_set, struct fuse_file_info_compat *fi);
- void (*readlink) (fuse_req_t req, fuse_ino_t ino);
- void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode, dev_t rdev);
- void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode);
- void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
- void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
- void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
- const char *name);
- void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
- fuse_ino_t newparent, const char *newname);
- void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
- const char *newname);
- void (*open) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info_compat *fi);
- void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
- struct fuse_file_info_compat *fi);
- void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
- size_t size, off_t off, struct fuse_file_info_compat *fi);
- void (*flush) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info_compat *fi);
- void (*release) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info_compat *fi);
- void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
- struct fuse_file_info_compat *fi);
- void (*opendir) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info_compat *fi);
- void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
- struct fuse_file_info_compat *fi);
- void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info_compat *fi);
- void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
- struct fuse_file_info_compat *fi);
- void (*statfs) (fuse_req_t req);
- void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
- const char *value, size_t size, int flags);
- void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
- size_t size);
- void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size);
- void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name);
- void (*access) (fuse_req_t req, fuse_ino_t ino, int mask);
- void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode, struct fuse_file_info_compat *fi);
-};
-
-int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf);
-
-int fuse_reply_open_compat(fuse_req_t req,
- const struct fuse_file_info_compat *fi);
-
-struct fuse_session *fuse_lowlevel_new_compat(const char *opts,
- const struct fuse_lowlevel_ops_compat *op,
- size_t op_size, void *userdata);
-
-#endif /* __FreeBSD__ || __NetBSD__ */
-
-struct fuse_chan_ops_compat24 {
- int (*receive)(struct fuse_chan *ch, char *buf, size_t size);
- int (*send)(struct fuse_chan *ch, const struct iovec iov[],
- size_t count);
- void (*destroy)(struct fuse_chan *ch);
-};
-
-struct fuse_chan *fuse_chan_new_compat24(struct fuse_chan_ops_compat24 *op,
- int fd, size_t bufsize, void *data);
-
-int fuse_chan_receive(struct fuse_chan *ch, char *buf, size_t size);
-struct fuse_chan *fuse_kern_chan_new(int fd);
diff --git a/include/fuse_opt.h b/include/fuse_opt.h
index add0a30..20653b1 100644
--- a/include/fuse_opt.h
+++ b/include/fuse_opt.h
@@ -70,8 +70,9 @@ extern "C" {
*
* 6) "-x %s", etc. Combination of 4) and 5)
*
- * If the format is "%s", memory is allocated for the string unlike
- * with scanf().
+ * If the format is "%s", memory is allocated for the string unlike with
+ * scanf(). The previous value (if non-NULL) stored at the this location is
+ * freed.
*/
struct fuse_opt {
/** Matching template and optional parameter formatting */
diff --git a/include/old/fuse.h b/include/old/fuse.h
deleted file mode 100644
index 3db0945..0000000
--- a/include/old/fuse.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- This header is for compatibility with older software using FUSE.
-
- Please use 'pkg-config --cflags fuse' to set include path. The
- correct usage is still '#include <fuse.h>', not '#include
- <fuse/fuse.h>'.
-*/
-
-#include "fuse/fuse.h"
diff --git a/include/ulockmgr.h b/include/ulockmgr.h
deleted file mode 100644
index ad55579..0000000
--- a/include/ulockmgr.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- libulockmgr: Userspace Lock Manager Library
- Copyright (C) 2006 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU LGPLv2.
- See the file COPYING.LIB.
-*/
-
-#include <stdint.h>
-#include <fcntl.h>
-#include <sys/types.h>
-
-/**
- * Perform POSIX locking operation
- *
- * @param fd the file descriptor
- * @param cmd the locking command (F_GETFL, F_SETLK or F_SETLKW)
- * @param lock the lock parameters
- * @param owner the lock owner ID cookie
- * @param owner_len length of the lock owner ID cookie
- * @return 0 on success -errno on error
- */
-int ulockmgr_op(int fd, int cmd, struct flock *lock, const void *owner,
- size_t owner_len);