aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fuse.h100
-rw-r--r--include/fuse_common.h55
-rw-r--r--include/fuse_lowlevel.h37
3 files changed, 117 insertions, 75 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 5b9082b..52c915c 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -105,7 +105,13 @@ struct fuse_operations {
* the following operations:
*
* read, write, flush, release, fsync, readdir, releasedir,
- * fsyncdir, ftruncate, fgetattr, lock, ioctl and poll
+ * fsyncdir, lock, ioctl and poll
+ *
+ * For the following operations, the path will not be
+ * calculated only if the file is currently open (i.e., the
+ * struct fuse_file_info argument is non-NULL):
+ *
+ * truncate, getattr, chmod, chown, utimens
*
* 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
@@ -121,10 +127,12 @@ struct fuse_operations {
/** Get file attributes.
*
* Similar to stat(). The 'st_dev' and 'st_blksize' fields are
- * ignored. The 'st_ino' field is ignored except if the 'use_ino'
+ * ignored. The 'st_ino' field is ignored except if the 'use_ino'
* mount option is given.
+ *
+ * *fi* will be NULL if the file is not currenly opened.
*/
- int (*getattr) (const char *, struct stat *);
+ int (*getattr) (const char *, struct stat *, struct fuse_file_info *fi);
/** Read the target of a symbolic link
*
@@ -167,14 +175,23 @@ struct fuse_operations {
/** Create a hard link to a file */
int (*link) (const char *, const char *);
- /** Change the permission bits of a file */
- int (*chmod) (const char *, mode_t);
+ /** Change the permission bits of a file
+ *
+ * *fi* will be NULL if the file is not currenly opened.
+ */
+ int (*chmod) (const char *, mode_t, struct fuse_file_info *fi);
- /** Change the owner and group of a file */
- int (*chown) (const char *, uid_t, gid_t);
+ /** Change the owner and group of a file
+ *
+ * *fi* will be NULL if the file is not currenly opened.
+ */
+ int (*chown) (const char *, uid_t, gid_t, struct fuse_file_info *fi);
- /** Change the size of a file */
- int (*truncate) (const char *, off_t);
+ /** Change the size of a file
+ *
+ * *fi* will be NULL if the file is not currenly opened.
+ */
+ int (*truncate) (const char *, off_t, struct fuse_file_info *fi);
/** File open operation
*
@@ -388,34 +405,6 @@ struct fuse_operations {
int (*create) (const char *, mode_t, struct fuse_file_info *);
/**
- * Change the size of an open file
- *
- * This method is called instead of the truncate() method if the
- * truncation was invoked from an ftruncate() system call.
- *
- * If this method is not implemented or under Linux kernel
- * versions earlier than 2.6.15, the truncate() method will be
- * called instead.
- *
- * Introduced in version 2.5
- */
- int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
-
- /**
- * Get attributes from an open file
- *
- * This method is called instead of the getattr() method if the
- * file information is available.
- *
- * Currently this is only called after the create() method if that
- * is implemented (see above). Later it may be called for
- * invocations of fstat() too.
- *
- * Introduced in version 2.5
- */
- int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
-
- /**
* Perform POSIX file locking operation
*
* The cmd argument will be either F_GETLK, F_SETLK or F_SETLKW.
@@ -457,11 +446,14 @@ struct fuse_operations {
* This supersedes the old utime() interface. New applications
* should use this.
*
+ * *fi* will be NULL if the file is not currenly opened.
+ *
* See the utimensat(2) man page for details.
*
* Introduced in version 2.6
*/
- int (*utimens) (const char *, const struct timespec tv[2]);
+ int (*utimens) (const char *, const struct timespec tv[2],
+ struct fuse_file_info *fi);
/**
* Map block index within file to block index within device
@@ -623,8 +615,8 @@ struct fuse_context {
* passing NULL as the processing function). That way, the remaining
* options can be passed directly to fuse_main().
*
- * To get a list of the options recognized by fuse_main(), look
- * at the output when running with ``--help``.
+ * fuse_main() accepts all options that can be passed to
+ * fuse_parse_cmdline(), fuse_new(), or fuse_session_new().
*
* Normally, fuse_main() includes a basic ``usage: `` message in the
* --help output. However, if argv[0] is an empty string, the usage
@@ -656,14 +648,16 @@ struct fuse_context {
/**
* Create a new FUSE filesystem.
*
- * Known options are defined in `struct fuse_opt fuse_lib_opts[]`,
- * `struct fuse_opt fuse_mount_opts[]`, and `struct fuse_opt
- * fuse_ll_opts[]`. If not all options are known, an error message is
- * written to stderr and the function returns NULL.
+ * This function accepts most file-system independent mount options
+ * (like context, nodev, ro - see mount(8)), as well as the
+ * FUSE-specific mount options from mount.fuse(8).
*
* If the --help option is specified, the function writes a help text
* to stdout and returns NULL.
*
+ * If an unknown option is passed in, an error message is written to
+ * stderr and the function returns NULL.
+ *
* @param args argument vector
* @param op the filesystem operations
* @param op_size the size of the fuse_operations structure
@@ -849,9 +843,8 @@ struct fuse_fs;
* fuse_fs_releasedir and fuse_fs_statfs, which return 0.
*/
-int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf);
-int fuse_fs_fgetattr(struct fuse_fs *fs, const char *path, struct stat *buf,
- struct fuse_file_info *fi);
+int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf,
+ struct fuse_file_info *fi);
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
const char *newpath, unsigned int flags);
int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
@@ -893,13 +886,14 @@ int fuse_fs_lock(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi, int cmd, struct flock *lock);
int fuse_fs_flock(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi, int op);
-int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode);
-int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid);
-int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size);
-int fuse_fs_ftruncate(struct fuse_fs *fs, const char *path, off_t size,
- struct fuse_file_info *fi);
+int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode,
+ struct fuse_file_info *fi);
+int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid,
+ struct fuse_file_info *fi);
+int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size,
+ struct fuse_file_info *fi);
int fuse_fs_utimens(struct fuse_fs *fs, const char *path,
- const struct timespec tv[2]);
+ const struct timespec tv[2], struct fuse_file_info *fi);
int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf,
size_t len);
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 55f0de2..2a0db73 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -205,6 +205,61 @@ struct fuse_conn_info {
struct fuse_session;
struct fuse_pollhandle;
+struct fuse_conn_info_opts;
+
+/**
+ * This function parses several command-line options that can be used
+ * to override elements of struct fuse_conn_info. The pointer returned
+ * by this function should be passed to the
+ * fuse_apply_conn_info_opts() method by the file system's init()
+ * handler.
+ *
+ * Before using this function, think twice if you really want these
+ * parameters to be adjustable from the command line. In most cases,
+ * they should be determined by the file system internally.
+ *
+ * The following options are recognized:
+ *
+ * -o max_write=N sets conn->max_write
+ * -o max_readahead=N sets conn->max_readahead
+ * -o max_background=N sets conn->max_background
+ * -o congestion_threshold=N sets conn->congestion_threshold
+ * -o async_read sets FUSE_CAP_ASYNC_READ in conn->want
+ * -o sync_read unsets FUSE_CAP_ASYNC_READ in conn->want
+ * -o atomic_o_trunc sets FUSE_CAP_ATOMIC_O_TRUNC in conn->want
+ * -o no_remote_lock Equivalent to -o no_remote_flock,no_remote_posix_lock
+ * -o no_remote_flock Unsets FUSE_CAP_FLOCK_LOCKS in conn->want
+ * -o no_remote_posix_lock Unsets FUSE_CAP_POSIX_LOCKS in conn->want
+ * -o [no_]splice_write (un-)sets FUSE_CAP_SPLICE_WRITE in conn->want
+ * -o [no_]splice_move (un-)sets FUSE_CAP_SPLICE_MOVE in conn->want
+ * -o [no_]splice_read (un-)sets FUSE_CAP_SPLICE_READ in conn->want
+ * -o [no_]auto_inval_data (un-)sets FUSE_CAP_AUTO_INVAL_DATA in conn->want
+ * -o readdirplus=no unsets FUSE_CAP_READDIRPLUS in conn->want
+ * -o readdirplus=yes sets FUSE_CAP_READDIRPLUS and unsets
+ * FUSE_CAP_READDIRPLUS_AUTO in conn->want
+ * -o readdirplus=auto sets FUSE_CAP_READDIRPLUS and
+ * FUSE_CAP_READDIRPLUS_AUTO in conn->want
+ * -o [no_]async_dio (un-)sets FUSE_CAP_ASYNC_DIO in conn->want
+ * -o [no_]writeback_cache (un-)sets FUSE_CAP_WRITEBACK_CACHE in conn->want
+ * -o time_gran=N sets conn->time_gran
+ *
+ * Known options will be removed from *args*, unknown options will be
+ * passed through unchanged.
+ *
+ * @param args argument vector (input+output)
+ * @return parsed options
+ **/
+struct fuse_conn_info_opts* fuse_parse_conn_info_opts(struct fuse_args *args);
+
+/**
+ * This function applies the (parsed) parameters in *opts* to the
+ * *conn* pointer. It may modify the following fields: wants,
+ * max_write, max_readahead, congestion_threshold, max_background,
+ * time_gran. A field is only set (or unset) if the corresponding
+ * option has been explicitly set.
+ */
+void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
+ struct fuse_conn_info *conn);
/**
* Go into the background
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 0b7ee2b..db15083 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -14,13 +14,12 @@
* Low level API
*
* 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 24 (default) or
- * 25
+ * header. To use the newest API define it to 30 (recommended for any
+ * new application).
*/
#ifndef FUSE_USE_VERSION
-#define FUSE_USE_VERSION 24
+#define FUSE_USE_VERSION 30
#endif
#include "fuse_common.h"
@@ -1618,29 +1617,18 @@ int fuse_req_interrupted(fuse_req_t req);
* ----------------------------------------------------------- */
/**
- * Print FUSE library version to stdout.
+ * Print low-level version information to stdout.
*/
void fuse_lowlevel_version(void);
/**
- * Print FUSE mount (fusermount) version stdout.
- */
-void fuse_mount_version(void);
-
-/**
- * Print available low-level options to stdout.
- * These options may be passed to `fuse_session_new()`
+ * Print available low-level options to stdout. This is not an
+ * exhaustive list, but includes only those options that may be of
+ * interest to an end-user of a file system.
*/
void fuse_lowlevel_help(void);
/**
- * Print available mount options to stdout.
- * These options may be passed to `fuse_session_new()`
- */
-void fuse_mount_help(void);
-
-
-/**
* Print available options for `fuse_parse_cmdline()`.
*/
void fuse_cmdline_help(void);
@@ -1684,9 +1672,14 @@ int fuse_parse_cmdline(struct fuse_args *args,
* Returns a session structure suitable for passing to
* fuse_session_mount() and fuse_session_loop().
*
- * Known options are defined in `struct fuse_opt fuse_ll_opts[]` and
- * `struct fuse_opt fuse_mount_opts[]`. If not all options are known,
- * an error message is written to stderr and the function returns NULL.
+ * This function accepts most file-system independent mount options
+ * (like context, nodev, ro - see mount(8)), as well as the general
+ * fuse mount options listed in mount.fuse(8) (e.g. -o allow_root and
+ * -o default_permissions, but not ``-o use_ino``). Instead of `-o
+ * debug`, debugging may also enabled with `-d` or `--debug`.
+ *
+ * If not all options are known, an error message is written to stderr
+ * and the function returns NULL.
*
* @param args argument vector
* @param op the (low-level) filesystem operations