From: Nikolaus Rath Date: Wed, 16 Nov 2016 21:04:47 +0000 (-0800) Subject: Enable more capabilities by default, and document defaults. X-Git-Tag: fuse-3.0.0rc3~17 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=08ce854a739d25a31995886a0f0697c564f28e94;p=qemu-gpiodev%2Flibfuse.git Enable more capabilities by default, and document defaults. Fixes #112. --- diff --git a/ChangeLog.rst b/ChangeLog.rst index 8a22a5e..10879df 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -15,6 +15,14 @@ UNRELEASED CHANGES * The FUSE main loop is now aborted if the file-system requests capabilities that are not supported by the kernel. +* Most file-system capabilities that were opt-in in libfuse2 are now + enabled by default. Filesystem developers are encouraged to review + the documentation of the FUSE_CAP_* features to ensure that their + filesystem is compatible with the new semantics. As before, a + particular capability can still be disabled by unsetting the + corresponding bit of `fuse_conn_info.wants` in the init() handler. + + FUSE 3.0.0-rc2 (2016-11-06) =========================== diff --git a/include/fuse_common.h b/include/fuse_common.h index a906bc5..251ad8b 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -91,45 +91,63 @@ struct fuse_file_info { * ensure that there is at most one pending read request per * file-handle at any time, and will attempt to order read requests by * increasing offset. + * + * This feature is enabled by default when supported by the kernel. */ #define FUSE_CAP_ASYNC_READ (1 << 0) /** * Indicates that the filesystem supports "remote" locking. + * + * This feature is enabled by default when supported by the kernel, + * and if getlk() and setlk() handlers are implemented. */ #define FUSE_CAP_POSIX_LOCKS (1 << 1) /** * Indicates that the filesystem supports the O_TRUNC open flag + * + * This feature is enabled by default when supported by the kernel. */ #define FUSE_CAP_ATOMIC_O_TRUNC (1 << 3) /** * Indicates that the filesystem supports lookups of "." and "..". + * + * This feature is disabled by default. */ #define FUSE_CAP_EXPORT_SUPPORT (1 << 4) /** * Indicates that the kernel should not apply the umask to the * file mode on create operations. + * + * This feature is disabled by default. */ #define FUSE_CAP_DONT_MASK (1 << 6) /** * Indicates that libfuse should try to use splice() when writing to - * the fuse device + * the fuse device. This may improve performance. + * + * This feature is disabled by default. */ #define FUSE_CAP_SPLICE_WRITE (1 << 7) /** - * Indicates that libfuse should try to move pages instead of copying - * when writing to / reading from the fuse device. + * Indicates that libfuse should try to move pages instead of copying when + * writing to / reading from the fuse device. This may improve performance. + * + * This feature is disabled by default. */ #define FUSE_CAP_SPLICE_MOVE (1 << 8) /** * Indicates that libfuse should try to use splice() when reading from - * the fuse device. + * the fuse device. This may improve performance. + * + * This feature is enabled by default when supported by the kernel and + * if the filesystem implements a write_buf() handler. */ #define FUSE_CAP_SPLICE_READ (1 << 9) @@ -140,11 +158,16 @@ struct fuse_file_info { * If not set, flock(2) calls will be handled by the FUSE kernel module * internally (so any access that does not go through the kernel cannot be taken * into account). + * + * This feature is enabled by default when supported by the kernel and + * if the filesystem implements a flock() handler. */ #define FUSE_CAP_FLOCK_LOCKS (1 << 10) /** * Indicates that the filesystem supports ioctl's on directories. + * + * This feature is enabled by default when supported by the kernel. */ #define FUSE_CAP_IOCTL_DIR (1 << 11) @@ -165,25 +188,35 @@ struct fuse_file_info { * This flag should always be set when available. If all file changes * go through the kernel, *attr_timeout* should be set to zero to * avoid unneccessary getattr() calls. + * + * This feature is enabled by default when supported by the kernel. */ #define FUSE_CAP_AUTO_INVAL_DATA (1 << 12) /** * Indicates that the filesystem supports readdirplus + * + * This feature is enabled by default when supported by the kernel and if the + * filesystem implements a readdirplus() handler. */ #define FUSE_CAP_READDIRPLUS (1 << 13) /** * Indicates that the filesystem supports adaptive readdirplus + * + * This feature is enabled by default when supported by the kernel and if the + * filesystem implements a readdirplus() handler. */ #define FUSE_CAP_READDIRPLUS_AUTO (1 << 14) /** * Indicates that the filesystem supports asynchronous direct I/O submission. * - * If this capability is not requested/available, the kernel will - * ensure that there is at most one pending read and one pending write request per - * direct I/O file-handle at any time. + * If this capability is not requested/available, the kernel will ensure that + * there is at most one pending read and one pending write request per direct + * I/O file-handle at any time. + * + * This feature is enabled by default when supported by the kernel. */ #define FUSE_CAP_ASYNC_DIO (1 << 15) @@ -191,6 +224,8 @@ struct fuse_file_info { * Indicates that writeback caching should be enabled. This means that * individual write request may be buffered and merged in the kernel * before they are send to the filesystem. + * + * This feature is disabled by default. */ #define FUSE_CAP_WRITEBACK_CACHE (1 << 16) diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 77fc014..c53c9f7 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -1890,11 +1890,21 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) if (se->conn.proto_minor >= 18) se->conn.capable |= FUSE_CAP_IOCTL_DIR; - /* Default settings (where non-zero) */ + /* Default settings for modern filesystems. + * + * Most of these capabilities were disabled by default in + * libfuse2 for backwards compatibility reasons. In libfuse3, + * we can finally enable them by default (as long as they're + * supported by the kernel). + */ #define LL_SET_DEFAULT(cond, cap) \ if ((cond) && (se->conn.capable & (cap))) \ se->conn.want |= (cap) LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_READ); + LL_SET_DEFAULT(1, FUSE_CAP_AUTO_INVAL_DATA); + LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_DIO); + LL_SET_DEFAULT(1, FUSE_CAP_IOCTL_DIR); + LL_SET_DEFAULT(1, FUSE_CAP_ATOMIC_O_TRUNC); LL_SET_DEFAULT(se->op.write_buf, FUSE_CAP_SPLICE_READ); LL_SET_DEFAULT(se->op.getlk && se->op.setlk, FUSE_CAP_POSIX_LOCKS);