xref: /linux-6.15/include/uapi/linux/fuse.h (revision bbd84f33)
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 <[email protected]>
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  *
41607ca46eSDavid Howells  * 7.9:
42607ca46eSDavid Howells  *  - new fuse_getattr_in input argument of GETATTR
43607ca46eSDavid Howells  *  - add lk_flags in fuse_lk_in
44607ca46eSDavid Howells  *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
45607ca46eSDavid Howells  *  - add blksize field to fuse_attr
46607ca46eSDavid Howells  *  - add file flags field to fuse_read_in and fuse_write_in
47607ca46eSDavid Howells  *
48607ca46eSDavid Howells  * 7.10
49607ca46eSDavid Howells  *  - add nonseekable open flag
50607ca46eSDavid Howells  *
51607ca46eSDavid Howells  * 7.11
52607ca46eSDavid Howells  *  - add IOCTL message
53607ca46eSDavid Howells  *  - add unsolicited notification support
54607ca46eSDavid Howells  *  - add POLL message and NOTIFY_POLL notification
55607ca46eSDavid Howells  *
56607ca46eSDavid Howells  * 7.12
57607ca46eSDavid Howells  *  - add umask flag to input argument of open, mknod and mkdir
58607ca46eSDavid Howells  *  - add notification messages for invalidation of inodes and
59607ca46eSDavid Howells  *    directory entries
60607ca46eSDavid Howells  *
61607ca46eSDavid Howells  * 7.13
62607ca46eSDavid Howells  *  - make max number of background requests and congestion threshold
63607ca46eSDavid Howells  *    tunables
64607ca46eSDavid Howells  *
65607ca46eSDavid Howells  * 7.14
66607ca46eSDavid Howells  *  - add splice support to fuse device
67607ca46eSDavid Howells  *
68607ca46eSDavid Howells  * 7.15
69607ca46eSDavid Howells  *  - add store notify
70607ca46eSDavid Howells  *  - add retrieve notify
71607ca46eSDavid Howells  *
72607ca46eSDavid Howells  * 7.16
73607ca46eSDavid Howells  *  - add BATCH_FORGET request
74607ca46eSDavid Howells  *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
75607ca46eSDavid Howells  *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
76607ca46eSDavid Howells  *  - add FUSE_IOCTL_32BIT flag
77607ca46eSDavid Howells  *
78607ca46eSDavid Howells  * 7.17
79607ca46eSDavid Howells  *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
80607ca46eSDavid Howells  *
81607ca46eSDavid Howells  * 7.18
82607ca46eSDavid Howells  *  - add FUSE_IOCTL_DIR flag
83607ca46eSDavid Howells  *  - add FUSE_NOTIFY_DELETE
84607ca46eSDavid Howells  *
85607ca46eSDavid Howells  * 7.19
86607ca46eSDavid Howells  *  - add FUSE_FALLOCATE
87607ca46eSDavid Howells  *
88607ca46eSDavid Howells  * 7.20
89607ca46eSDavid Howells  *  - add FUSE_AUTO_INVAL_DATA
9023c153e5SMiklos Szeredi  *
9123c153e5SMiklos Szeredi  * 7.21
9223c153e5SMiklos Szeredi  *  - add FUSE_READDIRPLUS
930415d291SEnke Chen  *  - send the requested events in POLL request
9460b9df7aSMiklos Szeredi  *
9560b9df7aSMiklos Szeredi  * 7.22
9660b9df7aSMiklos Szeredi  *  - add FUSE_ASYNC_DIO
974d99ff8fSPavel Emelyanov  *
984d99ff8fSPavel Emelyanov  * 7.23
994d99ff8fSPavel Emelyanov  *  - add FUSE_WRITEBACK_CACHE
100e27c9d38SMiklos Szeredi  *  - add time_gran to fuse_init_out
101e27c9d38SMiklos Szeredi  *  - add reserved space to fuse_init_out
102ab9e13f7SMaxim Patlasov  *  - add FATTR_CTIME
103ab9e13f7SMaxim Patlasov  *  - add ctime and ctimensec to fuse_setattr_in
1041560c974SMiklos Szeredi  *  - add FUSE_RENAME2 request
105d7afaec0SAndrew Gallagher  *  - add FUSE_NO_OPEN_SUPPORT flag
1060b5da8dbSRavishankar N  *
1070b5da8dbSRavishankar N  *  7.24
1080b5da8dbSRavishankar N  *  - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
1095c672ab3SMiklos Szeredi  *
1105c672ab3SMiklos Szeredi  *  7.25
1115c672ab3SMiklos Szeredi  *  - add FUSE_PARALLEL_DIROPS
1125e940c1dSMiklos Szeredi  *
1135e940c1dSMiklos Szeredi  *  7.26
1145e940c1dSMiklos Szeredi  *  - add FUSE_HANDLE_KILLPRIV
11560bcc88aSSeth Forshee  *  - add FUSE_POSIX_ACL
1163b7008b2SSzymon Lukasz  *
1173b7008b2SSzymon Lukasz  *  7.27
1183b7008b2SSzymon Lukasz  *  - add FUSE_ABORT_ERROR
11988bc7d50SNiels de Vos  *
12088bc7d50SNiels de Vos  *  7.28
12188bc7d50SNiels de Vos  *  - add FUSE_COPY_FILE_RANGE
1226433b899SMiklos Szeredi  *  - add FOPEN_CACHE_DIR
1235da784ccSConstantine Shulyupin  *  - add FUSE_MAX_PAGES, add max_pages to init_out
1245571f1e6SDan Schatzberg  *  - add FUSE_CACHE_SYMLINKS
125d9a9ea94SChad Austin  *
126d9a9ea94SChad Austin  *  7.29
127d9a9ea94SChad Austin  *  - add FUSE_NO_OPENDIR_SUPPORT flag
128ad2ba64dSKirill Smelkov  *
129ad2ba64dSKirill Smelkov  *  7.30
130ad2ba64dSKirill Smelkov  *  - add FUSE_EXPLICIT_INVAL_DATA
131607ca46eSDavid Howells  */
132607ca46eSDavid Howells 
133607ca46eSDavid Howells #ifndef _LINUX_FUSE_H
134607ca46eSDavid Howells #define _LINUX_FUSE_H
135607ca46eSDavid Howells 
1364c82456eSMiklos Szeredi #ifdef __KERNEL__
137607ca46eSDavid Howells #include <linux/types.h>
1387e98d530SMiklos Szeredi #else
1397e98d530SMiklos Szeredi #include <stdint.h>
1407e98d530SMiklos Szeredi #endif
141607ca46eSDavid Howells 
142607ca46eSDavid Howells /*
143607ca46eSDavid Howells  * Version negotiation:
144607ca46eSDavid Howells  *
145607ca46eSDavid Howells  * Both the kernel and userspace send the version they support in the
146607ca46eSDavid Howells  * INIT request and reply respectively.
147607ca46eSDavid Howells  *
148607ca46eSDavid Howells  * If the major versions match then both shall use the smallest
149607ca46eSDavid Howells  * of the two minor versions for communication.
150607ca46eSDavid Howells  *
151607ca46eSDavid Howells  * If the kernel supports a larger major version, then userspace shall
152607ca46eSDavid Howells  * reply with the major version it supports, ignore the rest of the
153607ca46eSDavid Howells  * INIT message and expect a new INIT message from the kernel with a
154607ca46eSDavid Howells  * matching major version.
155607ca46eSDavid Howells  *
156607ca46eSDavid Howells  * If the library supports a larger major version, then it shall fall
157607ca46eSDavid Howells  * back to the major protocol version sent by the kernel for
158607ca46eSDavid Howells  * communication and reply with that major version (and an arbitrary
159607ca46eSDavid Howells  * supported minor version).
160607ca46eSDavid Howells  */
161607ca46eSDavid Howells 
162607ca46eSDavid Howells /** Version number of this interface */
163607ca46eSDavid Howells #define FUSE_KERNEL_VERSION 7
164607ca46eSDavid Howells 
165607ca46eSDavid Howells /** Minor version number of this interface */
166ad2ba64dSKirill Smelkov #define FUSE_KERNEL_MINOR_VERSION 30
167607ca46eSDavid Howells 
168607ca46eSDavid Howells /** The node ID of the root inode */
169607ca46eSDavid Howells #define FUSE_ROOT_ID 1
170607ca46eSDavid Howells 
171607ca46eSDavid Howells /* Make sure all structures are padded to 64bit boundary, so 32bit
172607ca46eSDavid Howells    userspace works under 64bit kernels */
173607ca46eSDavid Howells 
174607ca46eSDavid Howells struct fuse_attr {
1754c82456eSMiklos Szeredi 	uint64_t	ino;
1764c82456eSMiklos Szeredi 	uint64_t	size;
1774c82456eSMiklos Szeredi 	uint64_t	blocks;
1784c82456eSMiklos Szeredi 	uint64_t	atime;
1794c82456eSMiklos Szeredi 	uint64_t	mtime;
1804c82456eSMiklos Szeredi 	uint64_t	ctime;
1814c82456eSMiklos Szeredi 	uint32_t	atimensec;
1824c82456eSMiklos Szeredi 	uint32_t	mtimensec;
1834c82456eSMiklos Szeredi 	uint32_t	ctimensec;
1844c82456eSMiklos Szeredi 	uint32_t	mode;
1854c82456eSMiklos Szeredi 	uint32_t	nlink;
1864c82456eSMiklos Szeredi 	uint32_t	uid;
1874c82456eSMiklos Szeredi 	uint32_t	gid;
1884c82456eSMiklos Szeredi 	uint32_t	rdev;
1894c82456eSMiklos Szeredi 	uint32_t	blksize;
1904c82456eSMiklos Szeredi 	uint32_t	padding;
191607ca46eSDavid Howells };
192607ca46eSDavid Howells 
193607ca46eSDavid Howells struct fuse_kstatfs {
1944c82456eSMiklos Szeredi 	uint64_t	blocks;
1954c82456eSMiklos Szeredi 	uint64_t	bfree;
1964c82456eSMiklos Szeredi 	uint64_t	bavail;
1974c82456eSMiklos Szeredi 	uint64_t	files;
1984c82456eSMiklos Szeredi 	uint64_t	ffree;
1994c82456eSMiklos Szeredi 	uint32_t	bsize;
2004c82456eSMiklos Szeredi 	uint32_t	namelen;
2014c82456eSMiklos Szeredi 	uint32_t	frsize;
2024c82456eSMiklos Szeredi 	uint32_t	padding;
2034c82456eSMiklos Szeredi 	uint32_t	spare[6];
204607ca46eSDavid Howells };
205607ca46eSDavid Howells 
206607ca46eSDavid Howells struct fuse_file_lock {
2074c82456eSMiklos Szeredi 	uint64_t	start;
2084c82456eSMiklos Szeredi 	uint64_t	end;
2094c82456eSMiklos Szeredi 	uint32_t	type;
2104c82456eSMiklos Szeredi 	uint32_t	pid; /* tgid */
211607ca46eSDavid Howells };
212607ca46eSDavid Howells 
213607ca46eSDavid Howells /**
214607ca46eSDavid Howells  * Bitmasks for fuse_setattr_in.valid
215607ca46eSDavid Howells  */
216607ca46eSDavid Howells #define FATTR_MODE	(1 << 0)
217607ca46eSDavid Howells #define FATTR_UID	(1 << 1)
218607ca46eSDavid Howells #define FATTR_GID	(1 << 2)
219607ca46eSDavid Howells #define FATTR_SIZE	(1 << 3)
220607ca46eSDavid Howells #define FATTR_ATIME	(1 << 4)
221607ca46eSDavid Howells #define FATTR_MTIME	(1 << 5)
222607ca46eSDavid Howells #define FATTR_FH	(1 << 6)
223607ca46eSDavid Howells #define FATTR_ATIME_NOW	(1 << 7)
224607ca46eSDavid Howells #define FATTR_MTIME_NOW	(1 << 8)
225607ca46eSDavid Howells #define FATTR_LOCKOWNER	(1 << 9)
226ab9e13f7SMaxim Patlasov #define FATTR_CTIME	(1 << 10)
227607ca46eSDavid Howells 
228607ca46eSDavid Howells /**
229607ca46eSDavid Howells  * Flags returned by the OPEN request
230607ca46eSDavid Howells  *
231607ca46eSDavid Howells  * FOPEN_DIRECT_IO: bypass page cache for this open file
232607ca46eSDavid Howells  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
233607ca46eSDavid Howells  * FOPEN_NONSEEKABLE: the file is not seekable
2346433b899SMiklos Szeredi  * FOPEN_CACHE_DIR: allow caching this directory
235*bbd84f33SKirill Smelkov  * FOPEN_STREAM: the file is stream-like (no file position at all)
236607ca46eSDavid Howells  */
237607ca46eSDavid Howells #define FOPEN_DIRECT_IO		(1 << 0)
238607ca46eSDavid Howells #define FOPEN_KEEP_CACHE	(1 << 1)
239607ca46eSDavid Howells #define FOPEN_NONSEEKABLE	(1 << 2)
2406433b899SMiklos Szeredi #define FOPEN_CACHE_DIR		(1 << 3)
241*bbd84f33SKirill Smelkov #define FOPEN_STREAM		(1 << 4)
242607ca46eSDavid Howells 
243607ca46eSDavid Howells /**
244607ca46eSDavid Howells  * INIT request/reply flags
245607ca46eSDavid Howells  *
246607ca46eSDavid Howells  * FUSE_ASYNC_READ: asynchronous read requests
247607ca46eSDavid Howells  * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
248607ca46eSDavid Howells  * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
249607ca46eSDavid Howells  * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
250607ca46eSDavid Howells  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
251607ca46eSDavid Howells  * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
252607ca46eSDavid Howells  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
253607ca46eSDavid Howells  * FUSE_SPLICE_WRITE: kernel supports splice write on the device
254607ca46eSDavid Howells  * FUSE_SPLICE_MOVE: kernel supports splice move on the device
255607ca46eSDavid Howells  * FUSE_SPLICE_READ: kernel supports splice read on the device
256607ca46eSDavid Howells  * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
257607ca46eSDavid Howells  * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
258607ca46eSDavid Howells  * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
259634734b6SEric Wong  * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
260634734b6SEric Wong  * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
26160b9df7aSMiklos Szeredi  * FUSE_ASYNC_DIO: asynchronous direct I/O submission
2624d99ff8fSPavel Emelyanov  * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
263d7afaec0SAndrew Gallagher  * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
2645c672ab3SMiklos Szeredi  * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
2655e940c1dSMiklos Szeredi  * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
26660bcc88aSSeth Forshee  * FUSE_POSIX_ACL: filesystem supports posix acls
2673b7008b2SSzymon Lukasz  * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
2685da784ccSConstantine Shulyupin  * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
2695571f1e6SDan Schatzberg  * FUSE_CACHE_SYMLINKS: cache READLINK responses
270d9a9ea94SChad Austin  * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
271ad2ba64dSKirill Smelkov  * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
272607ca46eSDavid Howells  */
273607ca46eSDavid Howells #define FUSE_ASYNC_READ		(1 << 0)
274607ca46eSDavid Howells #define FUSE_POSIX_LOCKS	(1 << 1)
275607ca46eSDavid Howells #define FUSE_FILE_OPS		(1 << 2)
276607ca46eSDavid Howells #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
277607ca46eSDavid Howells #define FUSE_EXPORT_SUPPORT	(1 << 4)
278607ca46eSDavid Howells #define FUSE_BIG_WRITES		(1 << 5)
279607ca46eSDavid Howells #define FUSE_DONT_MASK		(1 << 6)
280607ca46eSDavid Howells #define FUSE_SPLICE_WRITE	(1 << 7)
281607ca46eSDavid Howells #define FUSE_SPLICE_MOVE	(1 << 8)
282607ca46eSDavid Howells #define FUSE_SPLICE_READ	(1 << 9)
283607ca46eSDavid Howells #define FUSE_FLOCK_LOCKS	(1 << 10)
284607ca46eSDavid Howells #define FUSE_HAS_IOCTL_DIR	(1 << 11)
285607ca46eSDavid Howells #define FUSE_AUTO_INVAL_DATA	(1 << 12)
2860b05b183SAnand V. Avati #define FUSE_DO_READDIRPLUS	(1 << 13)
287634734b6SEric Wong #define FUSE_READDIRPLUS_AUTO	(1 << 14)
28860b9df7aSMiklos Szeredi #define FUSE_ASYNC_DIO		(1 << 15)
2894d99ff8fSPavel Emelyanov #define FUSE_WRITEBACK_CACHE	(1 << 16)
290d7afaec0SAndrew Gallagher #define FUSE_NO_OPEN_SUPPORT	(1 << 17)
2915c672ab3SMiklos Szeredi #define FUSE_PARALLEL_DIROPS    (1 << 18)
2925e940c1dSMiklos Szeredi #define FUSE_HANDLE_KILLPRIV	(1 << 19)
29360bcc88aSSeth Forshee #define FUSE_POSIX_ACL		(1 << 20)
2943b7008b2SSzymon Lukasz #define FUSE_ABORT_ERROR	(1 << 21)
2955da784ccSConstantine Shulyupin #define FUSE_MAX_PAGES		(1 << 22)
2965571f1e6SDan Schatzberg #define FUSE_CACHE_SYMLINKS	(1 << 23)
297d9a9ea94SChad Austin #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
298ad2ba64dSKirill Smelkov #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
299607ca46eSDavid Howells 
300607ca46eSDavid Howells /**
301607ca46eSDavid Howells  * CUSE INIT request/reply flags
302607ca46eSDavid Howells  *
303607ca46eSDavid Howells  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
304607ca46eSDavid Howells  */
305607ca46eSDavid Howells #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
306607ca46eSDavid Howells 
307607ca46eSDavid Howells /**
308607ca46eSDavid Howells  * Release flags
309607ca46eSDavid Howells  */
310607ca46eSDavid Howells #define FUSE_RELEASE_FLUSH	(1 << 0)
311607ca46eSDavid Howells #define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
312607ca46eSDavid Howells 
313607ca46eSDavid Howells /**
314607ca46eSDavid Howells  * Getattr flags
315607ca46eSDavid Howells  */
316607ca46eSDavid Howells #define FUSE_GETATTR_FH		(1 << 0)
317607ca46eSDavid Howells 
318607ca46eSDavid Howells /**
319607ca46eSDavid Howells  * Lock flags
320607ca46eSDavid Howells  */
321607ca46eSDavid Howells #define FUSE_LK_FLOCK		(1 << 0)
322607ca46eSDavid Howells 
323607ca46eSDavid Howells /**
324607ca46eSDavid Howells  * WRITE flags
325607ca46eSDavid Howells  *
326607ca46eSDavid Howells  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
327607ca46eSDavid Howells  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
328607ca46eSDavid Howells  */
329607ca46eSDavid Howells #define FUSE_WRITE_CACHE	(1 << 0)
330607ca46eSDavid Howells #define FUSE_WRITE_LOCKOWNER	(1 << 1)
331607ca46eSDavid Howells 
332607ca46eSDavid Howells /**
333607ca46eSDavid Howells  * Read flags
334607ca46eSDavid Howells  */
335607ca46eSDavid Howells #define FUSE_READ_LOCKOWNER	(1 << 1)
336607ca46eSDavid Howells 
337607ca46eSDavid Howells /**
338607ca46eSDavid Howells  * Ioctl flags
339607ca46eSDavid Howells  *
340607ca46eSDavid Howells  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
341607ca46eSDavid Howells  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
342607ca46eSDavid Howells  * FUSE_IOCTL_RETRY: retry with new iovecs
343607ca46eSDavid Howells  * FUSE_IOCTL_32BIT: 32bit ioctl
344607ca46eSDavid Howells  * FUSE_IOCTL_DIR: is a directory
345607ca46eSDavid Howells  *
346607ca46eSDavid Howells  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
347607ca46eSDavid Howells  */
348607ca46eSDavid Howells #define FUSE_IOCTL_COMPAT	(1 << 0)
349607ca46eSDavid Howells #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
350607ca46eSDavid Howells #define FUSE_IOCTL_RETRY	(1 << 2)
351607ca46eSDavid Howells #define FUSE_IOCTL_32BIT	(1 << 3)
352607ca46eSDavid Howells #define FUSE_IOCTL_DIR		(1 << 4)
353607ca46eSDavid Howells 
354607ca46eSDavid Howells #define FUSE_IOCTL_MAX_IOV	256
355607ca46eSDavid Howells 
356607ca46eSDavid Howells /**
357607ca46eSDavid Howells  * Poll flags
358607ca46eSDavid Howells  *
359607ca46eSDavid Howells  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
360607ca46eSDavid Howells  */
361607ca46eSDavid Howells #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
362607ca46eSDavid Howells 
363607ca46eSDavid Howells enum fuse_opcode {
364607ca46eSDavid Howells 	FUSE_LOOKUP		= 1,
365607ca46eSDavid Howells 	FUSE_FORGET		= 2,  /* no reply */
366607ca46eSDavid Howells 	FUSE_GETATTR		= 3,
367607ca46eSDavid Howells 	FUSE_SETATTR		= 4,
368607ca46eSDavid Howells 	FUSE_READLINK		= 5,
369607ca46eSDavid Howells 	FUSE_SYMLINK		= 6,
370607ca46eSDavid Howells 	FUSE_MKNOD		= 8,
371607ca46eSDavid Howells 	FUSE_MKDIR		= 9,
372607ca46eSDavid Howells 	FUSE_UNLINK		= 10,
373607ca46eSDavid Howells 	FUSE_RMDIR		= 11,
374607ca46eSDavid Howells 	FUSE_RENAME		= 12,
375607ca46eSDavid Howells 	FUSE_LINK		= 13,
376607ca46eSDavid Howells 	FUSE_OPEN		= 14,
377607ca46eSDavid Howells 	FUSE_READ		= 15,
378607ca46eSDavid Howells 	FUSE_WRITE		= 16,
379607ca46eSDavid Howells 	FUSE_STATFS		= 17,
380607ca46eSDavid Howells 	FUSE_RELEASE		= 18,
381607ca46eSDavid Howells 	FUSE_FSYNC		= 20,
382607ca46eSDavid Howells 	FUSE_SETXATTR		= 21,
383607ca46eSDavid Howells 	FUSE_GETXATTR		= 22,
384607ca46eSDavid Howells 	FUSE_LISTXATTR		= 23,
385607ca46eSDavid Howells 	FUSE_REMOVEXATTR	= 24,
386607ca46eSDavid Howells 	FUSE_FLUSH		= 25,
387607ca46eSDavid Howells 	FUSE_INIT		= 26,
388607ca46eSDavid Howells 	FUSE_OPENDIR		= 27,
389607ca46eSDavid Howells 	FUSE_READDIR		= 28,
390607ca46eSDavid Howells 	FUSE_RELEASEDIR		= 29,
391607ca46eSDavid Howells 	FUSE_FSYNCDIR		= 30,
392607ca46eSDavid Howells 	FUSE_GETLK		= 31,
393607ca46eSDavid Howells 	FUSE_SETLK		= 32,
394607ca46eSDavid Howells 	FUSE_SETLKW		= 33,
395607ca46eSDavid Howells 	FUSE_ACCESS		= 34,
396607ca46eSDavid Howells 	FUSE_CREATE		= 35,
397607ca46eSDavid Howells 	FUSE_INTERRUPT		= 36,
398607ca46eSDavid Howells 	FUSE_BMAP		= 37,
399607ca46eSDavid Howells 	FUSE_DESTROY		= 38,
400607ca46eSDavid Howells 	FUSE_IOCTL		= 39,
401607ca46eSDavid Howells 	FUSE_POLL		= 40,
402607ca46eSDavid Howells 	FUSE_NOTIFY_REPLY	= 41,
403607ca46eSDavid Howells 	FUSE_BATCH_FORGET	= 42,
404607ca46eSDavid Howells 	FUSE_FALLOCATE		= 43,
4050b05b183SAnand V. Avati 	FUSE_READDIRPLUS	= 44,
4061560c974SMiklos Szeredi 	FUSE_RENAME2		= 45,
4070b5da8dbSRavishankar N 	FUSE_LSEEK		= 46,
40888bc7d50SNiels de Vos 	FUSE_COPY_FILE_RANGE	= 47,
409607ca46eSDavid Howells 
410607ca46eSDavid Howells 	/* CUSE specific operations */
411607ca46eSDavid Howells 	CUSE_INIT		= 4096,
412607ca46eSDavid Howells };
413607ca46eSDavid Howells 
414607ca46eSDavid Howells enum fuse_notify_code {
415607ca46eSDavid Howells 	FUSE_NOTIFY_POLL   = 1,
416607ca46eSDavid Howells 	FUSE_NOTIFY_INVAL_INODE = 2,
417607ca46eSDavid Howells 	FUSE_NOTIFY_INVAL_ENTRY = 3,
418607ca46eSDavid Howells 	FUSE_NOTIFY_STORE = 4,
419607ca46eSDavid Howells 	FUSE_NOTIFY_RETRIEVE = 5,
420607ca46eSDavid Howells 	FUSE_NOTIFY_DELETE = 6,
421607ca46eSDavid Howells 	FUSE_NOTIFY_CODE_MAX,
422607ca46eSDavid Howells };
423607ca46eSDavid Howells 
424607ca46eSDavid Howells /* The read buffer is required to be at least 8k, but may be much larger */
425607ca46eSDavid Howells #define FUSE_MIN_READ_BUFFER 8192
426607ca46eSDavid Howells 
427607ca46eSDavid Howells #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
428607ca46eSDavid Howells 
429607ca46eSDavid Howells struct fuse_entry_out {
4304c82456eSMiklos Szeredi 	uint64_t	nodeid;		/* Inode ID */
4314c82456eSMiklos Szeredi 	uint64_t	generation;	/* Inode generation: nodeid:gen must
432607ca46eSDavid Howells 					   be unique for the fs's lifetime */
4334c82456eSMiklos Szeredi 	uint64_t	entry_valid;	/* Cache timeout for the name */
4344c82456eSMiklos Szeredi 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
4354c82456eSMiklos Szeredi 	uint32_t	entry_valid_nsec;
4364c82456eSMiklos Szeredi 	uint32_t	attr_valid_nsec;
437607ca46eSDavid Howells 	struct fuse_attr attr;
438607ca46eSDavid Howells };
439607ca46eSDavid Howells 
440607ca46eSDavid Howells struct fuse_forget_in {
4414c82456eSMiklos Szeredi 	uint64_t	nlookup;
442607ca46eSDavid Howells };
443607ca46eSDavid Howells 
444607ca46eSDavid Howells struct fuse_forget_one {
4454c82456eSMiklos Szeredi 	uint64_t	nodeid;
4464c82456eSMiklos Szeredi 	uint64_t	nlookup;
447607ca46eSDavid Howells };
448607ca46eSDavid Howells 
449607ca46eSDavid Howells struct fuse_batch_forget_in {
4504c82456eSMiklos Szeredi 	uint32_t	count;
4514c82456eSMiklos Szeredi 	uint32_t	dummy;
452607ca46eSDavid Howells };
453607ca46eSDavid Howells 
454607ca46eSDavid Howells struct fuse_getattr_in {
4554c82456eSMiklos Szeredi 	uint32_t	getattr_flags;
4564c82456eSMiklos Szeredi 	uint32_t	dummy;
4574c82456eSMiklos Szeredi 	uint64_t	fh;
458607ca46eSDavid Howells };
459607ca46eSDavid Howells 
460607ca46eSDavid Howells #define FUSE_COMPAT_ATTR_OUT_SIZE 96
461607ca46eSDavid Howells 
462607ca46eSDavid Howells struct fuse_attr_out {
4634c82456eSMiklos Szeredi 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
4644c82456eSMiklos Szeredi 	uint32_t	attr_valid_nsec;
4654c82456eSMiklos Szeredi 	uint32_t	dummy;
466607ca46eSDavid Howells 	struct fuse_attr attr;
467607ca46eSDavid Howells };
468607ca46eSDavid Howells 
469607ca46eSDavid Howells #define FUSE_COMPAT_MKNOD_IN_SIZE 8
470607ca46eSDavid Howells 
471607ca46eSDavid Howells struct fuse_mknod_in {
4724c82456eSMiklos Szeredi 	uint32_t	mode;
4734c82456eSMiklos Szeredi 	uint32_t	rdev;
4744c82456eSMiklos Szeredi 	uint32_t	umask;
4754c82456eSMiklos Szeredi 	uint32_t	padding;
476607ca46eSDavid Howells };
477607ca46eSDavid Howells 
478607ca46eSDavid Howells struct fuse_mkdir_in {
4794c82456eSMiklos Szeredi 	uint32_t	mode;
4804c82456eSMiklos Szeredi 	uint32_t	umask;
481607ca46eSDavid Howells };
482607ca46eSDavid Howells 
483607ca46eSDavid Howells struct fuse_rename_in {
4844c82456eSMiklos Szeredi 	uint64_t	newdir;
485607ca46eSDavid Howells };
486607ca46eSDavid Howells 
4871560c974SMiklos Szeredi struct fuse_rename2_in {
4881560c974SMiklos Szeredi 	uint64_t	newdir;
4891560c974SMiklos Szeredi 	uint32_t	flags;
4901560c974SMiklos Szeredi 	uint32_t	padding;
4911560c974SMiklos Szeredi };
4921560c974SMiklos Szeredi 
493607ca46eSDavid Howells struct fuse_link_in {
4944c82456eSMiklos Szeredi 	uint64_t	oldnodeid;
495607ca46eSDavid Howells };
496607ca46eSDavid Howells 
497607ca46eSDavid Howells struct fuse_setattr_in {
4984c82456eSMiklos Szeredi 	uint32_t	valid;
4994c82456eSMiklos Szeredi 	uint32_t	padding;
5004c82456eSMiklos Szeredi 	uint64_t	fh;
5014c82456eSMiklos Szeredi 	uint64_t	size;
5024c82456eSMiklos Szeredi 	uint64_t	lock_owner;
5034c82456eSMiklos Szeredi 	uint64_t	atime;
5044c82456eSMiklos Szeredi 	uint64_t	mtime;
505ab9e13f7SMaxim Patlasov 	uint64_t	ctime;
5064c82456eSMiklos Szeredi 	uint32_t	atimensec;
5074c82456eSMiklos Szeredi 	uint32_t	mtimensec;
508ab9e13f7SMaxim Patlasov 	uint32_t	ctimensec;
5094c82456eSMiklos Szeredi 	uint32_t	mode;
5104c82456eSMiklos Szeredi 	uint32_t	unused4;
5114c82456eSMiklos Szeredi 	uint32_t	uid;
5124c82456eSMiklos Szeredi 	uint32_t	gid;
5134c82456eSMiklos Szeredi 	uint32_t	unused5;
514607ca46eSDavid Howells };
515607ca46eSDavid Howells 
516607ca46eSDavid Howells struct fuse_open_in {
5174c82456eSMiklos Szeredi 	uint32_t	flags;
5184c82456eSMiklos Szeredi 	uint32_t	unused;
519607ca46eSDavid Howells };
520607ca46eSDavid Howells 
521607ca46eSDavid Howells struct fuse_create_in {
5224c82456eSMiklos Szeredi 	uint32_t	flags;
5234c82456eSMiklos Szeredi 	uint32_t	mode;
5244c82456eSMiklos Szeredi 	uint32_t	umask;
5254c82456eSMiklos Szeredi 	uint32_t	padding;
526607ca46eSDavid Howells };
527607ca46eSDavid Howells 
528607ca46eSDavid Howells struct fuse_open_out {
5294c82456eSMiklos Szeredi 	uint64_t	fh;
5304c82456eSMiklos Szeredi 	uint32_t	open_flags;
5314c82456eSMiklos Szeredi 	uint32_t	padding;
532607ca46eSDavid Howells };
533607ca46eSDavid Howells 
534607ca46eSDavid Howells struct fuse_release_in {
5354c82456eSMiklos Szeredi 	uint64_t	fh;
5364c82456eSMiklos Szeredi 	uint32_t	flags;
5374c82456eSMiklos Szeredi 	uint32_t	release_flags;
5384c82456eSMiklos Szeredi 	uint64_t	lock_owner;
539607ca46eSDavid Howells };
540607ca46eSDavid Howells 
541607ca46eSDavid Howells struct fuse_flush_in {
5424c82456eSMiklos Szeredi 	uint64_t	fh;
5434c82456eSMiklos Szeredi 	uint32_t	unused;
5444c82456eSMiklos Szeredi 	uint32_t	padding;
5454c82456eSMiklos Szeredi 	uint64_t	lock_owner;
546607ca46eSDavid Howells };
547607ca46eSDavid Howells 
548607ca46eSDavid Howells struct fuse_read_in {
5494c82456eSMiklos Szeredi 	uint64_t	fh;
5504c82456eSMiklos Szeredi 	uint64_t	offset;
5514c82456eSMiklos Szeredi 	uint32_t	size;
5524c82456eSMiklos Szeredi 	uint32_t	read_flags;
5534c82456eSMiklos Szeredi 	uint64_t	lock_owner;
5544c82456eSMiklos Szeredi 	uint32_t	flags;
5554c82456eSMiklos Szeredi 	uint32_t	padding;
556607ca46eSDavid Howells };
557607ca46eSDavid Howells 
558607ca46eSDavid Howells #define FUSE_COMPAT_WRITE_IN_SIZE 24
559607ca46eSDavid Howells 
560607ca46eSDavid Howells struct fuse_write_in {
5614c82456eSMiklos Szeredi 	uint64_t	fh;
5624c82456eSMiklos Szeredi 	uint64_t	offset;
5634c82456eSMiklos Szeredi 	uint32_t	size;
5644c82456eSMiklos Szeredi 	uint32_t	write_flags;
5654c82456eSMiklos Szeredi 	uint64_t	lock_owner;
5664c82456eSMiklos Szeredi 	uint32_t	flags;
5674c82456eSMiklos Szeredi 	uint32_t	padding;
568607ca46eSDavid Howells };
569607ca46eSDavid Howells 
570607ca46eSDavid Howells struct fuse_write_out {
5714c82456eSMiklos Szeredi 	uint32_t	size;
5724c82456eSMiklos Szeredi 	uint32_t	padding;
573607ca46eSDavid Howells };
574607ca46eSDavid Howells 
575607ca46eSDavid Howells #define FUSE_COMPAT_STATFS_SIZE 48
576607ca46eSDavid Howells 
577607ca46eSDavid Howells struct fuse_statfs_out {
578607ca46eSDavid Howells 	struct fuse_kstatfs st;
579607ca46eSDavid Howells };
580607ca46eSDavid Howells 
581607ca46eSDavid Howells struct fuse_fsync_in {
5824c82456eSMiklos Szeredi 	uint64_t	fh;
5834c82456eSMiklos Szeredi 	uint32_t	fsync_flags;
5844c82456eSMiklos Szeredi 	uint32_t	padding;
585607ca46eSDavid Howells };
586607ca46eSDavid Howells 
587607ca46eSDavid Howells struct fuse_setxattr_in {
5884c82456eSMiklos Szeredi 	uint32_t	size;
5894c82456eSMiklos Szeredi 	uint32_t	flags;
590607ca46eSDavid Howells };
591607ca46eSDavid Howells 
592607ca46eSDavid Howells struct fuse_getxattr_in {
5934c82456eSMiklos Szeredi 	uint32_t	size;
5944c82456eSMiklos Szeredi 	uint32_t	padding;
595607ca46eSDavid Howells };
596607ca46eSDavid Howells 
597607ca46eSDavid Howells struct fuse_getxattr_out {
5984c82456eSMiklos Szeredi 	uint32_t	size;
5994c82456eSMiklos Szeredi 	uint32_t	padding;
600607ca46eSDavid Howells };
601607ca46eSDavid Howells 
602607ca46eSDavid Howells struct fuse_lk_in {
6034c82456eSMiklos Szeredi 	uint64_t	fh;
6044c82456eSMiklos Szeredi 	uint64_t	owner;
605607ca46eSDavid Howells 	struct fuse_file_lock lk;
6064c82456eSMiklos Szeredi 	uint32_t	lk_flags;
6074c82456eSMiklos Szeredi 	uint32_t	padding;
608607ca46eSDavid Howells };
609607ca46eSDavid Howells 
610607ca46eSDavid Howells struct fuse_lk_out {
611607ca46eSDavid Howells 	struct fuse_file_lock lk;
612607ca46eSDavid Howells };
613607ca46eSDavid Howells 
614607ca46eSDavid Howells struct fuse_access_in {
6154c82456eSMiklos Szeredi 	uint32_t	mask;
6164c82456eSMiklos Szeredi 	uint32_t	padding;
617607ca46eSDavid Howells };
618607ca46eSDavid Howells 
619607ca46eSDavid Howells struct fuse_init_in {
6204c82456eSMiklos Szeredi 	uint32_t	major;
6214c82456eSMiklos Szeredi 	uint32_t	minor;
6224c82456eSMiklos Szeredi 	uint32_t	max_readahead;
6234c82456eSMiklos Szeredi 	uint32_t	flags;
624607ca46eSDavid Howells };
625607ca46eSDavid Howells 
626e27c9d38SMiklos Szeredi #define FUSE_COMPAT_INIT_OUT_SIZE 8
627e27c9d38SMiklos Szeredi #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
628e27c9d38SMiklos Szeredi 
629607ca46eSDavid Howells struct fuse_init_out {
6304c82456eSMiklos Szeredi 	uint32_t	major;
6314c82456eSMiklos Szeredi 	uint32_t	minor;
6324c82456eSMiklos Szeredi 	uint32_t	max_readahead;
6334c82456eSMiklos Szeredi 	uint32_t	flags;
6344c82456eSMiklos Szeredi 	uint16_t	max_background;
6354c82456eSMiklos Szeredi 	uint16_t	congestion_threshold;
6364c82456eSMiklos Szeredi 	uint32_t	max_write;
637e27c9d38SMiklos Szeredi 	uint32_t	time_gran;
6385da784ccSConstantine Shulyupin 	uint16_t	max_pages;
6395da784ccSConstantine Shulyupin 	uint16_t	padding;
6405da784ccSConstantine Shulyupin 	uint32_t	unused[8];
641607ca46eSDavid Howells };
642607ca46eSDavid Howells 
643607ca46eSDavid Howells #define CUSE_INIT_INFO_MAX 4096
644607ca46eSDavid Howells 
645607ca46eSDavid Howells struct cuse_init_in {
6464c82456eSMiklos Szeredi 	uint32_t	major;
6474c82456eSMiklos Szeredi 	uint32_t	minor;
6484c82456eSMiklos Szeredi 	uint32_t	unused;
6494c82456eSMiklos Szeredi 	uint32_t	flags;
650607ca46eSDavid Howells };
651607ca46eSDavid Howells 
652607ca46eSDavid Howells struct cuse_init_out {
6534c82456eSMiklos Szeredi 	uint32_t	major;
6544c82456eSMiklos Szeredi 	uint32_t	minor;
6554c82456eSMiklos Szeredi 	uint32_t	unused;
6564c82456eSMiklos Szeredi 	uint32_t	flags;
6574c82456eSMiklos Szeredi 	uint32_t	max_read;
6584c82456eSMiklos Szeredi 	uint32_t	max_write;
6594c82456eSMiklos Szeredi 	uint32_t	dev_major;		/* chardev major */
6604c82456eSMiklos Szeredi 	uint32_t	dev_minor;		/* chardev minor */
6614c82456eSMiklos Szeredi 	uint32_t	spare[10];
662607ca46eSDavid Howells };
663607ca46eSDavid Howells 
664607ca46eSDavid Howells struct fuse_interrupt_in {
6654c82456eSMiklos Szeredi 	uint64_t	unique;
666607ca46eSDavid Howells };
667607ca46eSDavid Howells 
668607ca46eSDavid Howells struct fuse_bmap_in {
6694c82456eSMiklos Szeredi 	uint64_t	block;
6704c82456eSMiklos Szeredi 	uint32_t	blocksize;
6714c82456eSMiklos Szeredi 	uint32_t	padding;
672607ca46eSDavid Howells };
673607ca46eSDavid Howells 
674607ca46eSDavid Howells struct fuse_bmap_out {
6754c82456eSMiklos Szeredi 	uint64_t	block;
676607ca46eSDavid Howells };
677607ca46eSDavid Howells 
678607ca46eSDavid Howells struct fuse_ioctl_in {
6794c82456eSMiklos Szeredi 	uint64_t	fh;
6804c82456eSMiklos Szeredi 	uint32_t	flags;
6814c82456eSMiklos Szeredi 	uint32_t	cmd;
6824c82456eSMiklos Szeredi 	uint64_t	arg;
6834c82456eSMiklos Szeredi 	uint32_t	in_size;
6844c82456eSMiklos Szeredi 	uint32_t	out_size;
685607ca46eSDavid Howells };
686607ca46eSDavid Howells 
687607ca46eSDavid Howells struct fuse_ioctl_iovec {
6884c82456eSMiklos Szeredi 	uint64_t	base;
6894c82456eSMiklos Szeredi 	uint64_t	len;
690607ca46eSDavid Howells };
691607ca46eSDavid Howells 
692607ca46eSDavid Howells struct fuse_ioctl_out {
6934c82456eSMiklos Szeredi 	int32_t		result;
6944c82456eSMiklos Szeredi 	uint32_t	flags;
6954c82456eSMiklos Szeredi 	uint32_t	in_iovs;
6964c82456eSMiklos Szeredi 	uint32_t	out_iovs;
697607ca46eSDavid Howells };
698607ca46eSDavid Howells 
699607ca46eSDavid Howells struct fuse_poll_in {
7004c82456eSMiklos Szeredi 	uint64_t	fh;
7014c82456eSMiklos Szeredi 	uint64_t	kh;
7024c82456eSMiklos Szeredi 	uint32_t	flags;
7034c82456eSMiklos Szeredi 	uint32_t	events;
704607ca46eSDavid Howells };
705607ca46eSDavid Howells 
706607ca46eSDavid Howells struct fuse_poll_out {
7074c82456eSMiklos Szeredi 	uint32_t	revents;
7084c82456eSMiklos Szeredi 	uint32_t	padding;
709607ca46eSDavid Howells };
710607ca46eSDavid Howells 
711607ca46eSDavid Howells struct fuse_notify_poll_wakeup_out {
7124c82456eSMiklos Szeredi 	uint64_t	kh;
713607ca46eSDavid Howells };
714607ca46eSDavid Howells 
715607ca46eSDavid Howells struct fuse_fallocate_in {
7164c82456eSMiklos Szeredi 	uint64_t	fh;
7174c82456eSMiklos Szeredi 	uint64_t	offset;
7184c82456eSMiklos Szeredi 	uint64_t	length;
7194c82456eSMiklos Szeredi 	uint32_t	mode;
7204c82456eSMiklos Szeredi 	uint32_t	padding;
721607ca46eSDavid Howells };
722607ca46eSDavid Howells 
723607ca46eSDavid Howells struct fuse_in_header {
7244c82456eSMiklos Szeredi 	uint32_t	len;
7254c82456eSMiklos Szeredi 	uint32_t	opcode;
7264c82456eSMiklos Szeredi 	uint64_t	unique;
7274c82456eSMiklos Szeredi 	uint64_t	nodeid;
7284c82456eSMiklos Szeredi 	uint32_t	uid;
7294c82456eSMiklos Szeredi 	uint32_t	gid;
7304c82456eSMiklos Szeredi 	uint32_t	pid;
7314c82456eSMiklos Szeredi 	uint32_t	padding;
732607ca46eSDavid Howells };
733607ca46eSDavid Howells 
734607ca46eSDavid Howells struct fuse_out_header {
7354c82456eSMiklos Szeredi 	uint32_t	len;
7364c82456eSMiklos Szeredi 	int32_t		error;
7374c82456eSMiklos Szeredi 	uint64_t	unique;
738607ca46eSDavid Howells };
739607ca46eSDavid Howells 
740607ca46eSDavid Howells struct fuse_dirent {
7414c82456eSMiklos Szeredi 	uint64_t	ino;
7424c82456eSMiklos Szeredi 	uint64_t	off;
7434c82456eSMiklos Szeredi 	uint32_t	namelen;
7444c82456eSMiklos Szeredi 	uint32_t	type;
745607ca46eSDavid Howells 	char name[];
746607ca46eSDavid Howells };
747607ca46eSDavid Howells 
748607ca46eSDavid Howells #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
7494c82456eSMiklos Szeredi #define FUSE_DIRENT_ALIGN(x) \
7504c82456eSMiklos Szeredi 	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
751607ca46eSDavid Howells #define FUSE_DIRENT_SIZE(d) \
752607ca46eSDavid Howells 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
753607ca46eSDavid Howells 
7540b05b183SAnand V. Avati struct fuse_direntplus {
7550b05b183SAnand V. Avati 	struct fuse_entry_out entry_out;
7560b05b183SAnand V. Avati 	struct fuse_dirent dirent;
7570b05b183SAnand V. Avati };
7580b05b183SAnand V. Avati 
7590b05b183SAnand V. Avati #define FUSE_NAME_OFFSET_DIRENTPLUS \
7600b05b183SAnand V. Avati 	offsetof(struct fuse_direntplus, dirent.name)
7610b05b183SAnand V. Avati #define FUSE_DIRENTPLUS_SIZE(d) \
7620b05b183SAnand V. Avati 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
7630b05b183SAnand V. Avati 
764607ca46eSDavid Howells struct fuse_notify_inval_inode_out {
7654c82456eSMiklos Szeredi 	uint64_t	ino;
7664c82456eSMiklos Szeredi 	int64_t		off;
7674c82456eSMiklos Szeredi 	int64_t		len;
768607ca46eSDavid Howells };
769607ca46eSDavid Howells 
770607ca46eSDavid Howells struct fuse_notify_inval_entry_out {
7714c82456eSMiklos Szeredi 	uint64_t	parent;
7724c82456eSMiklos Szeredi 	uint32_t	namelen;
7734c82456eSMiklos Szeredi 	uint32_t	padding;
774607ca46eSDavid Howells };
775607ca46eSDavid Howells 
776607ca46eSDavid Howells struct fuse_notify_delete_out {
7774c82456eSMiklos Szeredi 	uint64_t	parent;
7784c82456eSMiklos Szeredi 	uint64_t	child;
7794c82456eSMiklos Szeredi 	uint32_t	namelen;
7804c82456eSMiklos Szeredi 	uint32_t	padding;
781607ca46eSDavid Howells };
782607ca46eSDavid Howells 
783607ca46eSDavid Howells struct fuse_notify_store_out {
7844c82456eSMiklos Szeredi 	uint64_t	nodeid;
7854c82456eSMiklos Szeredi 	uint64_t	offset;
7864c82456eSMiklos Szeredi 	uint32_t	size;
7874c82456eSMiklos Szeredi 	uint32_t	padding;
788607ca46eSDavid Howells };
789607ca46eSDavid Howells 
790607ca46eSDavid Howells struct fuse_notify_retrieve_out {
7914c82456eSMiklos Szeredi 	uint64_t	notify_unique;
7924c82456eSMiklos Szeredi 	uint64_t	nodeid;
7934c82456eSMiklos Szeredi 	uint64_t	offset;
7944c82456eSMiklos Szeredi 	uint32_t	size;
7954c82456eSMiklos Szeredi 	uint32_t	padding;
796607ca46eSDavid Howells };
797607ca46eSDavid Howells 
798607ca46eSDavid Howells /* Matches the size of fuse_write_in */
799607ca46eSDavid Howells struct fuse_notify_retrieve_in {
8004c82456eSMiklos Szeredi 	uint64_t	dummy1;
8014c82456eSMiklos Szeredi 	uint64_t	offset;
8024c82456eSMiklos Szeredi 	uint32_t	size;
8034c82456eSMiklos Szeredi 	uint32_t	dummy2;
8044c82456eSMiklos Szeredi 	uint64_t	dummy3;
8054c82456eSMiklos Szeredi 	uint64_t	dummy4;
806607ca46eSDavid Howells };
807607ca46eSDavid Howells 
80800c570f4SMiklos Szeredi /* Device ioctls: */
80900c570f4SMiklos Szeredi #define FUSE_DEV_IOC_CLONE	_IOR(229, 0, uint32_t)
81000c570f4SMiklos Szeredi 
8110b5da8dbSRavishankar N struct fuse_lseek_in {
8120b5da8dbSRavishankar N 	uint64_t	fh;
8130b5da8dbSRavishankar N 	uint64_t	offset;
8140b5da8dbSRavishankar N 	uint32_t	whence;
8150b5da8dbSRavishankar N 	uint32_t	padding;
8160b5da8dbSRavishankar N };
8170b5da8dbSRavishankar N 
8180b5da8dbSRavishankar N struct fuse_lseek_out {
8190b5da8dbSRavishankar N 	uint64_t	offset;
8200b5da8dbSRavishankar N };
8210b5da8dbSRavishankar N 
82288bc7d50SNiels de Vos struct fuse_copy_file_range_in {
82388bc7d50SNiels de Vos 	uint64_t	fh_in;
82488bc7d50SNiels de Vos 	uint64_t	off_in;
82588bc7d50SNiels de Vos 	uint64_t	nodeid_out;
82688bc7d50SNiels de Vos 	uint64_t	fh_out;
82788bc7d50SNiels de Vos 	uint64_t	off_out;
82888bc7d50SNiels de Vos 	uint64_t	len;
82988bc7d50SNiels de Vos 	uint64_t	flags;
83088bc7d50SNiels de Vos };
83188bc7d50SNiels de Vos 
832607ca46eSDavid Howells #endif /* _LINUX_FUSE_H */
833