xref: /linux/include/uapi/linux/fuse.h (revision 100c85421b52e41269ada88f7d71a6b8a06c7a11)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2607ca46eSDavid Howells /*
37e98d530SMiklos Szeredi     This file defines the kernel interface of FUSE
4607ca46eSDavid Howells     Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu>
5607ca46eSDavid Howells 
6607ca46eSDavid Howells     This program can be distributed under the terms of the GNU GPL.
7607ca46eSDavid Howells     See the file COPYING.
87e98d530SMiklos Szeredi 
97e98d530SMiklos Szeredi     This -- and only this -- header file may also be distributed under
107e98d530SMiklos Szeredi     the terms of the BSD Licence as follows:
117e98d530SMiklos Szeredi 
127e98d530SMiklos Szeredi     Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
137e98d530SMiklos Szeredi 
147e98d530SMiklos Szeredi     Redistribution and use in source and binary forms, with or without
157e98d530SMiklos Szeredi     modification, are permitted provided that the following conditions
167e98d530SMiklos Szeredi     are met:
177e98d530SMiklos Szeredi     1. Redistributions of source code must retain the above copyright
187e98d530SMiklos Szeredi        notice, this list of conditions and the following disclaimer.
197e98d530SMiklos Szeredi     2. Redistributions in binary form must reproduce the above copyright
207e98d530SMiklos Szeredi        notice, this list of conditions and the following disclaimer in the
217e98d530SMiklos Szeredi        documentation and/or other materials provided with the distribution.
227e98d530SMiklos Szeredi 
237e98d530SMiklos Szeredi     THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
247e98d530SMiklos Szeredi     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
257e98d530SMiklos Szeredi     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
267e98d530SMiklos Szeredi     ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
277e98d530SMiklos Szeredi     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
287e98d530SMiklos Szeredi     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
297e98d530SMiklos Szeredi     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
307e98d530SMiklos Szeredi     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
317e98d530SMiklos Szeredi     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
327e98d530SMiklos Szeredi     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
337e98d530SMiklos Szeredi     SUCH DAMAGE.
34607ca46eSDavid Howells */
35607ca46eSDavid Howells 
36607ca46eSDavid Howells /*
37607ca46eSDavid Howells  * This file defines the kernel interface of FUSE
38607ca46eSDavid Howells  *
39607ca46eSDavid Howells  * Protocol changelog:
40607ca46eSDavid Howells  *
419de55a37SAlan Somers  * 7.1:
429de55a37SAlan Somers  *  - add the following messages:
439de55a37SAlan Somers  *      FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,
449de55a37SAlan Somers  *      FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,
459de55a37SAlan Somers  *      FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,
469de55a37SAlan Somers  *      FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,
479de55a37SAlan Somers  *      FUSE_RELEASEDIR
489de55a37SAlan Somers  *  - add padding to messages to accommodate 32-bit servers on 64-bit kernels
499de55a37SAlan Somers  *
509de55a37SAlan Somers  * 7.2:
519de55a37SAlan Somers  *  - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags
529de55a37SAlan Somers  *  - add FUSE_FSYNCDIR message
539de55a37SAlan Somers  *
549de55a37SAlan Somers  * 7.3:
559de55a37SAlan Somers  *  - add FUSE_ACCESS message
569de55a37SAlan Somers  *  - add FUSE_CREATE message
579de55a37SAlan Somers  *  - add filehandle to fuse_setattr_in
589de55a37SAlan Somers  *
599de55a37SAlan Somers  * 7.4:
609de55a37SAlan Somers  *  - add frsize to fuse_kstatfs
619de55a37SAlan Somers  *  - clean up request size limit checking
629de55a37SAlan Somers  *
639de55a37SAlan Somers  * 7.5:
649de55a37SAlan Somers  *  - add flags and max_write to fuse_init_out
659de55a37SAlan Somers  *
669de55a37SAlan Somers  * 7.6:
679de55a37SAlan Somers  *  - add max_readahead to fuse_init_in and fuse_init_out
689de55a37SAlan Somers  *
699de55a37SAlan Somers  * 7.7:
709de55a37SAlan Somers  *  - add FUSE_INTERRUPT message
719de55a37SAlan Somers  *  - add POSIX file lock support
729de55a37SAlan Somers  *
739de55a37SAlan Somers  * 7.8:
749de55a37SAlan Somers  *  - add lock_owner and flags fields to fuse_release_in
759de55a37SAlan Somers  *  - add FUSE_BMAP message
769de55a37SAlan Somers  *  - add FUSE_DESTROY message
779de55a37SAlan Somers  *
78607ca46eSDavid Howells  * 7.9:
79607ca46eSDavid Howells  *  - new fuse_getattr_in input argument of GETATTR
80607ca46eSDavid Howells  *  - add lk_flags in fuse_lk_in
81607ca46eSDavid Howells  *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
82607ca46eSDavid Howells  *  - add blksize field to fuse_attr
83607ca46eSDavid Howells  *  - add file flags field to fuse_read_in and fuse_write_in
847142fd1bSAlan Somers  *  - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
85607ca46eSDavid Howells  *
86607ca46eSDavid Howells  * 7.10
87607ca46eSDavid Howells  *  - add nonseekable open flag
88607ca46eSDavid Howells  *
89607ca46eSDavid Howells  * 7.11
90607ca46eSDavid Howells  *  - add IOCTL message
91607ca46eSDavid Howells  *  - add unsolicited notification support
92607ca46eSDavid Howells  *  - add POLL message and NOTIFY_POLL notification
93607ca46eSDavid Howells  *
94607ca46eSDavid Howells  * 7.12
9568065b84SAlan Somers  *  - add umask flag to input argument of create, mknod and mkdir
96607ca46eSDavid Howells  *  - add notification messages for invalidation of inodes and
97607ca46eSDavid Howells  *    directory entries
98607ca46eSDavid Howells  *
99607ca46eSDavid Howells  * 7.13
100607ca46eSDavid Howells  *  - make max number of background requests and congestion threshold
101607ca46eSDavid Howells  *    tunables
102607ca46eSDavid Howells  *
103607ca46eSDavid Howells  * 7.14
104607ca46eSDavid Howells  *  - add splice support to fuse device
105607ca46eSDavid Howells  *
106607ca46eSDavid Howells  * 7.15
107607ca46eSDavid Howells  *  - add store notify
108607ca46eSDavid Howells  *  - add retrieve notify
109607ca46eSDavid Howells  *
110607ca46eSDavid Howells  * 7.16
111607ca46eSDavid Howells  *  - add BATCH_FORGET request
112607ca46eSDavid Howells  *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
113607ca46eSDavid Howells  *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
114607ca46eSDavid Howells  *  - add FUSE_IOCTL_32BIT flag
115607ca46eSDavid Howells  *
116607ca46eSDavid Howells  * 7.17
117607ca46eSDavid Howells  *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
118607ca46eSDavid Howells  *
119607ca46eSDavid Howells  * 7.18
120607ca46eSDavid Howells  *  - add FUSE_IOCTL_DIR flag
121607ca46eSDavid Howells  *  - add FUSE_NOTIFY_DELETE
122607ca46eSDavid Howells  *
123607ca46eSDavid Howells  * 7.19
124607ca46eSDavid Howells  *  - add FUSE_FALLOCATE
125607ca46eSDavid Howells  *
126607ca46eSDavid Howells  * 7.20
127607ca46eSDavid Howells  *  - add FUSE_AUTO_INVAL_DATA
12823c153e5SMiklos Szeredi  *
12923c153e5SMiklos Szeredi  * 7.21
13023c153e5SMiklos Szeredi  *  - add FUSE_READDIRPLUS
1310415d291SEnke Chen  *  - send the requested events in POLL request
13260b9df7aSMiklos Szeredi  *
13360b9df7aSMiklos Szeredi  * 7.22
13460b9df7aSMiklos Szeredi  *  - add FUSE_ASYNC_DIO
1354d99ff8fSPavel Emelyanov  *
1364d99ff8fSPavel Emelyanov  * 7.23
1374d99ff8fSPavel Emelyanov  *  - add FUSE_WRITEBACK_CACHE
138e27c9d38SMiklos Szeredi  *  - add time_gran to fuse_init_out
139e27c9d38SMiklos Szeredi  *  - add reserved space to fuse_init_out
140ab9e13f7SMaxim Patlasov  *  - add FATTR_CTIME
141ab9e13f7SMaxim Patlasov  *  - add ctime and ctimensec to fuse_setattr_in
1421560c974SMiklos Szeredi  *  - add FUSE_RENAME2 request
143d7afaec0SAndrew Gallagher  *  - add FUSE_NO_OPEN_SUPPORT flag
1440b5da8dbSRavishankar N  *
1450b5da8dbSRavishankar N  *  7.24
1460b5da8dbSRavishankar N  *  - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
1475c672ab3SMiklos Szeredi  *
1485c672ab3SMiklos Szeredi  *  7.25
1495c672ab3SMiklos Szeredi  *  - add FUSE_PARALLEL_DIROPS
1505e940c1dSMiklos Szeredi  *
1515e940c1dSMiklos Szeredi  *  7.26
1525e940c1dSMiklos Szeredi  *  - add FUSE_HANDLE_KILLPRIV
15360bcc88aSSeth Forshee  *  - add FUSE_POSIX_ACL
1543b7008b2SSzymon Lukasz  *
1553b7008b2SSzymon Lukasz  *  7.27
1563b7008b2SSzymon Lukasz  *  - add FUSE_ABORT_ERROR
15788bc7d50SNiels de Vos  *
15888bc7d50SNiels de Vos  *  7.28
15988bc7d50SNiels de Vos  *  - add FUSE_COPY_FILE_RANGE
1606433b899SMiklos Szeredi  *  - add FOPEN_CACHE_DIR
1615da784ccSConstantine Shulyupin  *  - add FUSE_MAX_PAGES, add max_pages to init_out
1625571f1e6SDan Schatzberg  *  - add FUSE_CACHE_SYMLINKS
163d9a9ea94SChad Austin  *
164d9a9ea94SChad Austin  *  7.29
165d9a9ea94SChad Austin  *  - add FUSE_NO_OPENDIR_SUPPORT flag
166ad2ba64dSKirill Smelkov  *
167ad2ba64dSKirill Smelkov  *  7.30
168ad2ba64dSKirill Smelkov  *  - add FUSE_EXPLICIT_INVAL_DATA
1696407f44aSIan Abbott  *  - add FUSE_IOCTL_COMPAT_X32
1704a2abf99SMiklos Szeredi  *
1714a2abf99SMiklos Szeredi  *  7.31
1724a2abf99SMiklos Szeredi  *  - add FUSE_WRITE_KILL_PRIV flag
173c4bb667eSDr. David Alan Gilbert  *  - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
174c4bb667eSDr. David Alan Gilbert  *  - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
175c6ff213fSMax Reitz  *
176c6ff213fSMax Reitz  *  7.32
177c6ff213fSMax Reitz  *  - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS
17863f9909fSVivek Goyal  *
17963f9909fSVivek Goyal  *  7.33
18031792161SVivek Goyal  *  - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID
181643a666aSVivek Goyal  *  - add FUSE_OPEN_KILL_SUIDGID
18252a4c95fSVivek Goyal  *  - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT
183550a7d3bSVivek Goyal  *  - add FUSE_SETXATTR_ACL_KILL_SGID
1842d82ab25SGreg Kurz  *
1852d82ab25SGreg Kurz  *  7.34
1862d82ab25SGreg Kurz  *  - add FUSE_SYNCFS
187a390ccb3SAmir Goldstein  *
188a390ccb3SAmir Goldstein  *  7.35
189a390ccb3SAmir Goldstein  *  - add FOPEN_NOFLUSH
19053db2893SMiklos Szeredi  *
19153db2893SMiklos Szeredi  *  7.36
19253db2893SMiklos Szeredi  *  - extend fuse_init_in with reserved fields, add FUSE_INIT_EXT init flag
19353db2893SMiklos Szeredi  *  - add flags2 to fuse_init_in and fuse_init_out
1943e2b6fdbSVivek Goyal  *  - add FUSE_SECURITY_CTX init flag
1953e2b6fdbSVivek Goyal  *  - add security context to create, mkdir, symlink, and mknod requests
19698046f74SJeffle Xu  *  - add FUSE_HAS_INODE_DAX, FUSE_ATTR_DAX
1977d375390SMiklos Szeredi  *
1987d375390SMiklos Szeredi  *  7.37
1997d375390SMiklos Szeredi  *  - add FUSE_TMPFILE
2004f8d3702SMiklos Szeredi  *
2014f8d3702SMiklos Szeredi  *  7.38
2024f8d3702SMiklos Szeredi  *  - add FUSE_EXPIRE_ONLY flag to fuse_notify_inval_entry
20315352405SDharmendra Singh  *  - add FOPEN_PARALLEL_DIRECT_WRITES
20415d937d7SMiklos Szeredi  *  - add total_extlen to fuse_in_header
20515d937d7SMiklos Szeredi  *  - add FUSE_MAX_NR_SECCTX
20615d937d7SMiklos Szeredi  *  - add extension header
2078ed7cb3fSMiklos Szeredi  *  - add FUSE_EXT_GROUPS
2088ed7cb3fSMiklos Szeredi  *  - add FUSE_CREATE_SUPP_GROUP
2095cadfbd5SMiklos Szeredi  *  - add FUSE_HAS_EXPIRE_ONLY
210e78662e8SHao Xu  *
211e78662e8SHao Xu  *  7.39
212c55e0a55STyler Fanelli  *  - add FUSE_DIRECT_IO_ALLOW_MMAP
213ba58a37cSMiklos Szeredi  *  - add FUSE_STATX and related structures
2147dc4e97aSAmir Goldstein  *
2157dc4e97aSAmir Goldstein  *  7.40
2167dc4e97aSAmir Goldstein  *  - add max_stack_depth to fuse_init_out, add FUSE_PASSTHROUGH init flag
2177dc4e97aSAmir Goldstein  *  - add backing_id to fuse_open_out, add FOPEN_PASSTHROUGH open flag
218e022f6a1SJingbo Xu  *  - add FUSE_NO_EXPORT_SUPPORT init flag
219*9e7f5296SZhao Chen  *  - add FUSE_NOTIFY_RESEND, add FUSE_HAS_RESEND init flag
220607ca46eSDavid Howells  */
221607ca46eSDavid Howells 
222607ca46eSDavid Howells #ifndef _LINUX_FUSE_H
223607ca46eSDavid Howells #define _LINUX_FUSE_H
224607ca46eSDavid Howells 
2254c82456eSMiklos Szeredi #ifdef __KERNEL__
226607ca46eSDavid Howells #include <linux/types.h>
2277e98d530SMiklos Szeredi #else
2287e98d530SMiklos Szeredi #include <stdint.h>
2297e98d530SMiklos Szeredi #endif
230607ca46eSDavid Howells 
231607ca46eSDavid Howells /*
232607ca46eSDavid Howells  * Version negotiation:
233607ca46eSDavid Howells  *
234607ca46eSDavid Howells  * Both the kernel and userspace send the version they support in the
235607ca46eSDavid Howells  * INIT request and reply respectively.
236607ca46eSDavid Howells  *
237607ca46eSDavid Howells  * If the major versions match then both shall use the smallest
238607ca46eSDavid Howells  * of the two minor versions for communication.
239607ca46eSDavid Howells  *
240607ca46eSDavid Howells  * If the kernel supports a larger major version, then userspace shall
241607ca46eSDavid Howells  * reply with the major version it supports, ignore the rest of the
242607ca46eSDavid Howells  * INIT message and expect a new INIT message from the kernel with a
243607ca46eSDavid Howells  * matching major version.
244607ca46eSDavid Howells  *
245607ca46eSDavid Howells  * If the library supports a larger major version, then it shall fall
246607ca46eSDavid Howells  * back to the major protocol version sent by the kernel for
247607ca46eSDavid Howells  * communication and reply with that major version (and an arbitrary
248607ca46eSDavid Howells  * supported minor version).
249607ca46eSDavid Howells  */
250607ca46eSDavid Howells 
251607ca46eSDavid Howells /** Version number of this interface */
252607ca46eSDavid Howells #define FUSE_KERNEL_VERSION 7
253607ca46eSDavid Howells 
254607ca46eSDavid Howells /** Minor version number of this interface */
2557dc4e97aSAmir Goldstein #define FUSE_KERNEL_MINOR_VERSION 40
256607ca46eSDavid Howells 
257607ca46eSDavid Howells /** The node ID of the root inode */
258607ca46eSDavid Howells #define FUSE_ROOT_ID 1
259607ca46eSDavid Howells 
260607ca46eSDavid Howells /* Make sure all structures are padded to 64bit boundary, so 32bit
261607ca46eSDavid Howells    userspace works under 64bit kernels */
262607ca46eSDavid Howells 
263607ca46eSDavid Howells struct fuse_attr {
2644c82456eSMiklos Szeredi 	uint64_t	ino;
2654c82456eSMiklos Szeredi 	uint64_t	size;
2664c82456eSMiklos Szeredi 	uint64_t	blocks;
2674c82456eSMiklos Szeredi 	uint64_t	atime;
2684c82456eSMiklos Szeredi 	uint64_t	mtime;
2694c82456eSMiklos Szeredi 	uint64_t	ctime;
2704c82456eSMiklos Szeredi 	uint32_t	atimensec;
2714c82456eSMiklos Szeredi 	uint32_t	mtimensec;
2724c82456eSMiklos Szeredi 	uint32_t	ctimensec;
2734c82456eSMiklos Szeredi 	uint32_t	mode;
2744c82456eSMiklos Szeredi 	uint32_t	nlink;
2754c82456eSMiklos Szeredi 	uint32_t	uid;
2764c82456eSMiklos Szeredi 	uint32_t	gid;
2774c82456eSMiklos Szeredi 	uint32_t	rdev;
2784c82456eSMiklos Szeredi 	uint32_t	blksize;
279c6ff213fSMax Reitz 	uint32_t	flags;
280607ca46eSDavid Howells };
281607ca46eSDavid Howells 
282ba58a37cSMiklos Szeredi /*
283ba58a37cSMiklos Szeredi  * The following structures are bit-for-bit compatible with the statx(2) ABI in
284ba58a37cSMiklos Szeredi  * Linux.
285ba58a37cSMiklos Szeredi  */
286ba58a37cSMiklos Szeredi struct fuse_sx_time {
287ba58a37cSMiklos Szeredi 	int64_t		tv_sec;
288ba58a37cSMiklos Szeredi 	uint32_t	tv_nsec;
289ba58a37cSMiklos Szeredi 	int32_t		__reserved;
290ba58a37cSMiklos Szeredi };
291ba58a37cSMiklos Szeredi 
292ba58a37cSMiklos Szeredi struct fuse_statx {
293ba58a37cSMiklos Szeredi 	uint32_t	mask;
294ba58a37cSMiklos Szeredi 	uint32_t	blksize;
295ba58a37cSMiklos Szeredi 	uint64_t	attributes;
296ba58a37cSMiklos Szeredi 	uint32_t	nlink;
297ba58a37cSMiklos Szeredi 	uint32_t	uid;
298ba58a37cSMiklos Szeredi 	uint32_t	gid;
299ba58a37cSMiklos Szeredi 	uint16_t	mode;
300ba58a37cSMiklos Szeredi 	uint16_t	__spare0[1];
301ba58a37cSMiklos Szeredi 	uint64_t	ino;
302ba58a37cSMiklos Szeredi 	uint64_t	size;
303ba58a37cSMiklos Szeredi 	uint64_t	blocks;
304ba58a37cSMiklos Szeredi 	uint64_t	attributes_mask;
305ba58a37cSMiklos Szeredi 	struct fuse_sx_time	atime;
306ba58a37cSMiklos Szeredi 	struct fuse_sx_time	btime;
307ba58a37cSMiklos Szeredi 	struct fuse_sx_time	ctime;
308ba58a37cSMiklos Szeredi 	struct fuse_sx_time	mtime;
309ba58a37cSMiklos Szeredi 	uint32_t	rdev_major;
310ba58a37cSMiklos Szeredi 	uint32_t	rdev_minor;
311ba58a37cSMiklos Szeredi 	uint32_t	dev_major;
312ba58a37cSMiklos Szeredi 	uint32_t	dev_minor;
313ba58a37cSMiklos Szeredi 	uint64_t	__spare2[14];
314ba58a37cSMiklos Szeredi };
315ba58a37cSMiklos Szeredi 
316607ca46eSDavid Howells struct fuse_kstatfs {
3174c82456eSMiklos Szeredi 	uint64_t	blocks;
3184c82456eSMiklos Szeredi 	uint64_t	bfree;
3194c82456eSMiklos Szeredi 	uint64_t	bavail;
3204c82456eSMiklos Szeredi 	uint64_t	files;
3214c82456eSMiklos Szeredi 	uint64_t	ffree;
3224c82456eSMiklos Szeredi 	uint32_t	bsize;
3234c82456eSMiklos Szeredi 	uint32_t	namelen;
3244c82456eSMiklos Szeredi 	uint32_t	frsize;
3254c82456eSMiklos Szeredi 	uint32_t	padding;
3264c82456eSMiklos Szeredi 	uint32_t	spare[6];
327607ca46eSDavid Howells };
328607ca46eSDavid Howells 
329607ca46eSDavid Howells struct fuse_file_lock {
3304c82456eSMiklos Szeredi 	uint64_t	start;
3314c82456eSMiklos Szeredi 	uint64_t	end;
3324c82456eSMiklos Szeredi 	uint32_t	type;
3334c82456eSMiklos Szeredi 	uint32_t	pid; /* tgid */
334607ca46eSDavid Howells };
335607ca46eSDavid Howells 
336607ca46eSDavid Howells /**
337607ca46eSDavid Howells  * Bitmasks for fuse_setattr_in.valid
338607ca46eSDavid Howells  */
339607ca46eSDavid Howells #define FATTR_MODE	(1 << 0)
340607ca46eSDavid Howells #define FATTR_UID	(1 << 1)
341607ca46eSDavid Howells #define FATTR_GID	(1 << 2)
342607ca46eSDavid Howells #define FATTR_SIZE	(1 << 3)
343607ca46eSDavid Howells #define FATTR_ATIME	(1 << 4)
344607ca46eSDavid Howells #define FATTR_MTIME	(1 << 5)
345607ca46eSDavid Howells #define FATTR_FH	(1 << 6)
346607ca46eSDavid Howells #define FATTR_ATIME_NOW	(1 << 7)
347607ca46eSDavid Howells #define FATTR_MTIME_NOW	(1 << 8)
348607ca46eSDavid Howells #define FATTR_LOCKOWNER	(1 << 9)
349ab9e13f7SMaxim Patlasov #define FATTR_CTIME	(1 << 10)
35031792161SVivek Goyal #define FATTR_KILL_SUIDGID	(1 << 11)
351607ca46eSDavid Howells 
352607ca46eSDavid Howells /**
353607ca46eSDavid Howells  * Flags returned by the OPEN request
354607ca46eSDavid Howells  *
355607ca46eSDavid Howells  * FOPEN_DIRECT_IO: bypass page cache for this open file
356607ca46eSDavid Howells  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
357607ca46eSDavid Howells  * FOPEN_NONSEEKABLE: the file is not seekable
3586433b899SMiklos Szeredi  * FOPEN_CACHE_DIR: allow caching this directory
359bbd84f33SKirill Smelkov  * FOPEN_STREAM: the file is stream-like (no file position at all)
360a390ccb3SAmir Goldstein  * FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE)
36115352405SDharmendra Singh  * FOPEN_PARALLEL_DIRECT_WRITES: Allow concurrent direct writes on the same inode
3627dc4e97aSAmir Goldstein  * FOPEN_PASSTHROUGH: passthrough read/write io for this open file
363607ca46eSDavid Howells  */
364607ca46eSDavid Howells #define FOPEN_DIRECT_IO		(1 << 0)
365607ca46eSDavid Howells #define FOPEN_KEEP_CACHE	(1 << 1)
366607ca46eSDavid Howells #define FOPEN_NONSEEKABLE	(1 << 2)
3676433b899SMiklos Szeredi #define FOPEN_CACHE_DIR		(1 << 3)
368bbd84f33SKirill Smelkov #define FOPEN_STREAM		(1 << 4)
369a390ccb3SAmir Goldstein #define FOPEN_NOFLUSH		(1 << 5)
37015352405SDharmendra Singh #define FOPEN_PARALLEL_DIRECT_WRITES	(1 << 6)
3717dc4e97aSAmir Goldstein #define FOPEN_PASSTHROUGH	(1 << 7)
372607ca46eSDavid Howells 
373607ca46eSDavid Howells /**
374607ca46eSDavid Howells  * INIT request/reply flags
375607ca46eSDavid Howells  *
376607ca46eSDavid Howells  * FUSE_ASYNC_READ: asynchronous read requests
377607ca46eSDavid Howells  * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
378607ca46eSDavid Howells  * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
379607ca46eSDavid Howells  * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
380607ca46eSDavid Howells  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
381607ca46eSDavid Howells  * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
382607ca46eSDavid Howells  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
383607ca46eSDavid Howells  * FUSE_SPLICE_WRITE: kernel supports splice write on the device
384607ca46eSDavid Howells  * FUSE_SPLICE_MOVE: kernel supports splice move on the device
385607ca46eSDavid Howells  * FUSE_SPLICE_READ: kernel supports splice read on the device
386607ca46eSDavid Howells  * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
387607ca46eSDavid Howells  * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
388607ca46eSDavid Howells  * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
389634734b6SEric Wong  * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
390634734b6SEric Wong  * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
39160b9df7aSMiklos Szeredi  * FUSE_ASYNC_DIO: asynchronous direct I/O submission
3924d99ff8fSPavel Emelyanov  * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
393d7afaec0SAndrew Gallagher  * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
3945c672ab3SMiklos Szeredi  * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
3955e940c1dSMiklos Szeredi  * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
39660bcc88aSSeth Forshee  * FUSE_POSIX_ACL: filesystem supports posix acls
3973b7008b2SSzymon Lukasz  * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
3985da784ccSConstantine Shulyupin  * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
3995571f1e6SDan Schatzberg  * FUSE_CACHE_SYMLINKS: cache READLINK responses
400d9a9ea94SChad Austin  * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
401ad2ba64dSKirill Smelkov  * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
402fd1a1dc6SStefan Hajnoczi  * FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for
403fd1a1dc6SStefan Hajnoczi  *		       foffset and moffset fields in struct
404fd1a1dc6SStefan Hajnoczi  *		       fuse_setupmapping_out and fuse_removemapping_one.
405c6ff213fSMax Reitz  * FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts
40663f9909fSVivek Goyal  * FUSE_HANDLE_KILLPRIV_V2: fs kills suid/sgid/cap on write/chown/trunc.
40763f9909fSVivek Goyal  *			Upon write/truncate suid/sgid is only killed if caller
40863f9909fSVivek Goyal  *			does not have CAP_FSETID. Additionally upon
40963f9909fSVivek Goyal  *			write/truncate sgid is killed only if file has group
41063f9909fSVivek Goyal  *			execute permission. (Same as Linux VFS behavior).
41152a4c95fSVivek Goyal  * FUSE_SETXATTR_EXT:	Server supports extended struct fuse_setxattr_in
41253db2893SMiklos Szeredi  * FUSE_INIT_EXT: extended fuse_init_in request
41353db2893SMiklos Szeredi  * FUSE_INIT_RESERVED: reserved, do not use
4143e2b6fdbSVivek Goyal  * FUSE_SECURITY_CTX:	add security context to create, mkdir, symlink, and
4153e2b6fdbSVivek Goyal  *			mknod
41698046f74SJeffle Xu  * FUSE_HAS_INODE_DAX:  use per inode DAX
4178ed7cb3fSMiklos Szeredi  * FUSE_CREATE_SUPP_GROUP: add supplementary group info to create, mkdir,
4188ed7cb3fSMiklos Szeredi  *			symlink and mknod (single group that matches parent)
4195cadfbd5SMiklos Szeredi  * FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation
420c55e0a55STyler Fanelli  * FUSE_DIRECT_IO_ALLOW_MMAP: allow shared mmap in FOPEN_DIRECT_IO mode.
421e022f6a1SJingbo Xu  * FUSE_NO_EXPORT_SUPPORT: explicitly disable export support
422*9e7f5296SZhao Chen  * FUSE_HAS_RESEND: kernel supports resending pending requests, and the high bit
423*9e7f5296SZhao Chen  *		    of the request ID indicates resend requests
424607ca46eSDavid Howells  */
425607ca46eSDavid Howells #define FUSE_ASYNC_READ		(1 << 0)
426607ca46eSDavid Howells #define FUSE_POSIX_LOCKS	(1 << 1)
427607ca46eSDavid Howells #define FUSE_FILE_OPS		(1 << 2)
428607ca46eSDavid Howells #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
429607ca46eSDavid Howells #define FUSE_EXPORT_SUPPORT	(1 << 4)
430607ca46eSDavid Howells #define FUSE_BIG_WRITES		(1 << 5)
431607ca46eSDavid Howells #define FUSE_DONT_MASK		(1 << 6)
432607ca46eSDavid Howells #define FUSE_SPLICE_WRITE	(1 << 7)
433607ca46eSDavid Howells #define FUSE_SPLICE_MOVE	(1 << 8)
434607ca46eSDavid Howells #define FUSE_SPLICE_READ	(1 << 9)
435607ca46eSDavid Howells #define FUSE_FLOCK_LOCKS	(1 << 10)
436607ca46eSDavid Howells #define FUSE_HAS_IOCTL_DIR	(1 << 11)
437607ca46eSDavid Howells #define FUSE_AUTO_INVAL_DATA	(1 << 12)
4380b05b183SAnand V. Avati #define FUSE_DO_READDIRPLUS	(1 << 13)
439634734b6SEric Wong #define FUSE_READDIRPLUS_AUTO	(1 << 14)
44060b9df7aSMiklos Szeredi #define FUSE_ASYNC_DIO		(1 << 15)
4414d99ff8fSPavel Emelyanov #define FUSE_WRITEBACK_CACHE	(1 << 16)
442d7afaec0SAndrew Gallagher #define FUSE_NO_OPEN_SUPPORT	(1 << 17)
4435c672ab3SMiklos Szeredi #define FUSE_PARALLEL_DIROPS    (1 << 18)
4445e940c1dSMiklos Szeredi #define FUSE_HANDLE_KILLPRIV	(1 << 19)
44560bcc88aSSeth Forshee #define FUSE_POSIX_ACL		(1 << 20)
4463b7008b2SSzymon Lukasz #define FUSE_ABORT_ERROR	(1 << 21)
4475da784ccSConstantine Shulyupin #define FUSE_MAX_PAGES		(1 << 22)
4485571f1e6SDan Schatzberg #define FUSE_CACHE_SYMLINKS	(1 << 23)
449d9a9ea94SChad Austin #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
450ad2ba64dSKirill Smelkov #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
451c4bb667eSDr. David Alan Gilbert #define FUSE_MAP_ALIGNMENT	(1 << 26)
452c6ff213fSMax Reitz #define FUSE_SUBMOUNTS		(1 << 27)
45363f9909fSVivek Goyal #define FUSE_HANDLE_KILLPRIV_V2	(1 << 28)
45452a4c95fSVivek Goyal #define FUSE_SETXATTR_EXT	(1 << 29)
45553db2893SMiklos Szeredi #define FUSE_INIT_EXT		(1 << 30)
45653db2893SMiklos Szeredi #define FUSE_INIT_RESERVED	(1 << 31)
45753db2893SMiklos Szeredi /* bits 32..63 get shifted down 32 bits into the flags2 field */
4583e2b6fdbSVivek Goyal #define FUSE_SECURITY_CTX	(1ULL << 32)
45998046f74SJeffle Xu #define FUSE_HAS_INODE_DAX	(1ULL << 33)
4608ed7cb3fSMiklos Szeredi #define FUSE_CREATE_SUPP_GROUP	(1ULL << 34)
4615cadfbd5SMiklos Szeredi #define FUSE_HAS_EXPIRE_ONLY	(1ULL << 35)
462c55e0a55STyler Fanelli #define FUSE_DIRECT_IO_ALLOW_MMAP (1ULL << 36)
4637dc4e97aSAmir Goldstein #define FUSE_PASSTHROUGH	(1ULL << 37)
464e022f6a1SJingbo Xu #define FUSE_NO_EXPORT_SUPPORT	(1ULL << 38)
465*9e7f5296SZhao Chen #define FUSE_HAS_RESEND		(1ULL << 39)
466c55e0a55STyler Fanelli 
467c55e0a55STyler Fanelli /* Obsolete alias for FUSE_DIRECT_IO_ALLOW_MMAP */
468c55e0a55STyler Fanelli #define FUSE_DIRECT_IO_RELAX	FUSE_DIRECT_IO_ALLOW_MMAP
469607ca46eSDavid Howells 
470607ca46eSDavid Howells /**
471607ca46eSDavid Howells  * CUSE INIT request/reply flags
472607ca46eSDavid Howells  *
473607ca46eSDavid Howells  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
474607ca46eSDavid Howells  */
475607ca46eSDavid Howells #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
476607ca46eSDavid Howells 
477607ca46eSDavid Howells /**
478607ca46eSDavid Howells  * Release flags
479607ca46eSDavid Howells  */
480607ca46eSDavid Howells #define FUSE_RELEASE_FLUSH	(1 << 0)
481607ca46eSDavid Howells #define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
482607ca46eSDavid Howells 
483607ca46eSDavid Howells /**
484607ca46eSDavid Howells  * Getattr flags
485607ca46eSDavid Howells  */
486607ca46eSDavid Howells #define FUSE_GETATTR_FH		(1 << 0)
487607ca46eSDavid Howells 
488607ca46eSDavid Howells /**
489607ca46eSDavid Howells  * Lock flags
490607ca46eSDavid Howells  */
491607ca46eSDavid Howells #define FUSE_LK_FLOCK		(1 << 0)
492607ca46eSDavid Howells 
493607ca46eSDavid Howells /**
494607ca46eSDavid Howells  * WRITE flags
495607ca46eSDavid Howells  *
496607ca46eSDavid Howells  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
497607ca46eSDavid Howells  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
49810c52c84SMiklos Szeredi  * FUSE_WRITE_KILL_SUIDGID: kill suid and sgid bits
499607ca46eSDavid Howells  */
500607ca46eSDavid Howells #define FUSE_WRITE_CACHE	(1 << 0)
501607ca46eSDavid Howells #define FUSE_WRITE_LOCKOWNER	(1 << 1)
50210c52c84SMiklos Szeredi #define FUSE_WRITE_KILL_SUIDGID (1 << 2)
50310c52c84SMiklos Szeredi 
50410c52c84SMiklos Szeredi /* Obsolete alias; this flag implies killing suid/sgid only. */
50510c52c84SMiklos Szeredi #define FUSE_WRITE_KILL_PRIV	FUSE_WRITE_KILL_SUIDGID
506607ca46eSDavid Howells 
507607ca46eSDavid Howells /**
508607ca46eSDavid Howells  * Read flags
509607ca46eSDavid Howells  */
510607ca46eSDavid Howells #define FUSE_READ_LOCKOWNER	(1 << 1)
511607ca46eSDavid Howells 
512607ca46eSDavid Howells /**
513607ca46eSDavid Howells  * Ioctl flags
514607ca46eSDavid Howells  *
515607ca46eSDavid Howells  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
516607ca46eSDavid Howells  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
517607ca46eSDavid Howells  * FUSE_IOCTL_RETRY: retry with new iovecs
518607ca46eSDavid Howells  * FUSE_IOCTL_32BIT: 32bit ioctl
519607ca46eSDavid Howells  * FUSE_IOCTL_DIR: is a directory
5206407f44aSIan Abbott  * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t)
521607ca46eSDavid Howells  *
522607ca46eSDavid Howells  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
523607ca46eSDavid Howells  */
524607ca46eSDavid Howells #define FUSE_IOCTL_COMPAT	(1 << 0)
525607ca46eSDavid Howells #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
526607ca46eSDavid Howells #define FUSE_IOCTL_RETRY	(1 << 2)
527607ca46eSDavid Howells #define FUSE_IOCTL_32BIT	(1 << 3)
528607ca46eSDavid Howells #define FUSE_IOCTL_DIR		(1 << 4)
5296407f44aSIan Abbott #define FUSE_IOCTL_COMPAT_X32	(1 << 5)
530607ca46eSDavid Howells 
531607ca46eSDavid Howells #define FUSE_IOCTL_MAX_IOV	256
532607ca46eSDavid Howells 
533607ca46eSDavid Howells /**
534607ca46eSDavid Howells  * Poll flags
535607ca46eSDavid Howells  *
536607ca46eSDavid Howells  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
537607ca46eSDavid Howells  */
538607ca46eSDavid Howells #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
539607ca46eSDavid Howells 
540154603feSAlan Somers /**
541154603feSAlan Somers  * Fsync flags
542154603feSAlan Somers  *
543154603feSAlan Somers  * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata
544154603feSAlan Somers  */
545154603feSAlan Somers #define FUSE_FSYNC_FDATASYNC	(1 << 0)
546154603feSAlan Somers 
547c6ff213fSMax Reitz /**
548c6ff213fSMax Reitz  * fuse_attr flags
549c6ff213fSMax Reitz  *
550c6ff213fSMax Reitz  * FUSE_ATTR_SUBMOUNT: Object is a submount root
55198046f74SJeffle Xu  * FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode
552c6ff213fSMax Reitz  */
553c6ff213fSMax Reitz #define FUSE_ATTR_SUBMOUNT      (1 << 0)
55498046f74SJeffle Xu #define FUSE_ATTR_DAX		(1 << 1)
555c6ff213fSMax Reitz 
556643a666aSVivek Goyal /**
557643a666aSVivek Goyal  * Open flags
558643a666aSVivek Goyal  * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable
559643a666aSVivek Goyal  */
560643a666aSVivek Goyal #define FUSE_OPEN_KILL_SUIDGID	(1 << 0)
561643a666aSVivek Goyal 
562550a7d3bSVivek Goyal /**
563550a7d3bSVivek Goyal  * setxattr flags
564550a7d3bSVivek Goyal  * FUSE_SETXATTR_ACL_KILL_SGID: Clear SGID when system.posix_acl_access is set
565550a7d3bSVivek Goyal  */
566550a7d3bSVivek Goyal #define FUSE_SETXATTR_ACL_KILL_SGID	(1 << 0)
567550a7d3bSVivek Goyal 
5684f8d3702SMiklos Szeredi /**
5694f8d3702SMiklos Szeredi  * notify_inval_entry flags
5704f8d3702SMiklos Szeredi  * FUSE_EXPIRE_ONLY
5714f8d3702SMiklos Szeredi  */
5724f8d3702SMiklos Szeredi #define FUSE_EXPIRE_ONLY		(1 << 0)
5734f8d3702SMiklos Szeredi 
57415d937d7SMiklos Szeredi /**
57515d937d7SMiklos Szeredi  * extension type
57615d937d7SMiklos Szeredi  * FUSE_MAX_NR_SECCTX: maximum value of &fuse_secctx_header.nr_secctx
5778ed7cb3fSMiklos Szeredi  * FUSE_EXT_GROUPS: &fuse_supp_groups extension
57815d937d7SMiklos Szeredi  */
57915d937d7SMiklos Szeredi enum fuse_ext_type {
58015d937d7SMiklos Szeredi 	/* Types 0..31 are reserved for fuse_secctx_header */
58115d937d7SMiklos Szeredi 	FUSE_MAX_NR_SECCTX	= 31,
5828ed7cb3fSMiklos Szeredi 	FUSE_EXT_GROUPS		= 32,
58315d937d7SMiklos Szeredi };
58415d937d7SMiklos Szeredi 
585607ca46eSDavid Howells enum fuse_opcode {
586607ca46eSDavid Howells 	FUSE_LOOKUP		= 1,
587607ca46eSDavid Howells 	FUSE_FORGET		= 2,  /* no reply */
588607ca46eSDavid Howells 	FUSE_GETATTR		= 3,
589607ca46eSDavid Howells 	FUSE_SETATTR		= 4,
590607ca46eSDavid Howells 	FUSE_READLINK		= 5,
591607ca46eSDavid Howells 	FUSE_SYMLINK		= 6,
592607ca46eSDavid Howells 	FUSE_MKNOD		= 8,
593607ca46eSDavid Howells 	FUSE_MKDIR		= 9,
594607ca46eSDavid Howells 	FUSE_UNLINK		= 10,
595607ca46eSDavid Howells 	FUSE_RMDIR		= 11,
596607ca46eSDavid Howells 	FUSE_RENAME		= 12,
597607ca46eSDavid Howells 	FUSE_LINK		= 13,
598607ca46eSDavid Howells 	FUSE_OPEN		= 14,
599607ca46eSDavid Howells 	FUSE_READ		= 15,
600607ca46eSDavid Howells 	FUSE_WRITE		= 16,
601607ca46eSDavid Howells 	FUSE_STATFS		= 17,
602607ca46eSDavid Howells 	FUSE_RELEASE		= 18,
603607ca46eSDavid Howells 	FUSE_FSYNC		= 20,
604607ca46eSDavid Howells 	FUSE_SETXATTR		= 21,
605607ca46eSDavid Howells 	FUSE_GETXATTR		= 22,
606607ca46eSDavid Howells 	FUSE_LISTXATTR		= 23,
607607ca46eSDavid Howells 	FUSE_REMOVEXATTR	= 24,
608607ca46eSDavid Howells 	FUSE_FLUSH		= 25,
609607ca46eSDavid Howells 	FUSE_INIT		= 26,
610607ca46eSDavid Howells 	FUSE_OPENDIR		= 27,
611607ca46eSDavid Howells 	FUSE_READDIR		= 28,
612607ca46eSDavid Howells 	FUSE_RELEASEDIR		= 29,
613607ca46eSDavid Howells 	FUSE_FSYNCDIR		= 30,
614607ca46eSDavid Howells 	FUSE_GETLK		= 31,
615607ca46eSDavid Howells 	FUSE_SETLK		= 32,
616607ca46eSDavid Howells 	FUSE_SETLKW		= 33,
617607ca46eSDavid Howells 	FUSE_ACCESS		= 34,
618607ca46eSDavid Howells 	FUSE_CREATE		= 35,
619607ca46eSDavid Howells 	FUSE_INTERRUPT		= 36,
620607ca46eSDavid Howells 	FUSE_BMAP		= 37,
621607ca46eSDavid Howells 	FUSE_DESTROY		= 38,
622607ca46eSDavid Howells 	FUSE_IOCTL		= 39,
623607ca46eSDavid Howells 	FUSE_POLL		= 40,
624607ca46eSDavid Howells 	FUSE_NOTIFY_REPLY	= 41,
625607ca46eSDavid Howells 	FUSE_BATCH_FORGET	= 42,
626607ca46eSDavid Howells 	FUSE_FALLOCATE		= 43,
6270b05b183SAnand V. Avati 	FUSE_READDIRPLUS	= 44,
6281560c974SMiklos Szeredi 	FUSE_RENAME2		= 45,
6290b5da8dbSRavishankar N 	FUSE_LSEEK		= 46,
63088bc7d50SNiels de Vos 	FUSE_COPY_FILE_RANGE	= 47,
631c4bb667eSDr. David Alan Gilbert 	FUSE_SETUPMAPPING	= 48,
632c4bb667eSDr. David Alan Gilbert 	FUSE_REMOVEMAPPING	= 49,
6332d82ab25SGreg Kurz 	FUSE_SYNCFS		= 50,
6347d375390SMiklos Szeredi 	FUSE_TMPFILE		= 51,
635ba58a37cSMiklos Szeredi 	FUSE_STATX		= 52,
636607ca46eSDavid Howells 
637607ca46eSDavid Howells 	/* CUSE specific operations */
638607ca46eSDavid Howells 	CUSE_INIT		= 4096,
639501ae8ecSMichael S. Tsirkin 
640501ae8ecSMichael S. Tsirkin 	/* Reserved opcodes: helpful to detect structure endian-ness */
641501ae8ecSMichael S. Tsirkin 	CUSE_INIT_BSWAP_RESERVED	= 1048576,	/* CUSE_INIT << 8 */
642501ae8ecSMichael S. Tsirkin 	FUSE_INIT_BSWAP_RESERVED	= 436207616,	/* FUSE_INIT << 24 */
643607ca46eSDavid Howells };
644607ca46eSDavid Howells 
645607ca46eSDavid Howells enum fuse_notify_code {
646607ca46eSDavid Howells 	FUSE_NOTIFY_POLL   = 1,
647607ca46eSDavid Howells 	FUSE_NOTIFY_INVAL_INODE = 2,
648607ca46eSDavid Howells 	FUSE_NOTIFY_INVAL_ENTRY = 3,
649607ca46eSDavid Howells 	FUSE_NOTIFY_STORE = 4,
650607ca46eSDavid Howells 	FUSE_NOTIFY_RETRIEVE = 5,
651607ca46eSDavid Howells 	FUSE_NOTIFY_DELETE = 6,
652760eac73SZhao Chen 	FUSE_NOTIFY_RESEND = 7,
653607ca46eSDavid Howells 	FUSE_NOTIFY_CODE_MAX,
654607ca46eSDavid Howells };
655607ca46eSDavid Howells 
656607ca46eSDavid Howells /* The read buffer is required to be at least 8k, but may be much larger */
657607ca46eSDavid Howells #define FUSE_MIN_READ_BUFFER 8192
658607ca46eSDavid Howells 
659607ca46eSDavid Howells #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
660607ca46eSDavid Howells 
661607ca46eSDavid Howells struct fuse_entry_out {
6624c82456eSMiklos Szeredi 	uint64_t	nodeid;		/* Inode ID */
6634c82456eSMiklos Szeredi 	uint64_t	generation;	/* Inode generation: nodeid:gen must
664607ca46eSDavid Howells 					   be unique for the fs's lifetime */
6654c82456eSMiklos Szeredi 	uint64_t	entry_valid;	/* Cache timeout for the name */
6664c82456eSMiklos Szeredi 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
6674c82456eSMiklos Szeredi 	uint32_t	entry_valid_nsec;
6684c82456eSMiklos Szeredi 	uint32_t	attr_valid_nsec;
669607ca46eSDavid Howells 	struct fuse_attr attr;
670607ca46eSDavid Howells };
671607ca46eSDavid Howells 
672607ca46eSDavid Howells struct fuse_forget_in {
6734c82456eSMiklos Szeredi 	uint64_t	nlookup;
674607ca46eSDavid Howells };
675607ca46eSDavid Howells 
676607ca46eSDavid Howells struct fuse_forget_one {
6774c82456eSMiklos Szeredi 	uint64_t	nodeid;
6784c82456eSMiklos Szeredi 	uint64_t	nlookup;
679607ca46eSDavid Howells };
680607ca46eSDavid Howells 
681607ca46eSDavid Howells struct fuse_batch_forget_in {
6824c82456eSMiklos Szeredi 	uint32_t	count;
6834c82456eSMiklos Szeredi 	uint32_t	dummy;
684607ca46eSDavid Howells };
685607ca46eSDavid Howells 
686607ca46eSDavid Howells struct fuse_getattr_in {
6874c82456eSMiklos Szeredi 	uint32_t	getattr_flags;
6884c82456eSMiklos Szeredi 	uint32_t	dummy;
6894c82456eSMiklos Szeredi 	uint64_t	fh;
690607ca46eSDavid Howells };
691607ca46eSDavid Howells 
692607ca46eSDavid Howells #define FUSE_COMPAT_ATTR_OUT_SIZE 96
693607ca46eSDavid Howells 
694607ca46eSDavid Howells struct fuse_attr_out {
6954c82456eSMiklos Szeredi 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
6964c82456eSMiklos Szeredi 	uint32_t	attr_valid_nsec;
6974c82456eSMiklos Szeredi 	uint32_t	dummy;
698607ca46eSDavid Howells 	struct fuse_attr attr;
699607ca46eSDavid Howells };
700607ca46eSDavid Howells 
701ba58a37cSMiklos Szeredi struct fuse_statx_in {
702ba58a37cSMiklos Szeredi 	uint32_t	getattr_flags;
703ba58a37cSMiklos Szeredi 	uint32_t	reserved;
704ba58a37cSMiklos Szeredi 	uint64_t	fh;
705ba58a37cSMiklos Szeredi 	uint32_t	sx_flags;
706ba58a37cSMiklos Szeredi 	uint32_t	sx_mask;
707ba58a37cSMiklos Szeredi };
708ba58a37cSMiklos Szeredi 
709ba58a37cSMiklos Szeredi struct fuse_statx_out {
710ba58a37cSMiklos Szeredi 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
711ba58a37cSMiklos Szeredi 	uint32_t	attr_valid_nsec;
712ba58a37cSMiklos Szeredi 	uint32_t	flags;
713ba58a37cSMiklos Szeredi 	uint64_t	spare[2];
714ba58a37cSMiklos Szeredi 	struct fuse_statx stat;
715ba58a37cSMiklos Szeredi };
716ba58a37cSMiklos Szeredi 
717607ca46eSDavid Howells #define FUSE_COMPAT_MKNOD_IN_SIZE 8
718607ca46eSDavid Howells 
719607ca46eSDavid Howells struct fuse_mknod_in {
7204c82456eSMiklos Szeredi 	uint32_t	mode;
7214c82456eSMiklos Szeredi 	uint32_t	rdev;
7224c82456eSMiklos Szeredi 	uint32_t	umask;
7234c82456eSMiklos Szeredi 	uint32_t	padding;
724607ca46eSDavid Howells };
725607ca46eSDavid Howells 
726607ca46eSDavid Howells struct fuse_mkdir_in {
7274c82456eSMiklos Szeredi 	uint32_t	mode;
7284c82456eSMiklos Szeredi 	uint32_t	umask;
729607ca46eSDavid Howells };
730607ca46eSDavid Howells 
731607ca46eSDavid Howells struct fuse_rename_in {
7324c82456eSMiklos Szeredi 	uint64_t	newdir;
733607ca46eSDavid Howells };
734607ca46eSDavid Howells 
7351560c974SMiklos Szeredi struct fuse_rename2_in {
7361560c974SMiklos Szeredi 	uint64_t	newdir;
7371560c974SMiklos Szeredi 	uint32_t	flags;
7381560c974SMiklos Szeredi 	uint32_t	padding;
7391560c974SMiklos Szeredi };
7401560c974SMiklos Szeredi 
741607ca46eSDavid Howells struct fuse_link_in {
7424c82456eSMiklos Szeredi 	uint64_t	oldnodeid;
743607ca46eSDavid Howells };
744607ca46eSDavid Howells 
745607ca46eSDavid Howells struct fuse_setattr_in {
7464c82456eSMiklos Szeredi 	uint32_t	valid;
7474c82456eSMiklos Szeredi 	uint32_t	padding;
7484c82456eSMiklos Szeredi 	uint64_t	fh;
7494c82456eSMiklos Szeredi 	uint64_t	size;
7504c82456eSMiklos Szeredi 	uint64_t	lock_owner;
7514c82456eSMiklos Szeredi 	uint64_t	atime;
7524c82456eSMiklos Szeredi 	uint64_t	mtime;
753ab9e13f7SMaxim Patlasov 	uint64_t	ctime;
7544c82456eSMiklos Szeredi 	uint32_t	atimensec;
7554c82456eSMiklos Szeredi 	uint32_t	mtimensec;
756ab9e13f7SMaxim Patlasov 	uint32_t	ctimensec;
7574c82456eSMiklos Szeredi 	uint32_t	mode;
7584c82456eSMiklos Szeredi 	uint32_t	unused4;
7594c82456eSMiklos Szeredi 	uint32_t	uid;
7604c82456eSMiklos Szeredi 	uint32_t	gid;
7614c82456eSMiklos Szeredi 	uint32_t	unused5;
762607ca46eSDavid Howells };
763607ca46eSDavid Howells 
764607ca46eSDavid Howells struct fuse_open_in {
7654c82456eSMiklos Szeredi 	uint32_t	flags;
766643a666aSVivek Goyal 	uint32_t	open_flags;	/* FUSE_OPEN_... */
767607ca46eSDavid Howells };
768607ca46eSDavid Howells 
769607ca46eSDavid Howells struct fuse_create_in {
7704c82456eSMiklos Szeredi 	uint32_t	flags;
7714c82456eSMiklos Szeredi 	uint32_t	mode;
7724c82456eSMiklos Szeredi 	uint32_t	umask;
773643a666aSVivek Goyal 	uint32_t	open_flags;	/* FUSE_OPEN_... */
774607ca46eSDavid Howells };
775607ca46eSDavid Howells 
776607ca46eSDavid Howells struct fuse_open_out {
7774c82456eSMiklos Szeredi 	uint64_t	fh;
7784c82456eSMiklos Szeredi 	uint32_t	open_flags;
7797dc4e97aSAmir Goldstein 	int32_t		backing_id;
780607ca46eSDavid Howells };
781607ca46eSDavid Howells 
782607ca46eSDavid Howells struct fuse_release_in {
7834c82456eSMiklos Szeredi 	uint64_t	fh;
7844c82456eSMiklos Szeredi 	uint32_t	flags;
7854c82456eSMiklos Szeredi 	uint32_t	release_flags;
7864c82456eSMiklos Szeredi 	uint64_t	lock_owner;
787607ca46eSDavid Howells };
788607ca46eSDavid Howells 
789607ca46eSDavid Howells struct fuse_flush_in {
7904c82456eSMiklos Szeredi 	uint64_t	fh;
7914c82456eSMiklos Szeredi 	uint32_t	unused;
7924c82456eSMiklos Szeredi 	uint32_t	padding;
7934c82456eSMiklos Szeredi 	uint64_t	lock_owner;
794607ca46eSDavid Howells };
795607ca46eSDavid Howells 
796607ca46eSDavid Howells struct fuse_read_in {
7974c82456eSMiklos Szeredi 	uint64_t	fh;
7984c82456eSMiklos Szeredi 	uint64_t	offset;
7994c82456eSMiklos Szeredi 	uint32_t	size;
8004c82456eSMiklos Szeredi 	uint32_t	read_flags;
8014c82456eSMiklos Szeredi 	uint64_t	lock_owner;
8024c82456eSMiklos Szeredi 	uint32_t	flags;
8034c82456eSMiklos Szeredi 	uint32_t	padding;
804607ca46eSDavid Howells };
805607ca46eSDavid Howells 
806607ca46eSDavid Howells #define FUSE_COMPAT_WRITE_IN_SIZE 24
807607ca46eSDavid Howells 
808607ca46eSDavid Howells struct fuse_write_in {
8094c82456eSMiklos Szeredi 	uint64_t	fh;
8104c82456eSMiklos Szeredi 	uint64_t	offset;
8114c82456eSMiklos Szeredi 	uint32_t	size;
8124c82456eSMiklos Szeredi 	uint32_t	write_flags;
8134c82456eSMiklos Szeredi 	uint64_t	lock_owner;
8144c82456eSMiklos Szeredi 	uint32_t	flags;
8154c82456eSMiklos Szeredi 	uint32_t	padding;
816607ca46eSDavid Howells };
817607ca46eSDavid Howells 
818607ca46eSDavid Howells struct fuse_write_out {
8194c82456eSMiklos Szeredi 	uint32_t	size;
8204c82456eSMiklos Szeredi 	uint32_t	padding;
821607ca46eSDavid Howells };
822607ca46eSDavid Howells 
823607ca46eSDavid Howells #define FUSE_COMPAT_STATFS_SIZE 48
824607ca46eSDavid Howells 
825607ca46eSDavid Howells struct fuse_statfs_out {
826607ca46eSDavid Howells 	struct fuse_kstatfs st;
827607ca46eSDavid Howells };
828607ca46eSDavid Howells 
829607ca46eSDavid Howells struct fuse_fsync_in {
8304c82456eSMiklos Szeredi 	uint64_t	fh;
8314c82456eSMiklos Szeredi 	uint32_t	fsync_flags;
8324c82456eSMiklos Szeredi 	uint32_t	padding;
833607ca46eSDavid Howells };
834607ca46eSDavid Howells 
83552a4c95fSVivek Goyal #define FUSE_COMPAT_SETXATTR_IN_SIZE 8
83652a4c95fSVivek Goyal 
837607ca46eSDavid Howells struct fuse_setxattr_in {
8384c82456eSMiklos Szeredi 	uint32_t	size;
8394c82456eSMiklos Szeredi 	uint32_t	flags;
84052a4c95fSVivek Goyal 	uint32_t	setxattr_flags;
84152a4c95fSVivek Goyal 	uint32_t	padding;
842607ca46eSDavid Howells };
843607ca46eSDavid Howells 
844607ca46eSDavid Howells struct fuse_getxattr_in {
8454c82456eSMiklos Szeredi 	uint32_t	size;
8464c82456eSMiklos Szeredi 	uint32_t	padding;
847607ca46eSDavid Howells };
848607ca46eSDavid Howells 
849607ca46eSDavid Howells struct fuse_getxattr_out {
8504c82456eSMiklos Szeredi 	uint32_t	size;
8514c82456eSMiklos Szeredi 	uint32_t	padding;
852607ca46eSDavid Howells };
853607ca46eSDavid Howells 
854607ca46eSDavid Howells struct fuse_lk_in {
8554c82456eSMiklos Szeredi 	uint64_t	fh;
8564c82456eSMiklos Szeredi 	uint64_t	owner;
857607ca46eSDavid Howells 	struct fuse_file_lock lk;
8584c82456eSMiklos Szeredi 	uint32_t	lk_flags;
8594c82456eSMiklos Szeredi 	uint32_t	padding;
860607ca46eSDavid Howells };
861607ca46eSDavid Howells 
862607ca46eSDavid Howells struct fuse_lk_out {
863607ca46eSDavid Howells 	struct fuse_file_lock lk;
864607ca46eSDavid Howells };
865607ca46eSDavid Howells 
866607ca46eSDavid Howells struct fuse_access_in {
8674c82456eSMiklos Szeredi 	uint32_t	mask;
8684c82456eSMiklos Szeredi 	uint32_t	padding;
869607ca46eSDavid Howells };
870607ca46eSDavid Howells 
871607ca46eSDavid Howells struct fuse_init_in {
8724c82456eSMiklos Szeredi 	uint32_t	major;
8734c82456eSMiklos Szeredi 	uint32_t	minor;
8744c82456eSMiklos Szeredi 	uint32_t	max_readahead;
8754c82456eSMiklos Szeredi 	uint32_t	flags;
87653db2893SMiklos Szeredi 	uint32_t	flags2;
87753db2893SMiklos Szeredi 	uint32_t	unused[11];
878607ca46eSDavid Howells };
879607ca46eSDavid Howells 
880e27c9d38SMiklos Szeredi #define FUSE_COMPAT_INIT_OUT_SIZE 8
881e27c9d38SMiklos Szeredi #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
882e27c9d38SMiklos Szeredi 
883607ca46eSDavid Howells struct fuse_init_out {
8844c82456eSMiklos Szeredi 	uint32_t	major;
8854c82456eSMiklos Szeredi 	uint32_t	minor;
8864c82456eSMiklos Szeredi 	uint32_t	max_readahead;
8874c82456eSMiklos Szeredi 	uint32_t	flags;
8884c82456eSMiklos Szeredi 	uint16_t	max_background;
8894c82456eSMiklos Szeredi 	uint16_t	congestion_threshold;
8904c82456eSMiklos Szeredi 	uint32_t	max_write;
891e27c9d38SMiklos Szeredi 	uint32_t	time_gran;
8925da784ccSConstantine Shulyupin 	uint16_t	max_pages;
893c4bb667eSDr. David Alan Gilbert 	uint16_t	map_alignment;
89453db2893SMiklos Szeredi 	uint32_t	flags2;
8957dc4e97aSAmir Goldstein 	uint32_t	max_stack_depth;
8967dc4e97aSAmir Goldstein 	uint32_t	unused[6];
897607ca46eSDavid Howells };
898607ca46eSDavid Howells 
899607ca46eSDavid Howells #define CUSE_INIT_INFO_MAX 4096
900607ca46eSDavid Howells 
901607ca46eSDavid Howells struct cuse_init_in {
9024c82456eSMiklos Szeredi 	uint32_t	major;
9034c82456eSMiklos Szeredi 	uint32_t	minor;
9044c82456eSMiklos Szeredi 	uint32_t	unused;
9054c82456eSMiklos Szeredi 	uint32_t	flags;
906607ca46eSDavid Howells };
907607ca46eSDavid Howells 
908607ca46eSDavid Howells struct cuse_init_out {
9094c82456eSMiklos Szeredi 	uint32_t	major;
9104c82456eSMiklos Szeredi 	uint32_t	minor;
9114c82456eSMiklos Szeredi 	uint32_t	unused;
9124c82456eSMiklos Szeredi 	uint32_t	flags;
9134c82456eSMiklos Szeredi 	uint32_t	max_read;
9144c82456eSMiklos Szeredi 	uint32_t	max_write;
9154c82456eSMiklos Szeredi 	uint32_t	dev_major;		/* chardev major */
9164c82456eSMiklos Szeredi 	uint32_t	dev_minor;		/* chardev minor */
9174c82456eSMiklos Szeredi 	uint32_t	spare[10];
918607ca46eSDavid Howells };
919607ca46eSDavid Howells 
920607ca46eSDavid Howells struct fuse_interrupt_in {
9214c82456eSMiklos Szeredi 	uint64_t	unique;
922607ca46eSDavid Howells };
923607ca46eSDavid Howells 
924607ca46eSDavid Howells struct fuse_bmap_in {
9254c82456eSMiklos Szeredi 	uint64_t	block;
9264c82456eSMiklos Szeredi 	uint32_t	blocksize;
9274c82456eSMiklos Szeredi 	uint32_t	padding;
928607ca46eSDavid Howells };
929607ca46eSDavid Howells 
930607ca46eSDavid Howells struct fuse_bmap_out {
9314c82456eSMiklos Szeredi 	uint64_t	block;
932607ca46eSDavid Howells };
933607ca46eSDavid Howells 
934607ca46eSDavid Howells struct fuse_ioctl_in {
9354c82456eSMiklos Szeredi 	uint64_t	fh;
9364c82456eSMiklos Szeredi 	uint32_t	flags;
9374c82456eSMiklos Szeredi 	uint32_t	cmd;
9384c82456eSMiklos Szeredi 	uint64_t	arg;
9394c82456eSMiklos Szeredi 	uint32_t	in_size;
9404c82456eSMiklos Szeredi 	uint32_t	out_size;
941607ca46eSDavid Howells };
942607ca46eSDavid Howells 
943607ca46eSDavid Howells struct fuse_ioctl_iovec {
9444c82456eSMiklos Szeredi 	uint64_t	base;
9454c82456eSMiklos Szeredi 	uint64_t	len;
946607ca46eSDavid Howells };
947607ca46eSDavid Howells 
948607ca46eSDavid Howells struct fuse_ioctl_out {
9494c82456eSMiklos Szeredi 	int32_t		result;
9504c82456eSMiklos Szeredi 	uint32_t	flags;
9514c82456eSMiklos Szeredi 	uint32_t	in_iovs;
9524c82456eSMiklos Szeredi 	uint32_t	out_iovs;
953607ca46eSDavid Howells };
954607ca46eSDavid Howells 
955607ca46eSDavid Howells struct fuse_poll_in {
9564c82456eSMiklos Szeredi 	uint64_t	fh;
9574c82456eSMiklos Szeredi 	uint64_t	kh;
9584c82456eSMiklos Szeredi 	uint32_t	flags;
9594c82456eSMiklos Szeredi 	uint32_t	events;
960607ca46eSDavid Howells };
961607ca46eSDavid Howells 
962607ca46eSDavid Howells struct fuse_poll_out {
9634c82456eSMiklos Szeredi 	uint32_t	revents;
9644c82456eSMiklos Szeredi 	uint32_t	padding;
965607ca46eSDavid Howells };
966607ca46eSDavid Howells 
967607ca46eSDavid Howells struct fuse_notify_poll_wakeup_out {
9684c82456eSMiklos Szeredi 	uint64_t	kh;
969607ca46eSDavid Howells };
970607ca46eSDavid Howells 
971607ca46eSDavid Howells struct fuse_fallocate_in {
9724c82456eSMiklos Szeredi 	uint64_t	fh;
9734c82456eSMiklos Szeredi 	uint64_t	offset;
9744c82456eSMiklos Szeredi 	uint64_t	length;
9754c82456eSMiklos Szeredi 	uint32_t	mode;
9764c82456eSMiklos Szeredi 	uint32_t	padding;
977607ca46eSDavid Howells };
978607ca46eSDavid Howells 
979*9e7f5296SZhao Chen /**
980*9e7f5296SZhao Chen  * FUSE request unique ID flag
981*9e7f5296SZhao Chen  *
982*9e7f5296SZhao Chen  * Indicates whether this is a resend request. The receiver should handle this
983*9e7f5296SZhao Chen  * request accordingly.
984*9e7f5296SZhao Chen  */
985*9e7f5296SZhao Chen #define FUSE_UNIQUE_RESEND (1ULL << 63)
986*9e7f5296SZhao Chen 
987607ca46eSDavid Howells struct fuse_in_header {
9884c82456eSMiklos Szeredi 	uint32_t	len;
9894c82456eSMiklos Szeredi 	uint32_t	opcode;
9904c82456eSMiklos Szeredi 	uint64_t	unique;
9914c82456eSMiklos Szeredi 	uint64_t	nodeid;
9924c82456eSMiklos Szeredi 	uint32_t	uid;
9934c82456eSMiklos Szeredi 	uint32_t	gid;
9944c82456eSMiklos Szeredi 	uint32_t	pid;
99515d937d7SMiklos Szeredi 	uint16_t	total_extlen; /* length of extensions in 8byte units */
99615d937d7SMiklos Szeredi 	uint16_t	padding;
997607ca46eSDavid Howells };
998607ca46eSDavid Howells 
999607ca46eSDavid Howells struct fuse_out_header {
10004c82456eSMiklos Szeredi 	uint32_t	len;
10014c82456eSMiklos Szeredi 	int32_t		error;
10024c82456eSMiklos Szeredi 	uint64_t	unique;
1003607ca46eSDavid Howells };
1004607ca46eSDavid Howells 
1005607ca46eSDavid Howells struct fuse_dirent {
10064c82456eSMiklos Szeredi 	uint64_t	ino;
10074c82456eSMiklos Szeredi 	uint64_t	off;
10084c82456eSMiklos Szeredi 	uint32_t	namelen;
10094c82456eSMiklos Szeredi 	uint32_t	type;
1010607ca46eSDavid Howells 	char name[];
1011607ca46eSDavid Howells };
1012607ca46eSDavid Howells 
10133e2b6fdbSVivek Goyal /* Align variable length records to 64bit boundary */
10143e2b6fdbSVivek Goyal #define FUSE_REC_ALIGN(x) \
10154c82456eSMiklos Szeredi 	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
10163e2b6fdbSVivek Goyal 
10173e2b6fdbSVivek Goyal #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
10183e2b6fdbSVivek Goyal #define FUSE_DIRENT_ALIGN(x) FUSE_REC_ALIGN(x)
1019607ca46eSDavid Howells #define FUSE_DIRENT_SIZE(d) \
1020607ca46eSDavid Howells 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
1021607ca46eSDavid Howells 
10220b05b183SAnand V. Avati struct fuse_direntplus {
10230b05b183SAnand V. Avati 	struct fuse_entry_out entry_out;
10240b05b183SAnand V. Avati 	struct fuse_dirent dirent;
10250b05b183SAnand V. Avati };
10260b05b183SAnand V. Avati 
10270b05b183SAnand V. Avati #define FUSE_NAME_OFFSET_DIRENTPLUS \
10280b05b183SAnand V. Avati 	offsetof(struct fuse_direntplus, dirent.name)
10290b05b183SAnand V. Avati #define FUSE_DIRENTPLUS_SIZE(d) \
10300b05b183SAnand V. Avati 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
10310b05b183SAnand V. Avati 
1032607ca46eSDavid Howells struct fuse_notify_inval_inode_out {
10334c82456eSMiklos Szeredi 	uint64_t	ino;
10344c82456eSMiklos Szeredi 	int64_t		off;
10354c82456eSMiklos Szeredi 	int64_t		len;
1036607ca46eSDavid Howells };
1037607ca46eSDavid Howells 
1038607ca46eSDavid Howells struct fuse_notify_inval_entry_out {
10394c82456eSMiklos Szeredi 	uint64_t	parent;
10404c82456eSMiklos Szeredi 	uint32_t	namelen;
10414f8d3702SMiklos Szeredi 	uint32_t	flags;
1042607ca46eSDavid Howells };
1043607ca46eSDavid Howells 
1044607ca46eSDavid Howells struct fuse_notify_delete_out {
10454c82456eSMiklos Szeredi 	uint64_t	parent;
10464c82456eSMiklos Szeredi 	uint64_t	child;
10474c82456eSMiklos Szeredi 	uint32_t	namelen;
10484c82456eSMiklos Szeredi 	uint32_t	padding;
1049607ca46eSDavid Howells };
1050607ca46eSDavid Howells 
1051607ca46eSDavid Howells struct fuse_notify_store_out {
10524c82456eSMiklos Szeredi 	uint64_t	nodeid;
10534c82456eSMiklos Szeredi 	uint64_t	offset;
10544c82456eSMiklos Szeredi 	uint32_t	size;
10554c82456eSMiklos Szeredi 	uint32_t	padding;
1056607ca46eSDavid Howells };
1057607ca46eSDavid Howells 
1058607ca46eSDavid Howells struct fuse_notify_retrieve_out {
10594c82456eSMiklos Szeredi 	uint64_t	notify_unique;
10604c82456eSMiklos Szeredi 	uint64_t	nodeid;
10614c82456eSMiklos Szeredi 	uint64_t	offset;
10624c82456eSMiklos Szeredi 	uint32_t	size;
10634c82456eSMiklos Szeredi 	uint32_t	padding;
1064607ca46eSDavid Howells };
1065607ca46eSDavid Howells 
1066607ca46eSDavid Howells /* Matches the size of fuse_write_in */
1067607ca46eSDavid Howells struct fuse_notify_retrieve_in {
10684c82456eSMiklos Szeredi 	uint64_t	dummy1;
10694c82456eSMiklos Szeredi 	uint64_t	offset;
10704c82456eSMiklos Szeredi 	uint32_t	size;
10714c82456eSMiklos Szeredi 	uint32_t	dummy2;
10724c82456eSMiklos Szeredi 	uint64_t	dummy3;
10734c82456eSMiklos Szeredi 	uint64_t	dummy4;
1074607ca46eSDavid Howells };
1075607ca46eSDavid Howells 
107644350256SAmir Goldstein struct fuse_backing_map {
107744350256SAmir Goldstein 	int32_t		fd;
107844350256SAmir Goldstein 	uint32_t	flags;
107944350256SAmir Goldstein 	uint64_t	padding;
108044350256SAmir Goldstein };
108144350256SAmir Goldstein 
108200c570f4SMiklos Szeredi /* Device ioctls: */
1083f8425c93SAlessio Balsini #define FUSE_DEV_IOC_MAGIC		229
1084f8425c93SAlessio Balsini #define FUSE_DEV_IOC_CLONE		_IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
108544350256SAmir Goldstein #define FUSE_DEV_IOC_BACKING_OPEN	_IOW(FUSE_DEV_IOC_MAGIC, 1, \
108644350256SAmir Goldstein 					     struct fuse_backing_map)
108744350256SAmir Goldstein #define FUSE_DEV_IOC_BACKING_CLOSE	_IOW(FUSE_DEV_IOC_MAGIC, 2, uint32_t)
108800c570f4SMiklos Szeredi 
10890b5da8dbSRavishankar N struct fuse_lseek_in {
10900b5da8dbSRavishankar N 	uint64_t	fh;
10910b5da8dbSRavishankar N 	uint64_t	offset;
10920b5da8dbSRavishankar N 	uint32_t	whence;
10930b5da8dbSRavishankar N 	uint32_t	padding;
10940b5da8dbSRavishankar N };
10950b5da8dbSRavishankar N 
10960b5da8dbSRavishankar N struct fuse_lseek_out {
10970b5da8dbSRavishankar N 	uint64_t	offset;
10980b5da8dbSRavishankar N };
10990b5da8dbSRavishankar N 
110088bc7d50SNiels de Vos struct fuse_copy_file_range_in {
110188bc7d50SNiels de Vos 	uint64_t	fh_in;
110288bc7d50SNiels de Vos 	uint64_t	off_in;
110388bc7d50SNiels de Vos 	uint64_t	nodeid_out;
110488bc7d50SNiels de Vos 	uint64_t	fh_out;
110588bc7d50SNiels de Vos 	uint64_t	off_out;
110688bc7d50SNiels de Vos 	uint64_t	len;
110788bc7d50SNiels de Vos 	uint64_t	flags;
110888bc7d50SNiels de Vos };
110988bc7d50SNiels de Vos 
1110ceec02d4SVivek Goyal #define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
1111c2d0ad00SVivek Goyal #define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
1112ceec02d4SVivek Goyal struct fuse_setupmapping_in {
1113ceec02d4SVivek Goyal 	/* An already open handle */
1114ceec02d4SVivek Goyal 	uint64_t	fh;
1115ceec02d4SVivek Goyal 	/* Offset into the file to start the mapping */
1116ceec02d4SVivek Goyal 	uint64_t	foffset;
1117ceec02d4SVivek Goyal 	/* Length of mapping required */
1118ceec02d4SVivek Goyal 	uint64_t	len;
1119ceec02d4SVivek Goyal 	/* Flags, FUSE_SETUPMAPPING_FLAG_* */
1120ceec02d4SVivek Goyal 	uint64_t	flags;
1121ceec02d4SVivek Goyal 	/* Offset in Memory Window */
1122ceec02d4SVivek Goyal 	uint64_t	moffset;
1123ceec02d4SVivek Goyal };
1124ceec02d4SVivek Goyal 
1125ceec02d4SVivek Goyal struct fuse_removemapping_in {
1126ceec02d4SVivek Goyal 	/* number of fuse_removemapping_one follows */
1127ceec02d4SVivek Goyal 	uint32_t        count;
1128ceec02d4SVivek Goyal };
1129ceec02d4SVivek Goyal 
1130ceec02d4SVivek Goyal struct fuse_removemapping_one {
1131ceec02d4SVivek Goyal 	/* Offset into the dax window start the unmapping */
1132ceec02d4SVivek Goyal 	uint64_t        moffset;
1133ceec02d4SVivek Goyal 	/* Length of mapping required */
1134ceec02d4SVivek Goyal 	uint64_t	len;
1135ceec02d4SVivek Goyal };
1136ceec02d4SVivek Goyal 
1137ceec02d4SVivek Goyal #define FUSE_REMOVEMAPPING_MAX_ENTRY   \
1138ceec02d4SVivek Goyal 		(PAGE_SIZE / sizeof(struct fuse_removemapping_one))
1139ceec02d4SVivek Goyal 
11402d82ab25SGreg Kurz struct fuse_syncfs_in {
11412d82ab25SGreg Kurz 	uint64_t	padding;
11422d82ab25SGreg Kurz };
11432d82ab25SGreg Kurz 
11443e2b6fdbSVivek Goyal /*
11453e2b6fdbSVivek Goyal  * For each security context, send fuse_secctx with size of security context
11463e2b6fdbSVivek Goyal  * fuse_secctx will be followed by security context name and this in turn
11473e2b6fdbSVivek Goyal  * will be followed by actual context label.
11483e2b6fdbSVivek Goyal  * fuse_secctx, name, context
11493e2b6fdbSVivek Goyal  */
11503e2b6fdbSVivek Goyal struct fuse_secctx {
11513e2b6fdbSVivek Goyal 	uint32_t	size;
11523e2b6fdbSVivek Goyal 	uint32_t	padding;
11533e2b6fdbSVivek Goyal };
11543e2b6fdbSVivek Goyal 
11553e2b6fdbSVivek Goyal /*
11563e2b6fdbSVivek Goyal  * Contains the information about how many fuse_secctx structures are being
11573e2b6fdbSVivek Goyal  * sent and what's the total size of all security contexts (including
11583e2b6fdbSVivek Goyal  * size of fuse_secctx_header).
11593e2b6fdbSVivek Goyal  *
11603e2b6fdbSVivek Goyal  */
11613e2b6fdbSVivek Goyal struct fuse_secctx_header {
11623e2b6fdbSVivek Goyal 	uint32_t	size;
11633e2b6fdbSVivek Goyal 	uint32_t	nr_secctx;
11643e2b6fdbSVivek Goyal };
11653e2b6fdbSVivek Goyal 
116615d937d7SMiklos Szeredi /**
116715d937d7SMiklos Szeredi  * struct fuse_ext_header - extension header
116815d937d7SMiklos Szeredi  * @size: total size of this extension including this header
116915d937d7SMiklos Szeredi  * @type: type of extension
117015d937d7SMiklos Szeredi  *
117115d937d7SMiklos Szeredi  * This is made compatible with fuse_secctx_header by using type values >
117215d937d7SMiklos Szeredi  * FUSE_MAX_NR_SECCTX
117315d937d7SMiklos Szeredi  */
117415d937d7SMiklos Szeredi struct fuse_ext_header {
117515d937d7SMiklos Szeredi 	uint32_t	size;
117615d937d7SMiklos Szeredi 	uint32_t	type;
117715d937d7SMiklos Szeredi };
117815d937d7SMiklos Szeredi 
11798ed7cb3fSMiklos Szeredi /**
11808ed7cb3fSMiklos Szeredi  * struct fuse_supp_groups - Supplementary group extension
11818ed7cb3fSMiklos Szeredi  * @nr_groups: number of supplementary groups
11828ed7cb3fSMiklos Szeredi  * @groups: flexible array of group IDs
11838ed7cb3fSMiklos Szeredi  */
11848ed7cb3fSMiklos Szeredi struct fuse_supp_groups {
11858ed7cb3fSMiklos Szeredi 	uint32_t	nr_groups;
11868ed7cb3fSMiklos Szeredi 	uint32_t	groups[];
11878ed7cb3fSMiklos Szeredi };
11888ed7cb3fSMiklos Szeredi 
1189607ca46eSDavid Howells #endif /* _LINUX_FUSE_H */
1190