aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fuse_common.h39
-rw-r--r--include/fuse_kernel.h23
-rw-r--r--include/fuse_lowlevel.h13
3 files changed, 71 insertions, 4 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h
index a614fb0..ba4b127 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -105,6 +105,11 @@ struct fuse_file_info {
/** Requested poll events. Available in ->poll. Only set on kernels
which support it. If unsupported, this field is set to zero. */
uint32_t poll_events;
+
+ /** Passthrough backing file id. May be filled in by filesystem in
+ * create and open. It is used to create a passthrough connection
+ * between FUSE file and backing file. */
+ int32_t backing_id;
};
@@ -469,6 +474,18 @@ struct fuse_loop_config_v1 {
#define FUSE_CAP_DIRECT_IO_ALLOW_MMAP (1 << 28)
/**
+ * Indicates support for passthrough mode access for read/write operations.
+ *
+ * If this flag is set in the `capable` field of the `fuse_conn_info`
+ * structure, then the FUSE kernel module supports redirecting read/write
+ * operations to the backing file instead of letting them to be handled
+ * by the FUSE daemon.
+ *
+ * This feature is disabled by default.
+ */
+#define FUSE_CAP_PASSTHROUGH (1 << 29)
+
+/**
* Ioctl flags
*
* FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
@@ -598,9 +615,29 @@ struct fuse_conn_info {
unsigned time_gran;
/**
+ * When FUSE_CAP_PASSTHROUGH is enabled, this is the maximum allowed
+ * stacking depth of the backing files. In current kernel, the maximum
+ * allowed stack depth if FILESYSTEM_MAX_STACK_DEPTH (2), which includes
+ * the FUSE passthrough layer, so the maximum stacking depth for backing
+ * files is 1.
+ *
+ * The default is FUSE_BACKING_STACKED_UNDER (0), meaning that the
+ * backing files cannot be on a stacked filesystem, but another stacked
+ * filesystem can be stacked over this FUSE passthrough filesystem.
+ *
+ * Set this to FUSE_BACKING_STACKED_OVER (1) if backing files may be on
+ * a stacked filesystem, such as overlayfs or another FUSE passthrough.
+ * In this configuration, another stacked filesystem cannot be stacked
+ * over this FUSE passthrough filesystem.
+ */
+#define FUSE_BACKING_STACKED_UNDER (0)
+#define FUSE_BACKING_STACKED_OVER (1)
+ unsigned max_backing_stack_depth;
+
+ /**
* For future use.
*/
- unsigned reserved[22];
+ unsigned reserved[21];
};
struct fuse_session;
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index e7418d1..897f654 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -211,6 +211,10 @@
* 7.39
* - add FUSE_DIRECT_IO_ALLOW_MMAP
* - add FUSE_STATX and related structures
+ *
+ * 7.40
+ * - add max_stack_depth to fuse_init_out, add FUSE_PASSTHROUGH init flag
+ * - add backing_id to fuse_open_out, add FOPEN_PASSTHROUGH open flag
*/
#ifndef _LINUX_FUSE_H
@@ -246,7 +250,7 @@
#define FUSE_KERNEL_VERSION 7
/** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 39
+#define FUSE_KERNEL_MINOR_VERSION 40
/** The node ID of the root inode */
#define FUSE_ROOT_ID 1
@@ -353,6 +357,7 @@ struct fuse_file_lock {
* FOPEN_STREAM: the file is stream-like (no file position at all)
* FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE)
* FOPEN_PARALLEL_DIRECT_WRITES: Allow concurrent direct writes on the same inode
+ * FOPEN_PASSTHROUGH: passthrough read/write operations for this open file
*/
#define FOPEN_DIRECT_IO (1 << 0)
#define FOPEN_KEEP_CACHE (1 << 1)
@@ -361,6 +366,7 @@ struct fuse_file_lock {
#define FOPEN_STREAM (1 << 4)
#define FOPEN_NOFLUSH (1 << 5)
#define FOPEN_PARALLEL_DIRECT_WRITES (1 << 6)
+#define FOPEN_PASSTHROUGH (1 << 7)
/**
* INIT request/reply flags
@@ -449,6 +455,7 @@ struct fuse_file_lock {
#define FUSE_CREATE_SUPP_GROUP (1ULL << 34)
#define FUSE_HAS_EXPIRE_ONLY (1ULL << 35)
#define FUSE_DIRECT_IO_ALLOW_MMAP (1ULL << 36)
+#define FUSE_PASSTHROUGH (1ULL << 37)
/* Obsolete alias for FUSE_DIRECT_IO_ALLOW_MMAP */
#define FUSE_DIRECT_IO_RELAX FUSE_DIRECT_IO_ALLOW_MMAP
@@ -761,7 +768,7 @@ struct fuse_create_in {
struct fuse_open_out {
uint64_t fh;
uint32_t open_flags;
- uint32_t padding;
+ int32_t backing_id;
};
struct fuse_release_in {
@@ -877,7 +884,8 @@ struct fuse_init_out {
uint16_t max_pages;
uint16_t map_alignment;
uint32_t flags2;
- uint32_t unused[7];
+ uint32_t max_stack_depth;
+ uint32_t unused[6];
};
#define CUSE_INIT_INFO_MAX 4096
@@ -1049,9 +1057,18 @@ struct fuse_notify_retrieve_in {
uint64_t dummy4;
};
+struct fuse_backing_map {
+ int32_t fd;
+ uint32_t flags;
+ uint64_t padding;
+};
+
/* Device ioctls: */
#define FUSE_DEV_IOC_MAGIC 229
#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
+#define FUSE_DEV_IOC_BACKING_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 1, \
+ struct fuse_backing_map)
+#define FUSE_DEV_IOC_BACKING_CLOSE _IOW(FUSE_DEV_IOC_MAGIC, 2, uint32_t)
struct fuse_lseek_in {
uint64_t fh;
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 2ada62b..cb38115 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -1397,6 +1397,19 @@ int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
int fuse_reply_readlink(fuse_req_t req, const char *link);
/**
+ * Setup passthrough backing file for open reply
+ *
+ * Possible requests:
+ * open, opendir, create
+ *
+ * @param req request handle
+ * @param fd backing file descriptor
+ * @return positive backing id for success, 0 for failure
+ */
+int fuse_passthrough_open(fuse_req_t req, int fd);
+int fuse_passthrough_close(fuse_req_t req, int backing_id);
+
+/**
* Reply with open parameters
*
* currently the following members of 'fi' are used: