libfuse: fuse-3.18.1/include/fuse_kernel.h Source File

libfuse

fuse_kernel.h
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2/*
3 This file defines the kernel interface of FUSE
4 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
5
6 This program can be distributed under the terms of the GNU GPL.
7 See the file COPYING.
8
9 This -- and only this -- header file may also be distributed under
10 the terms of the BSD Licence as follows:
11
12 Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions
16 are met:
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
27 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 SUCH DAMAGE.
34*/
35
36/*
37 * This file defines the kernel interface of FUSE
38 *
39 * Protocol changelog:
40 *
41 * 7.1:
42 * - add the following messages:
43 * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,
44 * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,
45 * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,
46 * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,
47 * FUSE_RELEASEDIR
48 * - add padding to messages to accommodate 32-bit servers on 64-bit kernels
49 *
50 * 7.2:
51 * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags
52 * - add FUSE_FSYNCDIR message
53 *
54 * 7.3:
55 * - add FUSE_ACCESS message
56 * - add FUSE_CREATE message
57 * - add filehandle to fuse_setattr_in
58 *
59 * 7.4:
60 * - add frsize to fuse_kstatfs
61 * - clean up request size limit checking
62 *
63 * 7.5:
64 * - add flags and max_write to fuse_init_out
65 *
66 * 7.6:
67 * - add max_readahead to fuse_init_in and fuse_init_out
68 *
69 * 7.7:
70 * - add FUSE_INTERRUPT message
71 * - add POSIX file lock support
72 *
73 * 7.8:
74 * - add lock_owner and flags fields to fuse_release_in
75 * - add FUSE_BMAP message
76 * - add FUSE_DESTROY message
77 *
78 * 7.9:
79 * - new fuse_getattr_in input argument of GETATTR
80 * - add lk_flags in fuse_lk_in
81 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
82 * - add blksize field to fuse_attr
83 * - add file flags field to fuse_read_in and fuse_write_in
84 * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
85 *
86 * 7.10
87 * - add nonseekable open flag
88 *
89 * 7.11
90 * - add IOCTL message
91 * - add unsolicited notification support
92 * - add POLL message and NOTIFY_POLL notification
93 *
94 * 7.12
95 * - add umask flag to input argument of create, mknod and mkdir
96 * - add notification messages for invalidation of inodes and
97 * directory entries
98 *
99 * 7.13
100 * - make max number of background requests and congestion threshold
101 * tunables
102 *
103 * 7.14
104 * - add splice support to fuse device
105 *
106 * 7.15
107 * - add store notify
108 * - add retrieve notify
109 *
110 * 7.16
111 * - add BATCH_FORGET request
112 * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
113 * fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
114 * - add FUSE_IOCTL_32BIT flag
115 *
116 * 7.17
117 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
118 *
119 * 7.18
120 * - add FUSE_IOCTL_DIR flag
121 * - add FUSE_NOTIFY_DELETE
122 *
123 * 7.19
124 * - add FUSE_FALLOCATE
125 *
126 * 7.20
127 * - add FUSE_AUTO_INVAL_DATA
128 *
129 * 7.21
130 * - add FUSE_READDIRPLUS
131 * - send the requested events in POLL request
132 *
133 * 7.22
134 * - add FUSE_ASYNC_DIO
135 *
136 * 7.23
137 * - add FUSE_WRITEBACK_CACHE
138 * - add time_gran to fuse_init_out
139 * - add reserved space to fuse_init_out
140 * - add FATTR_CTIME
141 * - add ctime and ctimensec to fuse_setattr_in
142 * - add FUSE_RENAME2 request
143 * - add FUSE_NO_OPEN_SUPPORT flag
144 *
145 * 7.24
146 * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
147 *
148 * 7.25
149 * - add FUSE_PARALLEL_DIROPS
150 *
151 * 7.26
152 * - add FUSE_HANDLE_KILLPRIV
153 * - add FUSE_POSIX_ACL
154 *
155 * 7.27
156 * - add FUSE_ABORT_ERROR
157 *
158 * 7.28
159 * - add FUSE_COPY_FILE_RANGE
160 * - add FOPEN_CACHE_DIR
161 * - add FUSE_MAX_PAGES, add max_pages to init_out
162 * - add FUSE_CACHE_SYMLINKS
163 *
164 * 7.29
165 * - add FUSE_NO_OPENDIR_SUPPORT flag
166 *
167 * 7.30
168 * - add FUSE_EXPLICIT_INVAL_DATA
169 * - add FUSE_IOCTL_COMPAT_X32
170 *
171 * 7.31
172 * - add FUSE_WRITE_KILL_PRIV flag
173 * - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
174 * - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
175 *
176 * 7.32
177 * - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS
178 *
179 * 7.33
180 * - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID
181 * - add FUSE_OPEN_KILL_SUIDGID
182 * - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT
183 * - add FUSE_SETXATTR_ACL_KILL_SGID
184 *
185 * 7.34
186 * - add FUSE_SYNCFS
187 *
188 * 7.35
189 * - add FOPEN_NOFLUSH
190 *
191 * 7.36
192 * - extend fuse_init_in with reserved fields, add FUSE_INIT_EXT init flag
193 * - add flags2 to fuse_init_in and fuse_init_out
194 * - add FUSE_SECURITY_CTX init flag
195 * - add security context to create, mkdir, symlink, and mknod requests
196 * - add FUSE_HAS_INODE_DAX, FUSE_ATTR_DAX
197 *
198 * 7.37
199 * - add FUSE_TMPFILE
200 *
201 * 7.38
202 * - add FUSE_EXPIRE_ONLY flag to fuse_notify_inval_entry
203 * - add FOPEN_PARALLEL_DIRECT_WRITES
204 * - add total_extlen to fuse_in_header
205 * - add FUSE_MAX_NR_SECCTX
206 * - add extension header
207 * - add FUSE_EXT_GROUPS
208 * - add FUSE_CREATE_SUPP_GROUP
209 * - add FUSE_HAS_EXPIRE_ONLY
210 *
211 * 7.39
212 * - add FUSE_DIRECT_IO_ALLOW_MMAP
213 * - add FUSE_STATX and related structures
214 *
215 * 7.40
216 * - add max_stack_depth to fuse_init_out, add FUSE_PASSTHROUGH init flag
217 * - add backing_id to fuse_open_out, add FOPEN_PASSTHROUGH open flag
218 * - add FUSE_NO_EXPORT_SUPPORT init flag
219 * - add FUSE_NOTIFY_RESEND, add FUSE_HAS_RESEND init flag
220 *
221 * 7.41
222 * - add FUSE_ALLOW_IDMAP
223 * 7.42
224 * - Add FUSE_OVER_IO_URING and all other io-uring related flags and data
225 * structures:
226 * - struct fuse_uring_ent_in_out
227 * - struct fuse_uring_req_header
228 * - struct fuse_uring_cmd_req
229 * - FUSE_URING_IN_OUT_HEADER_SZ
230 * - FUSE_URING_OP_IN_OUT_SZ
231 * - enum fuse_uring_cmd
232 *
233 * 7.43
234 * - add FUSE_REQUEST_TIMEOUT
235 *
236 * 7.44
237 * - add FUSE_NOTIFY_INC_EPOCH
238 *
239 * 7.45
240 * - add FUSE_COPY_FILE_RANGE_64
241 * - add struct fuse_copy_file_range_out
242 */
243
244#ifndef _LINUX_FUSE_H
245#define _LINUX_FUSE_H
246
247#ifdef __KERNEL__
248#include <linux/types.h>
249#else
250#include <stdint.h>
251#endif
252
253/*
254 * Version negotiation:
255 *
256 * Both the kernel and userspace send the version they support in the
257 * INIT request and reply respectively.
258 *
259 * If the major versions match then both shall use the smallest
260 * of the two minor versions for communication.
261 *
262 * If the kernel supports a larger major version, then userspace shall
263 * reply with the major version it supports, ignore the rest of the
264 * INIT message and expect a new INIT message from the kernel with a
265 * matching major version.
266 *
267 * If the library supports a larger major version, then it shall fall
268 * back to the major protocol version sent by the kernel for
269 * communication and reply with that major version (and an arbitrary
270 * supported minor version).
271 */
272
274#define FUSE_KERNEL_VERSION 7
275
277#define FUSE_KERNEL_MINOR_VERSION 45
278
280#define FUSE_ROOT_ID 1
281
282/* Make sure all structures are padded to 64bit boundary, so 32bit
283 userspace works under 64bit kernels */
284
285struct fuse_attr {
286 uint64_t ino;
287 uint64_t size;
288 uint64_t blocks;
289 uint64_t atime;
290 uint64_t mtime;
291 uint64_t ctime;
292 uint32_t atimensec;
293 uint32_t mtimensec;
294 uint32_t ctimensec;
295 uint32_t mode;
296 uint32_t nlink;
297 uint32_t uid;
298 uint32_t gid;
299 uint32_t rdev;
300 uint32_t blksize;
301 uint32_t flags;
302};
303
304/*
305 * The following structures are bit-for-bit compatible with the statx(2) ABI in
306 * Linux.
307 */
308struct fuse_sx_time {
309 int64_t tv_sec;
310 uint32_t tv_nsec;
311 int32_t __reserved;
312};
313
314struct fuse_statx {
315 uint32_t mask;
316 uint32_t blksize;
317 uint64_t attributes;
318 uint32_t nlink;
319 uint32_t uid;
320 uint32_t gid;
321 uint16_t mode;
322 uint16_t __spare0[1];
323 uint64_t ino;
324 uint64_t size;
325 uint64_t blocks;
326 uint64_t attributes_mask;
327 struct fuse_sx_time atime;
328 struct fuse_sx_time btime;
329 struct fuse_sx_time ctime;
330 struct fuse_sx_time mtime;
331 uint32_t rdev_major;
332 uint32_t rdev_minor;
333 uint32_t dev_major;
334 uint32_t dev_minor;
335 uint64_t __spare2[14];
336};
337
338struct fuse_kstatfs {
339 uint64_t blocks;
340 uint64_t bfree;
341 uint64_t bavail;
342 uint64_t files;
343 uint64_t ffree;
344 uint32_t bsize;
345 uint32_t namelen;
346 uint32_t frsize;
347 uint32_t padding;
348 uint32_t spare[6];
349};
350
351struct fuse_file_lock {
352 uint64_t start;
353 uint64_t end;
354 uint32_t type;
355 uint32_t pid; /* tgid */
356};
357
361#define FATTR_MODE (1 << 0)
362#define FATTR_UID (1 << 1)
363#define FATTR_GID (1 << 2)
364#define FATTR_SIZE (1 << 3)
365#define FATTR_ATIME (1 << 4)
366#define FATTR_MTIME (1 << 5)
367#define FATTR_FH (1 << 6)
368#define FATTR_ATIME_NOW (1 << 7)
369#define FATTR_MTIME_NOW (1 << 8)
370#define FATTR_LOCKOWNER (1 << 9)
371#define FATTR_CTIME (1 << 10)
372#define FATTR_KILL_SUIDGID (1 << 11)
373
386#define FOPEN_DIRECT_IO (1 << 0)
387#define FOPEN_KEEP_CACHE (1 << 1)
388#define FOPEN_NONSEEKABLE (1 << 2)
389#define FOPEN_CACHE_DIR (1 << 3)
390#define FOPEN_STREAM (1 << 4)
391#define FOPEN_NOFLUSH (1 << 5)
392#define FOPEN_PARALLEL_DIRECT_WRITES (1 << 6)
393#define FOPEN_PASSTHROUGH (1 << 7)
394
451#define FUSE_ASYNC_READ (1 << 0)
452#define FUSE_POSIX_LOCKS (1 << 1)
453#define FUSE_FILE_OPS (1 << 2)
454#define FUSE_ATOMIC_O_TRUNC (1 << 3)
455#define FUSE_EXPORT_SUPPORT (1 << 4)
456#define FUSE_BIG_WRITES (1 << 5)
457#define FUSE_DONT_MASK (1 << 6)
458#define FUSE_SPLICE_WRITE (1 << 7)
459#define FUSE_SPLICE_MOVE (1 << 8)
460#define FUSE_SPLICE_READ (1 << 9)
461#define FUSE_FLOCK_LOCKS (1 << 10)
462#define FUSE_HAS_IOCTL_DIR (1 << 11)
463#define FUSE_AUTO_INVAL_DATA (1 << 12)
464#define FUSE_DO_READDIRPLUS (1 << 13)
465#define FUSE_READDIRPLUS_AUTO (1 << 14)
466#define FUSE_ASYNC_DIO (1 << 15)
467#define FUSE_WRITEBACK_CACHE (1 << 16)
468#define FUSE_NO_OPEN_SUPPORT (1 << 17)
469#define FUSE_PARALLEL_DIROPS (1 << 18)
470#define FUSE_HANDLE_KILLPRIV (1 << 19)
471#define FUSE_POSIX_ACL (1 << 20)
472#define FUSE_ABORT_ERROR (1 << 21)
473#define FUSE_MAX_PAGES (1 << 22)
474#define FUSE_CACHE_SYMLINKS (1 << 23)
475#define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
476#define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
477#define FUSE_MAP_ALIGNMENT (1 << 26)
478#define FUSE_SUBMOUNTS (1 << 27)
479#define FUSE_HANDLE_KILLPRIV_V2 (1 << 28)
480#define FUSE_SETXATTR_EXT (1 << 29)
481#define FUSE_INIT_EXT (1 << 30)
482#define FUSE_INIT_RESERVED (1 << 31)
483/* bits 32..63 get shifted down 32 bits into the flags2 field */
484#define FUSE_SECURITY_CTX (1ULL << 32)
485#define FUSE_HAS_INODE_DAX (1ULL << 33)
486#define FUSE_CREATE_SUPP_GROUP (1ULL << 34)
487#define FUSE_HAS_EXPIRE_ONLY (1ULL << 35)
488#define FUSE_DIRECT_IO_ALLOW_MMAP (1ULL << 36)
489#define FUSE_PASSTHROUGH (1ULL << 37)
490#define FUSE_NO_EXPORT_SUPPORT (1ULL << 38)
491#define FUSE_HAS_RESEND (1ULL << 39)
492/* Obsolete alias for FUSE_DIRECT_IO_ALLOW_MMAP */
493#define FUSE_DIRECT_IO_RELAX FUSE_DIRECT_IO_ALLOW_MMAP
494#define FUSE_ALLOW_IDMAP (1ULL << 40)
495#define FUSE_OVER_IO_URING (1ULL << 41)
496#define FUSE_REQUEST_TIMEOUT (1ULL << 42)
497
503#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
504
508#define FUSE_RELEASE_FLUSH (1 << 0)
509#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
510
514#define FUSE_GETATTR_FH (1 << 0)
515
519#define FUSE_LK_FLOCK (1 << 0)
520
528#define FUSE_WRITE_CACHE (1 << 0)
529#define FUSE_WRITE_LOCKOWNER (1 << 1)
530#define FUSE_WRITE_KILL_SUIDGID (1 << 2)
531
532/* Obsolete alias; this flag implies killing suid/sgid only. */
533#define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID
534
538#define FUSE_READ_LOCKOWNER (1 << 1)
539
552#define FUSE_IOCTL_COMPAT (1 << 0)
553#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
554#define FUSE_IOCTL_RETRY (1 << 2)
555#define FUSE_IOCTL_32BIT (1 << 3)
556#define FUSE_IOCTL_DIR (1 << 4)
557#define FUSE_IOCTL_COMPAT_X32 (1 << 5)
558
559#define FUSE_IOCTL_MAX_IOV 256
560
566#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
567
573#define FUSE_FSYNC_FDATASYNC (1 << 0)
574
581#define FUSE_ATTR_SUBMOUNT (1 << 0)
582#define FUSE_ATTR_DAX (1 << 1)
583
588#define FUSE_OPEN_KILL_SUIDGID (1 << 0)
589
594#define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0)
595
600#define FUSE_EXPIRE_ONLY (1 << 0)
601
607enum fuse_ext_type {
608 /* Types 0..31 are reserved for fuse_secctx_header */
609 FUSE_MAX_NR_SECCTX = 31,
610 FUSE_EXT_GROUPS = 32,
611};
612
613enum fuse_opcode {
614 FUSE_LOOKUP = 1,
615 FUSE_FORGET = 2, /* no reply */
616 FUSE_GETATTR = 3,
617 FUSE_SETATTR = 4,
618 FUSE_READLINK = 5,
619 FUSE_SYMLINK = 6,
620 FUSE_MKNOD = 8,
621 FUSE_MKDIR = 9,
622 FUSE_UNLINK = 10,
623 FUSE_RMDIR = 11,
624 FUSE_RENAME = 12,
625 FUSE_LINK = 13,
626 FUSE_OPEN = 14,
627 FUSE_READ = 15,
628 FUSE_WRITE = 16,
629 FUSE_STATFS = 17,
630 FUSE_RELEASE = 18,
631 FUSE_FSYNC = 20,
632 FUSE_SETXATTR = 21,
633 FUSE_GETXATTR = 22,
634 FUSE_LISTXATTR = 23,
635 FUSE_REMOVEXATTR = 24,
636 FUSE_FLUSH = 25,
637 FUSE_INIT = 26,
638 FUSE_OPENDIR = 27,
639 FUSE_READDIR = 28,
640 FUSE_RELEASEDIR = 29,
641 FUSE_FSYNCDIR = 30,
642 FUSE_GETLK = 31,
643 FUSE_SETLK = 32,
644 FUSE_SETLKW = 33,
645 FUSE_ACCESS = 34,
646 FUSE_CREATE = 35,
647 FUSE_INTERRUPT = 36,
648 FUSE_BMAP = 37,
649 FUSE_DESTROY = 38,
650 FUSE_IOCTL = 39,
651 FUSE_POLL = 40,
652 FUSE_NOTIFY_REPLY = 41,
653 FUSE_BATCH_FORGET = 42,
654 FUSE_FALLOCATE = 43,
655 FUSE_READDIRPLUS = 44,
656 FUSE_RENAME2 = 45,
657 FUSE_LSEEK = 46,
658 FUSE_COPY_FILE_RANGE = 47,
659 FUSE_SETUPMAPPING = 48,
660 FUSE_REMOVEMAPPING = 49,
661 FUSE_SYNCFS = 50,
662 FUSE_TMPFILE = 51,
663 FUSE_STATX = 52,
664 FUSE_COPY_FILE_RANGE_64 = 53,
665
666 /* CUSE specific operations */
667 CUSE_INIT = 4096,
668
669 /* Reserved opcodes: helpful to detect structure endian-ness */
670 CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */
671 FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */
672};
673
674enum fuse_notify_code {
675 FUSE_NOTIFY_POLL = 1,
676 FUSE_NOTIFY_INVAL_INODE = 2,
677 FUSE_NOTIFY_INVAL_ENTRY = 3,
678 FUSE_NOTIFY_STORE = 4,
679 FUSE_NOTIFY_RETRIEVE = 5,
680 FUSE_NOTIFY_DELETE = 6,
681 FUSE_NOTIFY_RESEND = 7,
682 FUSE_NOTIFY_INC_EPOCH = 8,
683 FUSE_NOTIFY_CODE_MAX,
684};
685
686/* The read buffer is required to be at least 8k, but may be much larger */
687#define FUSE_MIN_READ_BUFFER 8192
688
689#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
690
691struct fuse_entry_out {
692 uint64_t nodeid; /* Inode ID */
693 uint64_t generation; /* Inode generation: nodeid:gen must
694 be unique for the fs's lifetime */
695 uint64_t entry_valid; /* Cache timeout for the name */
696 uint64_t attr_valid; /* Cache timeout for the attributes */
697 uint32_t entry_valid_nsec;
698 uint32_t attr_valid_nsec;
699 struct fuse_attr attr;
700};
701
702struct fuse_forget_in {
703 uint64_t nlookup;
704};
705
706struct fuse_forget_one {
707 uint64_t nodeid;
708 uint64_t nlookup;
709};
710
711struct fuse_batch_forget_in {
712 uint32_t count;
713 uint32_t dummy;
714};
715
716struct fuse_getattr_in {
717 uint32_t getattr_flags;
718 uint32_t dummy;
719 uint64_t fh;
720};
721
722#define FUSE_COMPAT_ATTR_OUT_SIZE 96
723
724struct fuse_attr_out {
725 uint64_t attr_valid; /* Cache timeout for the attributes */
726 uint32_t attr_valid_nsec;
727 uint32_t dummy;
728 struct fuse_attr attr;
729};
730
731struct fuse_statx_in {
732 uint32_t getattr_flags;
733 uint32_t reserved;
734 uint64_t fh;
735 uint32_t sx_flags;
736 uint32_t sx_mask;
737};
738
739struct fuse_statx_out {
740 uint64_t attr_valid; /* Cache timeout for the attributes */
741 uint32_t attr_valid_nsec;
742 uint32_t flags;
743 uint64_t spare[2];
744 struct fuse_statx stat;
745};
746
747#define FUSE_COMPAT_MKNOD_IN_SIZE 8
748
749struct fuse_mknod_in {
750 uint32_t mode;
751 uint32_t rdev;
752 uint32_t umask;
753 uint32_t padding;
754};
755
756struct fuse_mkdir_in {
757 uint32_t mode;
758 uint32_t umask;
759};
760
761struct fuse_rename_in {
762 uint64_t newdir;
763};
764
765struct fuse_rename2_in {
766 uint64_t newdir;
767 uint32_t flags;
768 uint32_t padding;
769};
770
771struct fuse_link_in {
772 uint64_t oldnodeid;
773};
774
775struct fuse_setattr_in {
776 uint32_t valid;
777 uint32_t padding;
778 uint64_t fh;
779 uint64_t size;
780 uint64_t lock_owner;
781 uint64_t atime;
782 uint64_t mtime;
783 uint64_t ctime;
784 uint32_t atimensec;
785 uint32_t mtimensec;
786 uint32_t ctimensec;
787 uint32_t mode;
788 uint32_t unused4;
789 uint32_t uid;
790 uint32_t gid;
791 uint32_t unused5;
792};
793
794struct fuse_open_in {
795 uint32_t flags;
796 uint32_t open_flags; /* FUSE_OPEN_... */
797};
798
799struct fuse_create_in {
800 uint32_t flags;
801 uint32_t mode;
802 uint32_t umask;
803 uint32_t open_flags; /* FUSE_OPEN_... */
804};
805
806struct fuse_open_out {
807 uint64_t fh;
808 uint32_t open_flags;
809 int32_t backing_id;
810};
811
812struct fuse_release_in {
813 uint64_t fh;
814 uint32_t flags;
815 uint32_t release_flags;
816 uint64_t lock_owner;
817};
818
819struct fuse_flush_in {
820 uint64_t fh;
821 uint32_t unused;
822 uint32_t padding;
823 uint64_t lock_owner;
824};
825
826struct fuse_read_in {
827 uint64_t fh;
828 uint64_t offset;
829 uint32_t size;
830 uint32_t read_flags;
831 uint64_t lock_owner;
832 uint32_t flags;
833 uint32_t padding;
834};
835
836#define FUSE_COMPAT_WRITE_IN_SIZE 24
837
838struct fuse_write_in {
839 uint64_t fh;
840 uint64_t offset;
841 uint32_t size;
842 uint32_t write_flags;
843 uint64_t lock_owner;
844 uint32_t flags;
845 uint32_t padding;
846};
847
848struct fuse_write_out {
849 uint32_t size;
850 uint32_t padding;
851};
852
853#define FUSE_COMPAT_STATFS_SIZE 48
854
855struct fuse_statfs_out {
856 struct fuse_kstatfs st;
857};
858
859struct fuse_fsync_in {
860 uint64_t fh;
861 uint32_t fsync_flags;
862 uint32_t padding;
863};
864
865#define FUSE_COMPAT_SETXATTR_IN_SIZE 8
866
867struct fuse_setxattr_in {
868 uint32_t size;
869 uint32_t flags;
870 uint32_t setxattr_flags;
871 uint32_t padding;
872};
873
874struct fuse_getxattr_in {
875 uint32_t size;
876 uint32_t padding;
877};
878
879struct fuse_getxattr_out {
880 uint32_t size;
881 uint32_t padding;
882};
883
884struct fuse_lk_in {
885 uint64_t fh;
886 uint64_t owner;
887 struct fuse_file_lock lk;
888 uint32_t lk_flags;
889 uint32_t padding;
890};
891
892struct fuse_lk_out {
893 struct fuse_file_lock lk;
894};
895
896struct fuse_access_in {
897 uint32_t mask;
898 uint32_t padding;
899};
900
901struct fuse_init_in {
902 uint32_t major;
903 uint32_t minor;
904 uint32_t max_readahead;
905 uint32_t flags;
906 uint32_t flags2;
907 uint32_t unused[11];
908};
909
910#define FUSE_COMPAT_INIT_OUT_SIZE 8
911#define FUSE_COMPAT_22_INIT_OUT_SIZE 24
912
913struct fuse_init_out {
914 uint32_t major;
915 uint32_t minor;
916 uint32_t max_readahead;
917 uint32_t flags;
918 uint16_t max_background;
919 uint16_t congestion_threshold;
920 uint32_t max_write;
921 uint32_t time_gran;
922 uint16_t max_pages;
923 uint16_t map_alignment;
924 uint32_t flags2;
925 uint32_t max_stack_depth;
926 uint16_t request_timeout;
927 uint16_t unused[11];
928};
929
930#define CUSE_INIT_INFO_MAX 4096
931
932struct cuse_init_in {
933 uint32_t major;
934 uint32_t minor;
935 uint32_t unused;
936 uint32_t flags;
937};
938
939struct cuse_init_out {
940 uint32_t major;
941 uint32_t minor;
942 uint32_t unused;
943 uint32_t flags;
944 uint32_t max_read;
945 uint32_t max_write;
946 uint32_t dev_major; /* chardev major */
947 uint32_t dev_minor; /* chardev minor */
948 uint32_t spare[10];
949};
950
951struct fuse_interrupt_in {
952 uint64_t unique;
953};
954
955struct fuse_bmap_in {
956 uint64_t block;
957 uint32_t blocksize;
958 uint32_t padding;
959};
960
961struct fuse_bmap_out {
962 uint64_t block;
963};
964
965struct fuse_ioctl_in {
966 uint64_t fh;
967 uint32_t flags;
968 uint32_t cmd;
969 uint64_t arg;
970 uint32_t in_size;
971 uint32_t out_size;
972};
973
974struct fuse_ioctl_iovec {
975 uint64_t base;
976 uint64_t len;
977};
978
979struct fuse_ioctl_out {
980 int32_t result;
981 uint32_t flags;
982 uint32_t in_iovs;
983 uint32_t out_iovs;
984};
985
986struct fuse_poll_in {
987 uint64_t fh;
988 uint64_t kh;
989 uint32_t flags;
990 uint32_t events;
991};
992
993struct fuse_poll_out {
994 uint32_t revents;
995 uint32_t padding;
996};
997
998struct fuse_notify_poll_wakeup_out {
999 uint64_t kh;
1000};
1001
1002struct fuse_fallocate_in {
1003 uint64_t fh;
1004 uint64_t offset;
1005 uint64_t length;
1006 uint32_t mode;
1007 uint32_t padding;
1008};
1009
1016#define FUSE_UNIQUE_RESEND (1ULL << 63)
1017
1031#define FUSE_INVALID_UIDGID ((uint32_t)(-1))
1032
1033struct fuse_in_header {
1034 uint32_t len;
1035 uint32_t opcode;
1036 uint64_t unique;
1037 uint64_t nodeid;
1038 uint32_t uid;
1039 uint32_t gid;
1040 uint32_t pid;
1041 uint16_t total_extlen; /* length of extensions in 8byte units */
1042 uint16_t padding;
1043};
1044
1045struct fuse_out_header {
1046 uint32_t len;
1047 int32_t error;
1048 uint64_t unique;
1049};
1050
1051struct fuse_dirent {
1052 uint64_t ino;
1053 uint64_t off;
1054 uint32_t namelen;
1055 uint32_t type;
1056 char name[];
1057};
1058
1059/* Align variable length records to 64bit boundary */
1060#define FUSE_REC_ALIGN(x) \
1061 (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
1062
1063#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
1064#define FUSE_DIRENT_ALIGN(x) FUSE_REC_ALIGN(x)
1065#define FUSE_DIRENT_SIZE(d) \
1066 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
1067
1068struct fuse_direntplus {
1069 struct fuse_entry_out entry_out;
1070 struct fuse_dirent dirent;
1071};
1072
1073#define FUSE_NAME_OFFSET_DIRENTPLUS \
1074 offsetof(struct fuse_direntplus, dirent.name)
1075#define FUSE_DIRENTPLUS_SIZE(d) \
1076 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
1077
1078struct fuse_notify_inval_inode_out {
1079 uint64_t ino;
1080 int64_t off;
1081 int64_t len;
1082};
1083
1084struct fuse_notify_inval_entry_out {
1085 uint64_t parent;
1086 uint32_t namelen;
1087 uint32_t flags;
1088};
1089
1090struct fuse_notify_delete_out {
1091 uint64_t parent;
1092 uint64_t child;
1093 uint32_t namelen;
1094 uint32_t padding;
1095};
1096
1097struct fuse_notify_store_out {
1098 uint64_t nodeid;
1099 uint64_t offset;
1100 uint32_t size;
1101 uint32_t padding;
1102};
1103
1104struct fuse_notify_retrieve_out {
1105 uint64_t notify_unique;
1106 uint64_t nodeid;
1107 uint64_t offset;
1108 uint32_t size;
1109 uint32_t padding;
1110};
1111
1112/* Matches the size of fuse_write_in */
1113struct fuse_notify_retrieve_in {
1114 uint64_t dummy1;
1115 uint64_t offset;
1116 uint32_t size;
1117 uint32_t dummy2;
1118 uint64_t dummy3;
1119 uint64_t dummy4;
1120};
1121
1122struct fuse_backing_map {
1123 int32_t fd;
1124 uint32_t flags;
1125 uint64_t padding;
1126};
1127
1128/* Device ioctls: */
1129#define FUSE_DEV_IOC_MAGIC 229
1130#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
1131#define FUSE_DEV_IOC_BACKING_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 1, \
1132 struct fuse_backing_map)
1133#define FUSE_DEV_IOC_BACKING_CLOSE _IOW(FUSE_DEV_IOC_MAGIC, 2, uint32_t)
1134
1135struct fuse_lseek_in {
1136 uint64_t fh;
1137 uint64_t offset;
1138 uint32_t whence;
1139 uint32_t padding;
1140};
1141
1142struct fuse_lseek_out {
1143 uint64_t offset;
1144};
1145
1146struct fuse_copy_file_range_in {
1147 uint64_t fh_in;
1148 uint64_t off_in;
1149 uint64_t nodeid_out;
1150 uint64_t fh_out;
1151 uint64_t off_out;
1152 uint64_t len;
1153 uint64_t flags;
1154};
1155
1156/* For FUSE_COPY_FILE_RANGE_64 */
1157struct fuse_copy_file_range_out {
1158 uint64_t bytes_copied;
1159};
1160
1161#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
1162#define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
1163struct fuse_setupmapping_in {
1164 /* An already open handle */
1165 uint64_t fh;
1166 /* Offset into the file to start the mapping */
1167 uint64_t foffset;
1168 /* Length of mapping required */
1169 uint64_t len;
1170 /* Flags, FUSE_SETUPMAPPING_FLAG_* */
1171 uint64_t flags;
1172 /* Offset in Memory Window */
1173 uint64_t moffset;
1174};
1175
1176struct fuse_removemapping_in {
1177 /* number of fuse_removemapping_one follows */
1178 uint32_t count;
1179};
1180
1181struct fuse_removemapping_one {
1182 /* Offset into the dax window start the unmapping */
1183 uint64_t moffset;
1184 /* Length of mapping required */
1185 uint64_t len;
1186};
1187
1188#define FUSE_REMOVEMAPPING_MAX_ENTRY \
1189 (PAGE_SIZE / sizeof(struct fuse_removemapping_one))
1190
1191struct fuse_syncfs_in {
1192 uint64_t padding;
1193};
1194
1195/*
1196 * For each security context, send fuse_secctx with size of security context
1197 * fuse_secctx will be followed by security context name and this in turn
1198 * will be followed by actual context label.
1199 * fuse_secctx, name, context
1200 */
1201struct fuse_secctx {
1202 uint32_t size;
1203 uint32_t padding;
1204};
1205
1206/*
1207 * Contains the information about how many fuse_secctx structures are being
1208 * sent and what's the total size of all security contexts (including
1209 * size of fuse_secctx_header).
1210 *
1211 */
1212struct fuse_secctx_header {
1213 uint32_t size;
1214 uint32_t nr_secctx;
1215};
1216
1225struct fuse_ext_header {
1226 uint32_t size;
1227 uint32_t type;
1228};
1229
1235struct fuse_supp_groups {
1236 uint32_t nr_groups;
1237 uint32_t groups[];
1238};
1239
1243#define FUSE_URING_IN_OUT_HEADER_SZ 128
1244#define FUSE_URING_OP_IN_OUT_SZ 128
1245
1246/* Used as part of the fuse_uring_req_header */
1247struct fuse_uring_ent_in_out {
1248 uint64_t flags;
1249
1250 /*
1251 * commit ID to be used in a reply to a ring request (see also
1252 * struct fuse_uring_cmd_req)
1253 */
1254 uint64_t commit_id;
1255
1256 /* size of user payload buffer */
1257 uint32_t payload_sz;
1258 uint32_t padding;
1259
1260 uint64_t reserved;
1261};
1262
1266 struct fuse_uring_req_header {
1267 /* struct fuse_in_header / struct fuse_out_header */
1268 char in_out[FUSE_URING_IN_OUT_HEADER_SZ];
1269
1270 /* per op code header */
1271 char op_in[FUSE_URING_OP_IN_OUT_SZ];
1272
1273 struct fuse_uring_ent_in_out ring_ent_in_out;
1274};
1275
1279enum fuse_uring_cmd {
1280 FUSE_IO_URING_CMD_INVALID = 0,
1281
1282 /* register the request buffer and fetch a fuse request */
1283 FUSE_IO_URING_CMD_REGISTER = 1,
1284
1285 /* commit fuse request result and fetch next request */
1286 FUSE_IO_URING_CMD_COMMIT_AND_FETCH = 2,
1287};
1288
1292 struct fuse_uring_cmd_req {
1293 uint64_t flags;
1294
1295 /* entry identifier for commits */
1296 uint64_t commit_id;
1297
1298 /* queue the command is for (queue index) */
1299 uint16_t qid;
1300 uint8_t padding[6];
1301};
1302
1303#endif /* _LINUX_FUSE_H */
fuse_ext_header
Definition fuse_kernel.h:1174
fuse_supp_groups
Definition fuse_kernel.h:1184
fuse_uring_cmd_req
Definition fuse_kernel.h:1292
fuse_uring_req_header
Definition fuse_kernel.h:1266