diff options
Diffstat (limited to 'include/uapi/linux/fuse.h')
| -rw-r--r-- | include/uapi/linux/fuse.h | 147 |
1 files changed, 112 insertions, 35 deletions
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 7435e09c87fe..616430a2973c 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -248,6 +248,15 @@ * - add bufpool offset field to fuse_uring_ent_in_out struct * - add FUSE_URING_ZERO_COPY, FUSE_URING_ENT_ZERO_COPY, and * FOPEN_IO_URING_ZERO_COPY flag + * + * 7.47 + * - add FUSE_HAS_SYNCFS opt-in flag for privileged userspace servers + * - add FUSE_PASSTHROUGH_V2 + * - add FUSE_DEV_IOC_BACKING_CREATE, struct fuse_backing_create_in + * - add FUSE_NOTIFY_BACKING_REMOVE, struct fuse_notify_backing_remove_out + * - add backing_id_64 to fuse_open_out + * - add FUSE_NOTIFY_BACKING_MAP, fuse_notify_backing_map_out, fuse_extent + * - add FUSE_BACKING_MAP_CREATE, FUSE_BACKING_MAP_CYCLIC */ #ifndef _LINUX_FUSE_H @@ -283,7 +292,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 46 +#define FUSE_KERNEL_MINOR_VERSION 47 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -364,7 +373,7 @@ struct fuse_file_lock { uint32_t pid; /* tgid */ }; -/** +/* * Bitmasks for fuse_setattr_in.valid */ #define FATTR_MODE (1 << 0) @@ -380,7 +389,7 @@ struct fuse_file_lock { #define FATTR_CTIME (1 << 10) #define FATTR_KILL_SUIDGID (1 << 11) -/** +/* * Flags returned by the OPEN request * * FOPEN_DIRECT_IO: bypass page cache for this open file @@ -408,7 +417,7 @@ struct fuse_file_lock { #define FOPEN_PASSTHROUGH (1 << 7) #define FOPEN_IO_URING_ZERO_COPY (1 << 8) -/** +/* * INIT request/reply flags * * FUSE_ASYNC_READ: asynchronous read requests @@ -464,6 +473,13 @@ struct fuse_file_lock { * FUSE_REQUEST_TIMEOUT: kernel supports timing out requests. * init_out.request_timeout contains the timeout (in secs) * FUSE_HAS_IO_URING_BUFPOOL: kernel supports io-uring buffer pools + * FUSE_HAS_SYNCFS: server requests that syncfs()/sync() be propagated as + * FUSE_SYNCFS requests. Since an untrusted server can use this + * to stall sync(), it is only honored when /dev/fuse was opened + * with CAP_SYS_ADMIN in the initial user namespace (the same + * privilege that mounting virtiofs or fuseblk requires). + * Insufficiently privileged servers ignore it. + * FUSE_PASSTHROUGH_V2: use 64 bit server allocated backing ID */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) @@ -512,31 +528,33 @@ struct fuse_file_lock { #define FUSE_OVER_IO_URING (1ULL << 41) #define FUSE_REQUEST_TIMEOUT (1ULL << 42) #define FUSE_HAS_IO_URING_BUFPOOL (1ULL << 43) +#define FUSE_HAS_SYNCFS (1ULL << 44) +#define FUSE_PASSTHROUGH_V2 (1ULL << 45) -/** +/* * CUSE INIT request/reply flags * * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl */ #define CUSE_UNRESTRICTED_IOCTL (1 << 0) -/** +/* * Release flags */ #define FUSE_RELEASE_FLUSH (1 << 0) #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) -/** +/* * Getattr flags */ #define FUSE_GETATTR_FH (1 << 0) -/** +/* * Lock flags */ #define FUSE_LK_FLOCK (1 << 0) -/** +/* * WRITE flags * * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed @@ -550,12 +568,12 @@ struct fuse_file_lock { /* Obsolete alias; this flag implies killing suid/sgid only. */ #define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID -/** +/* * Read flags */ #define FUSE_READ_LOCKOWNER (1 << 1) -/** +/* * Ioctl flags * * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine @@ -576,21 +594,21 @@ struct fuse_file_lock { #define FUSE_IOCTL_MAX_IOV 256 -/** +/* * Poll flags * * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify */ #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) -/** +/* * Fsync flags * * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata */ #define FUSE_FSYNC_FDATASYNC (1 << 0) -/** +/* * fuse_attr flags * * FUSE_ATTR_SUBMOUNT: Object is a submount root @@ -599,28 +617,28 @@ struct fuse_file_lock { #define FUSE_ATTR_SUBMOUNT (1 << 0) #define FUSE_ATTR_DAX (1 << 1) -/** +/* * Open flags * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable */ #define FUSE_OPEN_KILL_SUIDGID (1 << 0) -/** +/* * setxattr flags * FUSE_SETXATTR_ACL_KILL_SGID: Clear SGID when system.posix_acl_access is set */ #define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0) -/** +/* * notify_inval_entry flags * FUSE_EXPIRE_ONLY */ #define FUSE_EXPIRE_ONLY (1 << 0) /** - * extension type - * FUSE_MAX_NR_SECCTX: maximum value of &fuse_secctx_header.nr_secctx - * FUSE_EXT_GROUPS: &fuse_supp_groups extension + * enum fuse_ext_type - extension type + * @FUSE_MAX_NR_SECCTX: maximum value of &fuse_secctx_header.nr_secctx + * @FUSE_EXT_GROUPS: &fuse_supp_groups extension */ enum fuse_ext_type { /* Types 0..31 are reserved for fuse_secctx_header */ @@ -699,6 +717,8 @@ enum fuse_notify_code { FUSE_NOTIFY_RESEND = 7, FUSE_NOTIFY_INC_EPOCH = 8, FUSE_NOTIFY_PRUNE = 9, + FUSE_NOTIFY_BACKING_REMOVE = 10, + FUSE_NOTIFY_BACKING_MAP = 11, }; /* The read buffer is required to be at least 8k, but may be much larger */ @@ -825,6 +845,7 @@ struct fuse_open_out { uint64_t fh; uint32_t open_flags; int32_t backing_id; + uint64_t backing_id_64; }; struct fuse_release_in { @@ -1026,14 +1047,14 @@ struct fuse_fallocate_in { }; /** - * FUSE request unique ID flag + * define FUSE_UNIQUE_RESEND - FUSE request unique ID flag * * Indicates whether this is a resend request. The receiver should handle this * request accordingly. */ #define FUSE_UNIQUE_RESEND (1ULL << 63) -/** +/* * This value will be set by the kernel to * (struct fuse_in_header).{uid,gid} fields in * case when: @@ -1149,13 +1170,20 @@ struct fuse_backing_map { uint64_t padding; }; +struct fuse_backing_create_in { + int32_t fd; + uint32_t padding; + uint64_t backing_id; /* Zero value is reserved */ + uint64_t spare[2]; +}; + /* 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_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) #define FUSE_DEV_IOC_SYNC_INIT _IO(FUSE_DEV_IOC_MAGIC, 3) +#define FUSE_DEV_IOC_BACKING_CREATE _IOW(FUSE_DEV_IOC_MAGIC, 4, struct fuse_backing_create_in) struct fuse_lseek_in { uint64_t fh; @@ -1183,6 +1211,37 @@ struct fuse_copy_file_range_out { uint64_t bytes_copied; }; +struct fuse_notify_backing_remove_out { + uint64_t backing_id; + uint64_t reserved; +}; + +/** + * notify_map flags + * + * FUSE_BACKING_MAP_CREATE: create backing with the supplied ID + * FUSE_BACKING_MAP_CYCLIC: map repeats after last extent + */ +#define FUSE_BACKING_MAP_CREATE (1 << 0) +#define FUSE_BACKING_MAP_CYCLIC (1 << 1) + +struct fuse_notify_backing_map_out { + uint64_t backing_id; + uint32_t num_extents; + uint32_t flags; + uint64_t reserved[2]; +}; + +#define FUSE_MAX_EXTENTS 1365 /* (1 << 16) / sizeof(struct fuse_extent) */ + +struct fuse_extent { + uint64_t offset; /* offset of extent into parent backing */ + uint64_t length; /* extent length */ + uint64_t backing_id; /* target backing */ + uint64_t addr; /* target offset within backing file/device */ + uint64_t reserved[2]; +}; + #define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0) #define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1) struct fuse_setupmapping_in { @@ -1263,12 +1322,12 @@ struct fuse_supp_groups { }; /** - * Size of the ring buffer header + * define FUSE_URING_IN_OUT_HEADER_SZ - Size of the ring buffer header */ #define FUSE_URING_IN_OUT_HEADER_SZ 128 #define FUSE_URING_OP_IN_OUT_SZ 128 -/** +/* * fuse_uring_ent_in_out flags * * FUSE_URING_ENT_ZERO_COPY: Set if the ent's payload is zero-copied @@ -1295,34 +1354,52 @@ struct fuse_uring_ent_in_out { }; /** - * Header for all fuse-io-uring requests + * struct fuse_uring_req_header - Header for all fuse-io-uring requests */ struct fuse_uring_req_header { - /* struct fuse_in_header / struct fuse_out_header */ + /** + * @in_out: struct fuse_in_header / struct fuse_out_header + */ char in_out[FUSE_URING_IN_OUT_HEADER_SZ]; - /* per op code header */ + /** + * @op_in: per op code header + */ char op_in[FUSE_URING_OP_IN_OUT_SZ]; + /** + * @ring_ent_in_out: TBD + */ struct fuse_uring_ent_in_out ring_ent_in_out; }; /** - * sqe commands to the kernel + * enum fuse_uring_cmd - sqe commands to the kernel */ enum fuse_uring_cmd { + /** @FUSE_IO_URING_CMD_INVALID: invalid command value */ FUSE_IO_URING_CMD_INVALID = 0, - /* register the request buffer and fetch a fuse request */ + /** + * @FUSE_IO_URING_CMD_REGISTER: register the request buffer and + * fetch a fuse request + */ FUSE_IO_URING_CMD_REGISTER = 1, - /* commit fuse request result and fetch next request */ + /** + * @FUSE_IO_URING_CMD_COMMIT_AND_FETCH: commit fuse request result + * and fetch next request + */ FUSE_IO_URING_CMD_COMMIT_AND_FETCH = 2, - /* add a queue */ + /** + * @FUSE_IO_URING_CMD_ADD_QUEUE: add a queue + */ FUSE_IO_URING_CMD_ADD_QUEUE = 3, - /* add a bufpool to a queue */ + /** + * @FUSE_IO_URING_CMD_ADD_BUFPOOL: add a bufpool to a queue + */ FUSE_IO_URING_CMD_ADD_BUFPOOL = 4, }; @@ -1334,7 +1411,7 @@ enum fuse_uring_cmd { */ #define FUSE_URING_ZERO_COPY (1 << 0) -/** +/* * In the 80B command area of the SQE. */ struct fuse_uring_cmd_req { |
