xref: /linux/include/uapi/linux/fuse.h (revision 6407f44aaf2a39b5ccbb1cc1d342b906dcfa8a87)
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  *
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
477142fd1bSAlan Somers  *  - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
48607ca46eSDavid Howells  *
49607ca46eSDavid Howells  * 7.10
50607ca46eSDavid Howells  *  - add nonseekable open flag
51607ca46eSDavid Howells  *
52607ca46eSDavid Howells  * 7.11
53607ca46eSDavid Howells  *  - add IOCTL message
54607ca46eSDavid Howells  *  - add unsolicited notification support
55607ca46eSDavid Howells  *  - add POLL message and NOTIFY_POLL notification
56607ca46eSDavid Howells  *
57607ca46eSDavid Howells  * 7.12
5868065b84SAlan Somers  *  - add umask flag to input argument of create, mknod and mkdir
59607ca46eSDavid Howells  *  - add notification messages for invalidation of inodes and
60607ca46eSDavid Howells  *    directory entries
61607ca46eSDavid Howells  *
62607ca46eSDavid Howells  * 7.13
63607ca46eSDavid Howells  *  - make max number of background requests and congestion threshold
64607ca46eSDavid Howells  *    tunables
65607ca46eSDavid Howells  *
66607ca46eSDavid Howells  * 7.14
67607ca46eSDavid Howells  *  - add splice support to fuse device
68607ca46eSDavid Howells  *
69607ca46eSDavid Howells  * 7.15
70607ca46eSDavid Howells  *  - add store notify
71607ca46eSDavid Howells  *  - add retrieve notify
72607ca46eSDavid Howells  *
73607ca46eSDavid Howells  * 7.16
74607ca46eSDavid Howells  *  - add BATCH_FORGET request
75607ca46eSDavid Howells  *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
76607ca46eSDavid Howells  *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
77607ca46eSDavid Howells  *  - add FUSE_IOCTL_32BIT flag
78607ca46eSDavid Howells  *
79607ca46eSDavid Howells  * 7.17
80607ca46eSDavid Howells  *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
81607ca46eSDavid Howells  *
82607ca46eSDavid Howells  * 7.18
83607ca46eSDavid Howells  *  - add FUSE_IOCTL_DIR flag
84607ca46eSDavid Howells  *  - add FUSE_NOTIFY_DELETE
85607ca46eSDavid Howells  *
86607ca46eSDavid Howells  * 7.19
87607ca46eSDavid Howells  *  - add FUSE_FALLOCATE
88607ca46eSDavid Howells  *
89607ca46eSDavid Howells  * 7.20
90607ca46eSDavid Howells  *  - add FUSE_AUTO_INVAL_DATA
9123c153e5SMiklos Szeredi  *
9223c153e5SMiklos Szeredi  * 7.21
9323c153e5SMiklos Szeredi  *  - add FUSE_READDIRPLUS
940415d291SEnke Chen  *  - send the requested events in POLL request
9560b9df7aSMiklos Szeredi  *
9660b9df7aSMiklos Szeredi  * 7.22
9760b9df7aSMiklos Szeredi  *  - add FUSE_ASYNC_DIO
984d99ff8fSPavel Emelyanov  *
994d99ff8fSPavel Emelyanov  * 7.23
1004d99ff8fSPavel Emelyanov  *  - add FUSE_WRITEBACK_CACHE
101e27c9d38SMiklos Szeredi  *  - add time_gran to fuse_init_out
102e27c9d38SMiklos Szeredi  *  - add reserved space to fuse_init_out
103ab9e13f7SMaxim Patlasov  *  - add FATTR_CTIME
104ab9e13f7SMaxim Patlasov  *  - add ctime and ctimensec to fuse_setattr_in
1051560c974SMiklos Szeredi  *  - add FUSE_RENAME2 request
106d7afaec0SAndrew Gallagher  *  - add FUSE_NO_OPEN_SUPPORT flag
1070b5da8dbSRavishankar N  *
1080b5da8dbSRavishankar N  *  7.24
1090b5da8dbSRavishankar N  *  - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
1105c672ab3SMiklos Szeredi  *
1115c672ab3SMiklos Szeredi  *  7.25
1125c672ab3SMiklos Szeredi  *  - add FUSE_PARALLEL_DIROPS
1135e940c1dSMiklos Szeredi  *
1145e940c1dSMiklos Szeredi  *  7.26
1155e940c1dSMiklos Szeredi  *  - add FUSE_HANDLE_KILLPRIV
11660bcc88aSSeth Forshee  *  - add FUSE_POSIX_ACL
1173b7008b2SSzymon Lukasz  *
1183b7008b2SSzymon Lukasz  *  7.27
1193b7008b2SSzymon Lukasz  *  - add FUSE_ABORT_ERROR
12088bc7d50SNiels de Vos  *
12188bc7d50SNiels de Vos  *  7.28
12288bc7d50SNiels de Vos  *  - add FUSE_COPY_FILE_RANGE
1236433b899SMiklos Szeredi  *  - add FOPEN_CACHE_DIR
1245da784ccSConstantine Shulyupin  *  - add FUSE_MAX_PAGES, add max_pages to init_out
1255571f1e6SDan Schatzberg  *  - add FUSE_CACHE_SYMLINKS
126d9a9ea94SChad Austin  *
127d9a9ea94SChad Austin  *  7.29
128d9a9ea94SChad Austin  *  - add FUSE_NO_OPENDIR_SUPPORT flag
129ad2ba64dSKirill Smelkov  *
130ad2ba64dSKirill Smelkov  *  7.30
131ad2ba64dSKirill Smelkov  *  - add FUSE_EXPLICIT_INVAL_DATA
132*6407f44aSIan Abbott  *  - add FUSE_IOCTL_COMPAT_X32
133607ca46eSDavid Howells  */
134607ca46eSDavid Howells 
135607ca46eSDavid Howells #ifndef _LINUX_FUSE_H
136607ca46eSDavid Howells #define _LINUX_FUSE_H
137607ca46eSDavid Howells 
1384c82456eSMiklos Szeredi #ifdef __KERNEL__
139607ca46eSDavid Howells #include <linux/types.h>
1407e98d530SMiklos Szeredi #else
1417e98d530SMiklos Szeredi #include <stdint.h>
1427e98d530SMiklos Szeredi #endif
143607ca46eSDavid Howells 
144607ca46eSDavid Howells /*
145607ca46eSDavid Howells  * Version negotiation:
146607ca46eSDavid Howells  *
147607ca46eSDavid Howells  * Both the kernel and userspace send the version they support in the
148607ca46eSDavid Howells  * INIT request and reply respectively.
149607ca46eSDavid Howells  *
150607ca46eSDavid Howells  * If the major versions match then both shall use the smallest
151607ca46eSDavid Howells  * of the two minor versions for communication.
152607ca46eSDavid Howells  *
153607ca46eSDavid Howells  * If the kernel supports a larger major version, then userspace shall
154607ca46eSDavid Howells  * reply with the major version it supports, ignore the rest of the
155607ca46eSDavid Howells  * INIT message and expect a new INIT message from the kernel with a
156607ca46eSDavid Howells  * matching major version.
157607ca46eSDavid Howells  *
158607ca46eSDavid Howells  * If the library supports a larger major version, then it shall fall
159607ca46eSDavid Howells  * back to the major protocol version sent by the kernel for
160607ca46eSDavid Howells  * communication and reply with that major version (and an arbitrary
161607ca46eSDavid Howells  * supported minor version).
162607ca46eSDavid Howells  */
163607ca46eSDavid Howells 
164607ca46eSDavid Howells /** Version number of this interface */
165607ca46eSDavid Howells #define FUSE_KERNEL_VERSION 7
166607ca46eSDavid Howells 
167607ca46eSDavid Howells /** Minor version number of this interface */
168ad2ba64dSKirill Smelkov #define FUSE_KERNEL_MINOR_VERSION 30
169607ca46eSDavid Howells 
170607ca46eSDavid Howells /** The node ID of the root inode */
171607ca46eSDavid Howells #define FUSE_ROOT_ID 1
172607ca46eSDavid Howells 
173607ca46eSDavid Howells /* Make sure all structures are padded to 64bit boundary, so 32bit
174607ca46eSDavid Howells    userspace works under 64bit kernels */
175607ca46eSDavid Howells 
176607ca46eSDavid Howells struct fuse_attr {
1774c82456eSMiklos Szeredi 	uint64_t	ino;
1784c82456eSMiklos Szeredi 	uint64_t	size;
1794c82456eSMiklos Szeredi 	uint64_t	blocks;
1804c82456eSMiklos Szeredi 	uint64_t	atime;
1814c82456eSMiklos Szeredi 	uint64_t	mtime;
1824c82456eSMiklos Szeredi 	uint64_t	ctime;
1834c82456eSMiklos Szeredi 	uint32_t	atimensec;
1844c82456eSMiklos Szeredi 	uint32_t	mtimensec;
1854c82456eSMiklos Szeredi 	uint32_t	ctimensec;
1864c82456eSMiklos Szeredi 	uint32_t	mode;
1874c82456eSMiklos Szeredi 	uint32_t	nlink;
1884c82456eSMiklos Szeredi 	uint32_t	uid;
1894c82456eSMiklos Szeredi 	uint32_t	gid;
1904c82456eSMiklos Szeredi 	uint32_t	rdev;
1914c82456eSMiklos Szeredi 	uint32_t	blksize;
1924c82456eSMiklos Szeredi 	uint32_t	padding;
193607ca46eSDavid Howells };
194607ca46eSDavid Howells 
195607ca46eSDavid Howells struct fuse_kstatfs {
1964c82456eSMiklos Szeredi 	uint64_t	blocks;
1974c82456eSMiklos Szeredi 	uint64_t	bfree;
1984c82456eSMiklos Szeredi 	uint64_t	bavail;
1994c82456eSMiklos Szeredi 	uint64_t	files;
2004c82456eSMiklos Szeredi 	uint64_t	ffree;
2014c82456eSMiklos Szeredi 	uint32_t	bsize;
2024c82456eSMiklos Szeredi 	uint32_t	namelen;
2034c82456eSMiklos Szeredi 	uint32_t	frsize;
2044c82456eSMiklos Szeredi 	uint32_t	padding;
2054c82456eSMiklos Szeredi 	uint32_t	spare[6];
206607ca46eSDavid Howells };
207607ca46eSDavid Howells 
208607ca46eSDavid Howells struct fuse_file_lock {
2094c82456eSMiklos Szeredi 	uint64_t	start;
2104c82456eSMiklos Szeredi 	uint64_t	end;
2114c82456eSMiklos Szeredi 	uint32_t	type;
2124c82456eSMiklos Szeredi 	uint32_t	pid; /* tgid */
213607ca46eSDavid Howells };
214607ca46eSDavid Howells 
215607ca46eSDavid Howells /**
216607ca46eSDavid Howells  * Bitmasks for fuse_setattr_in.valid
217607ca46eSDavid Howells  */
218607ca46eSDavid Howells #define FATTR_MODE	(1 << 0)
219607ca46eSDavid Howells #define FATTR_UID	(1 << 1)
220607ca46eSDavid Howells #define FATTR_GID	(1 << 2)
221607ca46eSDavid Howells #define FATTR_SIZE	(1 << 3)
222607ca46eSDavid Howells #define FATTR_ATIME	(1 << 4)
223607ca46eSDavid Howells #define FATTR_MTIME	(1 << 5)
224607ca46eSDavid Howells #define FATTR_FH	(1 << 6)
225607ca46eSDavid Howells #define FATTR_ATIME_NOW	(1 << 7)
226607ca46eSDavid Howells #define FATTR_MTIME_NOW	(1 << 8)
227607ca46eSDavid Howells #define FATTR_LOCKOWNER	(1 << 9)
228ab9e13f7SMaxim Patlasov #define FATTR_CTIME	(1 << 10)
229607ca46eSDavid Howells 
230607ca46eSDavid Howells /**
231607ca46eSDavid Howells  * Flags returned by the OPEN request
232607ca46eSDavid Howells  *
233607ca46eSDavid Howells  * FOPEN_DIRECT_IO: bypass page cache for this open file
234607ca46eSDavid Howells  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
235607ca46eSDavid Howells  * FOPEN_NONSEEKABLE: the file is not seekable
2366433b899SMiklos Szeredi  * FOPEN_CACHE_DIR: allow caching this directory
237bbd84f33SKirill Smelkov  * FOPEN_STREAM: the file is stream-like (no file position at all)
238607ca46eSDavid Howells  */
239607ca46eSDavid Howells #define FOPEN_DIRECT_IO		(1 << 0)
240607ca46eSDavid Howells #define FOPEN_KEEP_CACHE	(1 << 1)
241607ca46eSDavid Howells #define FOPEN_NONSEEKABLE	(1 << 2)
2426433b899SMiklos Szeredi #define FOPEN_CACHE_DIR		(1 << 3)
243bbd84f33SKirill Smelkov #define FOPEN_STREAM		(1 << 4)
244607ca46eSDavid Howells 
245607ca46eSDavid Howells /**
246607ca46eSDavid Howells  * INIT request/reply flags
247607ca46eSDavid Howells  *
248607ca46eSDavid Howells  * FUSE_ASYNC_READ: asynchronous read requests
249607ca46eSDavid Howells  * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
250607ca46eSDavid Howells  * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
251607ca46eSDavid Howells  * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
252607ca46eSDavid Howells  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
253607ca46eSDavid Howells  * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
254607ca46eSDavid Howells  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
255607ca46eSDavid Howells  * FUSE_SPLICE_WRITE: kernel supports splice write on the device
256607ca46eSDavid Howells  * FUSE_SPLICE_MOVE: kernel supports splice move on the device
257607ca46eSDavid Howells  * FUSE_SPLICE_READ: kernel supports splice read on the device
258607ca46eSDavid Howells  * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
259607ca46eSDavid Howells  * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
260607ca46eSDavid Howells  * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
261634734b6SEric Wong  * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
262634734b6SEric Wong  * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
26360b9df7aSMiklos Szeredi  * FUSE_ASYNC_DIO: asynchronous direct I/O submission
2644d99ff8fSPavel Emelyanov  * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
265d7afaec0SAndrew Gallagher  * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
2665c672ab3SMiklos Szeredi  * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
2675e940c1dSMiklos Szeredi  * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
26860bcc88aSSeth Forshee  * FUSE_POSIX_ACL: filesystem supports posix acls
2693b7008b2SSzymon Lukasz  * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
2705da784ccSConstantine Shulyupin  * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
2715571f1e6SDan Schatzberg  * FUSE_CACHE_SYMLINKS: cache READLINK responses
272d9a9ea94SChad Austin  * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
273ad2ba64dSKirill Smelkov  * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
274607ca46eSDavid Howells  */
275607ca46eSDavid Howells #define FUSE_ASYNC_READ		(1 << 0)
276607ca46eSDavid Howells #define FUSE_POSIX_LOCKS	(1 << 1)
277607ca46eSDavid Howells #define FUSE_FILE_OPS		(1 << 2)
278607ca46eSDavid Howells #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
279607ca46eSDavid Howells #define FUSE_EXPORT_SUPPORT	(1 << 4)
280607ca46eSDavid Howells #define FUSE_BIG_WRITES		(1 << 5)
281607ca46eSDavid Howells #define FUSE_DONT_MASK		(1 << 6)
282607ca46eSDavid Howells #define FUSE_SPLICE_WRITE	(1 << 7)
283607ca46eSDavid Howells #define FUSE_SPLICE_MOVE	(1 << 8)
284607ca46eSDavid Howells #define FUSE_SPLICE_READ	(1 << 9)
285607ca46eSDavid Howells #define FUSE_FLOCK_LOCKS	(1 << 10)
286607ca46eSDavid Howells #define FUSE_HAS_IOCTL_DIR	(1 << 11)
287607ca46eSDavid Howells #define FUSE_AUTO_INVAL_DATA	(1 << 12)
2880b05b183SAnand V. Avati #define FUSE_DO_READDIRPLUS	(1 << 13)
289634734b6SEric Wong #define FUSE_READDIRPLUS_AUTO	(1 << 14)
29060b9df7aSMiklos Szeredi #define FUSE_ASYNC_DIO		(1 << 15)
2914d99ff8fSPavel Emelyanov #define FUSE_WRITEBACK_CACHE	(1 << 16)
292d7afaec0SAndrew Gallagher #define FUSE_NO_OPEN_SUPPORT	(1 << 17)
2935c672ab3SMiklos Szeredi #define FUSE_PARALLEL_DIROPS    (1 << 18)
2945e940c1dSMiklos Szeredi #define FUSE_HANDLE_KILLPRIV	(1 << 19)
29560bcc88aSSeth Forshee #define FUSE_POSIX_ACL		(1 << 20)
2963b7008b2SSzymon Lukasz #define FUSE_ABORT_ERROR	(1 << 21)
2975da784ccSConstantine Shulyupin #define FUSE_MAX_PAGES		(1 << 22)
2985571f1e6SDan Schatzberg #define FUSE_CACHE_SYMLINKS	(1 << 23)
299d9a9ea94SChad Austin #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
300ad2ba64dSKirill Smelkov #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
301607ca46eSDavid Howells 
302607ca46eSDavid Howells /**
303607ca46eSDavid Howells  * CUSE INIT request/reply flags
304607ca46eSDavid Howells  *
305607ca46eSDavid Howells  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
306607ca46eSDavid Howells  */
307607ca46eSDavid Howells #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
308607ca46eSDavid Howells 
309607ca46eSDavid Howells /**
310607ca46eSDavid Howells  * Release flags
311607ca46eSDavid Howells  */
312607ca46eSDavid Howells #define FUSE_RELEASE_FLUSH	(1 << 0)
313607ca46eSDavid Howells #define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
314607ca46eSDavid Howells 
315607ca46eSDavid Howells /**
316607ca46eSDavid Howells  * Getattr flags
317607ca46eSDavid Howells  */
318607ca46eSDavid Howells #define FUSE_GETATTR_FH		(1 << 0)
319607ca46eSDavid Howells 
320607ca46eSDavid Howells /**
321607ca46eSDavid Howells  * Lock flags
322607ca46eSDavid Howells  */
323607ca46eSDavid Howells #define FUSE_LK_FLOCK		(1 << 0)
324607ca46eSDavid Howells 
325607ca46eSDavid Howells /**
326607ca46eSDavid Howells  * WRITE flags
327607ca46eSDavid Howells  *
328607ca46eSDavid Howells  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
329607ca46eSDavid Howells  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
330607ca46eSDavid Howells  */
331607ca46eSDavid Howells #define FUSE_WRITE_CACHE	(1 << 0)
332607ca46eSDavid Howells #define FUSE_WRITE_LOCKOWNER	(1 << 1)
333607ca46eSDavid Howells 
334607ca46eSDavid Howells /**
335607ca46eSDavid Howells  * Read flags
336607ca46eSDavid Howells  */
337607ca46eSDavid Howells #define FUSE_READ_LOCKOWNER	(1 << 1)
338607ca46eSDavid Howells 
339607ca46eSDavid Howells /**
340607ca46eSDavid Howells  * Ioctl flags
341607ca46eSDavid Howells  *
342607ca46eSDavid Howells  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
343607ca46eSDavid Howells  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
344607ca46eSDavid Howells  * FUSE_IOCTL_RETRY: retry with new iovecs
345607ca46eSDavid Howells  * FUSE_IOCTL_32BIT: 32bit ioctl
346607ca46eSDavid Howells  * FUSE_IOCTL_DIR: is a directory
347*6407f44aSIan Abbott  * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t)
348607ca46eSDavid Howells  *
349607ca46eSDavid Howells  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
350607ca46eSDavid Howells  */
351607ca46eSDavid Howells #define FUSE_IOCTL_COMPAT	(1 << 0)
352607ca46eSDavid Howells #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
353607ca46eSDavid Howells #define FUSE_IOCTL_RETRY	(1 << 2)
354607ca46eSDavid Howells #define FUSE_IOCTL_32BIT	(1 << 3)
355607ca46eSDavid Howells #define FUSE_IOCTL_DIR		(1 << 4)
356*6407f44aSIan Abbott #define FUSE_IOCTL_COMPAT_X32	(1 << 5)
357607ca46eSDavid Howells 
358607ca46eSDavid Howells #define FUSE_IOCTL_MAX_IOV	256
359607ca46eSDavid Howells 
360607ca46eSDavid Howells /**
361607ca46eSDavid Howells  * Poll flags
362607ca46eSDavid Howells  *
363607ca46eSDavid Howells  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
364607ca46eSDavid Howells  */
365607ca46eSDavid Howells #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
366607ca46eSDavid Howells 
367154603feSAlan Somers /**
368154603feSAlan Somers  * Fsync flags
369154603feSAlan Somers  *
370154603feSAlan Somers  * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata
371154603feSAlan Somers  */
372154603feSAlan Somers #define FUSE_FSYNC_FDATASYNC	(1 << 0)
373154603feSAlan Somers 
374607ca46eSDavid Howells enum fuse_opcode {
375607ca46eSDavid Howells 	FUSE_LOOKUP		= 1,
376607ca46eSDavid Howells 	FUSE_FORGET		= 2,  /* no reply */
377607ca46eSDavid Howells 	FUSE_GETATTR		= 3,
378607ca46eSDavid Howells 	FUSE_SETATTR		= 4,
379607ca46eSDavid Howells 	FUSE_READLINK		= 5,
380607ca46eSDavid Howells 	FUSE_SYMLINK		= 6,
381607ca46eSDavid Howells 	FUSE_MKNOD		= 8,
382607ca46eSDavid Howells 	FUSE_MKDIR		= 9,
383607ca46eSDavid Howells 	FUSE_UNLINK		= 10,
384607ca46eSDavid Howells 	FUSE_RMDIR		= 11,
385607ca46eSDavid Howells 	FUSE_RENAME		= 12,
386607ca46eSDavid Howells 	FUSE_LINK		= 13,
387607ca46eSDavid Howells 	FUSE_OPEN		= 14,
388607ca46eSDavid Howells 	FUSE_READ		= 15,
389607ca46eSDavid Howells 	FUSE_WRITE		= 16,
390607ca46eSDavid Howells 	FUSE_STATFS		= 17,
391607ca46eSDavid Howells 	FUSE_RELEASE		= 18,
392607ca46eSDavid Howells 	FUSE_FSYNC		= 20,
393607ca46eSDavid Howells 	FUSE_SETXATTR		= 21,
394607ca46eSDavid Howells 	FUSE_GETXATTR		= 22,
395607ca46eSDavid Howells 	FUSE_LISTXATTR		= 23,
396607ca46eSDavid Howells 	FUSE_REMOVEXATTR	= 24,
397607ca46eSDavid Howells 	FUSE_FLUSH		= 25,
398607ca46eSDavid Howells 	FUSE_INIT		= 26,
399607ca46eSDavid Howells 	FUSE_OPENDIR		= 27,
400607ca46eSDavid Howells 	FUSE_READDIR		= 28,
401607ca46eSDavid Howells 	FUSE_RELEASEDIR		= 29,
402607ca46eSDavid Howells 	FUSE_FSYNCDIR		= 30,
403607ca46eSDavid Howells 	FUSE_GETLK		= 31,
404607ca46eSDavid Howells 	FUSE_SETLK		= 32,
405607ca46eSDavid Howells 	FUSE_SETLKW		= 33,
406607ca46eSDavid Howells 	FUSE_ACCESS		= 34,
407607ca46eSDavid Howells 	FUSE_CREATE		= 35,
408607ca46eSDavid Howells 	FUSE_INTERRUPT		= 36,
409607ca46eSDavid Howells 	FUSE_BMAP		= 37,
410607ca46eSDavid Howells 	FUSE_DESTROY		= 38,
411607ca46eSDavid Howells 	FUSE_IOCTL		= 39,
412607ca46eSDavid Howells 	FUSE_POLL		= 40,
413607ca46eSDavid Howells 	FUSE_NOTIFY_REPLY	= 41,
414607ca46eSDavid Howells 	FUSE_BATCH_FORGET	= 42,
415607ca46eSDavid Howells 	FUSE_FALLOCATE		= 43,
4160b05b183SAnand V. Avati 	FUSE_READDIRPLUS	= 44,
4171560c974SMiklos Szeredi 	FUSE_RENAME2		= 45,
4180b5da8dbSRavishankar N 	FUSE_LSEEK		= 46,
41988bc7d50SNiels de Vos 	FUSE_COPY_FILE_RANGE	= 47,
420607ca46eSDavid Howells 
421607ca46eSDavid Howells 	/* CUSE specific operations */
422607ca46eSDavid Howells 	CUSE_INIT		= 4096,
423607ca46eSDavid Howells };
424607ca46eSDavid Howells 
425607ca46eSDavid Howells enum fuse_notify_code {
426607ca46eSDavid Howells 	FUSE_NOTIFY_POLL   = 1,
427607ca46eSDavid Howells 	FUSE_NOTIFY_INVAL_INODE = 2,
428607ca46eSDavid Howells 	FUSE_NOTIFY_INVAL_ENTRY = 3,
429607ca46eSDavid Howells 	FUSE_NOTIFY_STORE = 4,
430607ca46eSDavid Howells 	FUSE_NOTIFY_RETRIEVE = 5,
431607ca46eSDavid Howells 	FUSE_NOTIFY_DELETE = 6,
432607ca46eSDavid Howells 	FUSE_NOTIFY_CODE_MAX,
433607ca46eSDavid Howells };
434607ca46eSDavid Howells 
435607ca46eSDavid Howells /* The read buffer is required to be at least 8k, but may be much larger */
436607ca46eSDavid Howells #define FUSE_MIN_READ_BUFFER 8192
437607ca46eSDavid Howells 
438607ca46eSDavid Howells #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
439607ca46eSDavid Howells 
440607ca46eSDavid Howells struct fuse_entry_out {
4414c82456eSMiklos Szeredi 	uint64_t	nodeid;		/* Inode ID */
4424c82456eSMiklos Szeredi 	uint64_t	generation;	/* Inode generation: nodeid:gen must
443607ca46eSDavid Howells 					   be unique for the fs's lifetime */
4444c82456eSMiklos Szeredi 	uint64_t	entry_valid;	/* Cache timeout for the name */
4454c82456eSMiklos Szeredi 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
4464c82456eSMiklos Szeredi 	uint32_t	entry_valid_nsec;
4474c82456eSMiklos Szeredi 	uint32_t	attr_valid_nsec;
448607ca46eSDavid Howells 	struct fuse_attr attr;
449607ca46eSDavid Howells };
450607ca46eSDavid Howells 
451607ca46eSDavid Howells struct fuse_forget_in {
4524c82456eSMiklos Szeredi 	uint64_t	nlookup;
453607ca46eSDavid Howells };
454607ca46eSDavid Howells 
455607ca46eSDavid Howells struct fuse_forget_one {
4564c82456eSMiklos Szeredi 	uint64_t	nodeid;
4574c82456eSMiklos Szeredi 	uint64_t	nlookup;
458607ca46eSDavid Howells };
459607ca46eSDavid Howells 
460607ca46eSDavid Howells struct fuse_batch_forget_in {
4614c82456eSMiklos Szeredi 	uint32_t	count;
4624c82456eSMiklos Szeredi 	uint32_t	dummy;
463607ca46eSDavid Howells };
464607ca46eSDavid Howells 
465607ca46eSDavid Howells struct fuse_getattr_in {
4664c82456eSMiklos Szeredi 	uint32_t	getattr_flags;
4674c82456eSMiklos Szeredi 	uint32_t	dummy;
4684c82456eSMiklos Szeredi 	uint64_t	fh;
469607ca46eSDavid Howells };
470607ca46eSDavid Howells 
471607ca46eSDavid Howells #define FUSE_COMPAT_ATTR_OUT_SIZE 96
472607ca46eSDavid Howells 
473607ca46eSDavid Howells struct fuse_attr_out {
4744c82456eSMiklos Szeredi 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
4754c82456eSMiklos Szeredi 	uint32_t	attr_valid_nsec;
4764c82456eSMiklos Szeredi 	uint32_t	dummy;
477607ca46eSDavid Howells 	struct fuse_attr attr;
478607ca46eSDavid Howells };
479607ca46eSDavid Howells 
480607ca46eSDavid Howells #define FUSE_COMPAT_MKNOD_IN_SIZE 8
481607ca46eSDavid Howells 
482607ca46eSDavid Howells struct fuse_mknod_in {
4834c82456eSMiklos Szeredi 	uint32_t	mode;
4844c82456eSMiklos Szeredi 	uint32_t	rdev;
4854c82456eSMiklos Szeredi 	uint32_t	umask;
4864c82456eSMiklos Szeredi 	uint32_t	padding;
487607ca46eSDavid Howells };
488607ca46eSDavid Howells 
489607ca46eSDavid Howells struct fuse_mkdir_in {
4904c82456eSMiklos Szeredi 	uint32_t	mode;
4914c82456eSMiklos Szeredi 	uint32_t	umask;
492607ca46eSDavid Howells };
493607ca46eSDavid Howells 
494607ca46eSDavid Howells struct fuse_rename_in {
4954c82456eSMiklos Szeredi 	uint64_t	newdir;
496607ca46eSDavid Howells };
497607ca46eSDavid Howells 
4981560c974SMiklos Szeredi struct fuse_rename2_in {
4991560c974SMiklos Szeredi 	uint64_t	newdir;
5001560c974SMiklos Szeredi 	uint32_t	flags;
5011560c974SMiklos Szeredi 	uint32_t	padding;
5021560c974SMiklos Szeredi };
5031560c974SMiklos Szeredi 
504607ca46eSDavid Howells struct fuse_link_in {
5054c82456eSMiklos Szeredi 	uint64_t	oldnodeid;
506607ca46eSDavid Howells };
507607ca46eSDavid Howells 
508607ca46eSDavid Howells struct fuse_setattr_in {
5094c82456eSMiklos Szeredi 	uint32_t	valid;
5104c82456eSMiklos Szeredi 	uint32_t	padding;
5114c82456eSMiklos Szeredi 	uint64_t	fh;
5124c82456eSMiklos Szeredi 	uint64_t	size;
5134c82456eSMiklos Szeredi 	uint64_t	lock_owner;
5144c82456eSMiklos Szeredi 	uint64_t	atime;
5154c82456eSMiklos Szeredi 	uint64_t	mtime;
516ab9e13f7SMaxim Patlasov 	uint64_t	ctime;
5174c82456eSMiklos Szeredi 	uint32_t	atimensec;
5184c82456eSMiklos Szeredi 	uint32_t	mtimensec;
519ab9e13f7SMaxim Patlasov 	uint32_t	ctimensec;
5204c82456eSMiklos Szeredi 	uint32_t	mode;
5214c82456eSMiklos Szeredi 	uint32_t	unused4;
5224c82456eSMiklos Szeredi 	uint32_t	uid;
5234c82456eSMiklos Szeredi 	uint32_t	gid;
5244c82456eSMiklos Szeredi 	uint32_t	unused5;
525607ca46eSDavid Howells };
526607ca46eSDavid Howells 
527607ca46eSDavid Howells struct fuse_open_in {
5284c82456eSMiklos Szeredi 	uint32_t	flags;
5294c82456eSMiklos Szeredi 	uint32_t	unused;
530607ca46eSDavid Howells };
531607ca46eSDavid Howells 
532607ca46eSDavid Howells struct fuse_create_in {
5334c82456eSMiklos Szeredi 	uint32_t	flags;
5344c82456eSMiklos Szeredi 	uint32_t	mode;
5354c82456eSMiklos Szeredi 	uint32_t	umask;
5364c82456eSMiklos Szeredi 	uint32_t	padding;
537607ca46eSDavid Howells };
538607ca46eSDavid Howells 
539607ca46eSDavid Howells struct fuse_open_out {
5404c82456eSMiklos Szeredi 	uint64_t	fh;
5414c82456eSMiklos Szeredi 	uint32_t	open_flags;
5424c82456eSMiklos Szeredi 	uint32_t	padding;
543607ca46eSDavid Howells };
544607ca46eSDavid Howells 
545607ca46eSDavid Howells struct fuse_release_in {
5464c82456eSMiklos Szeredi 	uint64_t	fh;
5474c82456eSMiklos Szeredi 	uint32_t	flags;
5484c82456eSMiklos Szeredi 	uint32_t	release_flags;
5494c82456eSMiklos Szeredi 	uint64_t	lock_owner;
550607ca46eSDavid Howells };
551607ca46eSDavid Howells 
552607ca46eSDavid Howells struct fuse_flush_in {
5534c82456eSMiklos Szeredi 	uint64_t	fh;
5544c82456eSMiklos Szeredi 	uint32_t	unused;
5554c82456eSMiklos Szeredi 	uint32_t	padding;
5564c82456eSMiklos Szeredi 	uint64_t	lock_owner;
557607ca46eSDavid Howells };
558607ca46eSDavid Howells 
559607ca46eSDavid Howells struct fuse_read_in {
5604c82456eSMiklos Szeredi 	uint64_t	fh;
5614c82456eSMiklos Szeredi 	uint64_t	offset;
5624c82456eSMiklos Szeredi 	uint32_t	size;
5634c82456eSMiklos Szeredi 	uint32_t	read_flags;
5644c82456eSMiklos Szeredi 	uint64_t	lock_owner;
5654c82456eSMiklos Szeredi 	uint32_t	flags;
5664c82456eSMiklos Szeredi 	uint32_t	padding;
567607ca46eSDavid Howells };
568607ca46eSDavid Howells 
569607ca46eSDavid Howells #define FUSE_COMPAT_WRITE_IN_SIZE 24
570607ca46eSDavid Howells 
571607ca46eSDavid Howells struct fuse_write_in {
5724c82456eSMiklos Szeredi 	uint64_t	fh;
5734c82456eSMiklos Szeredi 	uint64_t	offset;
5744c82456eSMiklos Szeredi 	uint32_t	size;
5754c82456eSMiklos Szeredi 	uint32_t	write_flags;
5764c82456eSMiklos Szeredi 	uint64_t	lock_owner;
5774c82456eSMiklos Szeredi 	uint32_t	flags;
5784c82456eSMiklos Szeredi 	uint32_t	padding;
579607ca46eSDavid Howells };
580607ca46eSDavid Howells 
581607ca46eSDavid Howells struct fuse_write_out {
5824c82456eSMiklos Szeredi 	uint32_t	size;
5834c82456eSMiklos Szeredi 	uint32_t	padding;
584607ca46eSDavid Howells };
585607ca46eSDavid Howells 
586607ca46eSDavid Howells #define FUSE_COMPAT_STATFS_SIZE 48
587607ca46eSDavid Howells 
588607ca46eSDavid Howells struct fuse_statfs_out {
589607ca46eSDavid Howells 	struct fuse_kstatfs st;
590607ca46eSDavid Howells };
591607ca46eSDavid Howells 
592607ca46eSDavid Howells struct fuse_fsync_in {
5934c82456eSMiklos Szeredi 	uint64_t	fh;
5944c82456eSMiklos Szeredi 	uint32_t	fsync_flags;
5954c82456eSMiklos Szeredi 	uint32_t	padding;
596607ca46eSDavid Howells };
597607ca46eSDavid Howells 
598607ca46eSDavid Howells struct fuse_setxattr_in {
5994c82456eSMiklos Szeredi 	uint32_t	size;
6004c82456eSMiklos Szeredi 	uint32_t	flags;
601607ca46eSDavid Howells };
602607ca46eSDavid Howells 
603607ca46eSDavid Howells struct fuse_getxattr_in {
6044c82456eSMiklos Szeredi 	uint32_t	size;
6054c82456eSMiklos Szeredi 	uint32_t	padding;
606607ca46eSDavid Howells };
607607ca46eSDavid Howells 
608607ca46eSDavid Howells struct fuse_getxattr_out {
6094c82456eSMiklos Szeredi 	uint32_t	size;
6104c82456eSMiklos Szeredi 	uint32_t	padding;
611607ca46eSDavid Howells };
612607ca46eSDavid Howells 
613607ca46eSDavid Howells struct fuse_lk_in {
6144c82456eSMiklos Szeredi 	uint64_t	fh;
6154c82456eSMiklos Szeredi 	uint64_t	owner;
616607ca46eSDavid Howells 	struct fuse_file_lock lk;
6174c82456eSMiklos Szeredi 	uint32_t	lk_flags;
6184c82456eSMiklos Szeredi 	uint32_t	padding;
619607ca46eSDavid Howells };
620607ca46eSDavid Howells 
621607ca46eSDavid Howells struct fuse_lk_out {
622607ca46eSDavid Howells 	struct fuse_file_lock lk;
623607ca46eSDavid Howells };
624607ca46eSDavid Howells 
625607ca46eSDavid Howells struct fuse_access_in {
6264c82456eSMiklos Szeredi 	uint32_t	mask;
6274c82456eSMiklos Szeredi 	uint32_t	padding;
628607ca46eSDavid Howells };
629607ca46eSDavid Howells 
630607ca46eSDavid Howells struct fuse_init_in {
6314c82456eSMiklos Szeredi 	uint32_t	major;
6324c82456eSMiklos Szeredi 	uint32_t	minor;
6334c82456eSMiklos Szeredi 	uint32_t	max_readahead;
6344c82456eSMiklos Szeredi 	uint32_t	flags;
635607ca46eSDavid Howells };
636607ca46eSDavid Howells 
637e27c9d38SMiklos Szeredi #define FUSE_COMPAT_INIT_OUT_SIZE 8
638e27c9d38SMiklos Szeredi #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
639e27c9d38SMiklos Szeredi 
640607ca46eSDavid Howells struct fuse_init_out {
6414c82456eSMiklos Szeredi 	uint32_t	major;
6424c82456eSMiklos Szeredi 	uint32_t	minor;
6434c82456eSMiklos Szeredi 	uint32_t	max_readahead;
6444c82456eSMiklos Szeredi 	uint32_t	flags;
6454c82456eSMiklos Szeredi 	uint16_t	max_background;
6464c82456eSMiklos Szeredi 	uint16_t	congestion_threshold;
6474c82456eSMiklos Szeredi 	uint32_t	max_write;
648e27c9d38SMiklos Szeredi 	uint32_t	time_gran;
6495da784ccSConstantine Shulyupin 	uint16_t	max_pages;
6505da784ccSConstantine Shulyupin 	uint16_t	padding;
6515da784ccSConstantine Shulyupin 	uint32_t	unused[8];
652607ca46eSDavid Howells };
653607ca46eSDavid Howells 
654607ca46eSDavid Howells #define CUSE_INIT_INFO_MAX 4096
655607ca46eSDavid Howells 
656607ca46eSDavid Howells struct cuse_init_in {
6574c82456eSMiklos Szeredi 	uint32_t	major;
6584c82456eSMiklos Szeredi 	uint32_t	minor;
6594c82456eSMiklos Szeredi 	uint32_t	unused;
6604c82456eSMiklos Szeredi 	uint32_t	flags;
661607ca46eSDavid Howells };
662607ca46eSDavid Howells 
663607ca46eSDavid Howells struct cuse_init_out {
6644c82456eSMiklos Szeredi 	uint32_t	major;
6654c82456eSMiklos Szeredi 	uint32_t	minor;
6664c82456eSMiklos Szeredi 	uint32_t	unused;
6674c82456eSMiklos Szeredi 	uint32_t	flags;
6684c82456eSMiklos Szeredi 	uint32_t	max_read;
6694c82456eSMiklos Szeredi 	uint32_t	max_write;
6704c82456eSMiklos Szeredi 	uint32_t	dev_major;		/* chardev major */
6714c82456eSMiklos Szeredi 	uint32_t	dev_minor;		/* chardev minor */
6724c82456eSMiklos Szeredi 	uint32_t	spare[10];
673607ca46eSDavid Howells };
674607ca46eSDavid Howells 
675607ca46eSDavid Howells struct fuse_interrupt_in {
6764c82456eSMiklos Szeredi 	uint64_t	unique;
677607ca46eSDavid Howells };
678607ca46eSDavid Howells 
679607ca46eSDavid Howells struct fuse_bmap_in {
6804c82456eSMiklos Szeredi 	uint64_t	block;
6814c82456eSMiklos Szeredi 	uint32_t	blocksize;
6824c82456eSMiklos Szeredi 	uint32_t	padding;
683607ca46eSDavid Howells };
684607ca46eSDavid Howells 
685607ca46eSDavid Howells struct fuse_bmap_out {
6864c82456eSMiklos Szeredi 	uint64_t	block;
687607ca46eSDavid Howells };
688607ca46eSDavid Howells 
689607ca46eSDavid Howells struct fuse_ioctl_in {
6904c82456eSMiklos Szeredi 	uint64_t	fh;
6914c82456eSMiklos Szeredi 	uint32_t	flags;
6924c82456eSMiklos Szeredi 	uint32_t	cmd;
6934c82456eSMiklos Szeredi 	uint64_t	arg;
6944c82456eSMiklos Szeredi 	uint32_t	in_size;
6954c82456eSMiklos Szeredi 	uint32_t	out_size;
696607ca46eSDavid Howells };
697607ca46eSDavid Howells 
698607ca46eSDavid Howells struct fuse_ioctl_iovec {
6994c82456eSMiklos Szeredi 	uint64_t	base;
7004c82456eSMiklos Szeredi 	uint64_t	len;
701607ca46eSDavid Howells };
702607ca46eSDavid Howells 
703607ca46eSDavid Howells struct fuse_ioctl_out {
7044c82456eSMiklos Szeredi 	int32_t		result;
7054c82456eSMiklos Szeredi 	uint32_t	flags;
7064c82456eSMiklos Szeredi 	uint32_t	in_iovs;
7074c82456eSMiklos Szeredi 	uint32_t	out_iovs;
708607ca46eSDavid Howells };
709607ca46eSDavid Howells 
710607ca46eSDavid Howells struct fuse_poll_in {
7114c82456eSMiklos Szeredi 	uint64_t	fh;
7124c82456eSMiklos Szeredi 	uint64_t	kh;
7134c82456eSMiklos Szeredi 	uint32_t	flags;
7144c82456eSMiklos Szeredi 	uint32_t	events;
715607ca46eSDavid Howells };
716607ca46eSDavid Howells 
717607ca46eSDavid Howells struct fuse_poll_out {
7184c82456eSMiklos Szeredi 	uint32_t	revents;
7194c82456eSMiklos Szeredi 	uint32_t	padding;
720607ca46eSDavid Howells };
721607ca46eSDavid Howells 
722607ca46eSDavid Howells struct fuse_notify_poll_wakeup_out {
7234c82456eSMiklos Szeredi 	uint64_t	kh;
724607ca46eSDavid Howells };
725607ca46eSDavid Howells 
726607ca46eSDavid Howells struct fuse_fallocate_in {
7274c82456eSMiklos Szeredi 	uint64_t	fh;
7284c82456eSMiklos Szeredi 	uint64_t	offset;
7294c82456eSMiklos Szeredi 	uint64_t	length;
7304c82456eSMiklos Szeredi 	uint32_t	mode;
7314c82456eSMiklos Szeredi 	uint32_t	padding;
732607ca46eSDavid Howells };
733607ca46eSDavid Howells 
734607ca46eSDavid Howells struct fuse_in_header {
7354c82456eSMiklos Szeredi 	uint32_t	len;
7364c82456eSMiklos Szeredi 	uint32_t	opcode;
7374c82456eSMiklos Szeredi 	uint64_t	unique;
7384c82456eSMiklos Szeredi 	uint64_t	nodeid;
7394c82456eSMiklos Szeredi 	uint32_t	uid;
7404c82456eSMiklos Szeredi 	uint32_t	gid;
7414c82456eSMiklos Szeredi 	uint32_t	pid;
7424c82456eSMiklos Szeredi 	uint32_t	padding;
743607ca46eSDavid Howells };
744607ca46eSDavid Howells 
745607ca46eSDavid Howells struct fuse_out_header {
7464c82456eSMiklos Szeredi 	uint32_t	len;
7474c82456eSMiklos Szeredi 	int32_t		error;
7484c82456eSMiklos Szeredi 	uint64_t	unique;
749607ca46eSDavid Howells };
750607ca46eSDavid Howells 
751607ca46eSDavid Howells struct fuse_dirent {
7524c82456eSMiklos Szeredi 	uint64_t	ino;
7534c82456eSMiklos Szeredi 	uint64_t	off;
7544c82456eSMiklos Szeredi 	uint32_t	namelen;
7554c82456eSMiklos Szeredi 	uint32_t	type;
756607ca46eSDavid Howells 	char name[];
757607ca46eSDavid Howells };
758607ca46eSDavid Howells 
759607ca46eSDavid Howells #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
7604c82456eSMiklos Szeredi #define FUSE_DIRENT_ALIGN(x) \
7614c82456eSMiklos Szeredi 	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
762607ca46eSDavid Howells #define FUSE_DIRENT_SIZE(d) \
763607ca46eSDavid Howells 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
764607ca46eSDavid Howells 
7650b05b183SAnand V. Avati struct fuse_direntplus {
7660b05b183SAnand V. Avati 	struct fuse_entry_out entry_out;
7670b05b183SAnand V. Avati 	struct fuse_dirent dirent;
7680b05b183SAnand V. Avati };
7690b05b183SAnand V. Avati 
7700b05b183SAnand V. Avati #define FUSE_NAME_OFFSET_DIRENTPLUS \
7710b05b183SAnand V. Avati 	offsetof(struct fuse_direntplus, dirent.name)
7720b05b183SAnand V. Avati #define FUSE_DIRENTPLUS_SIZE(d) \
7730b05b183SAnand V. Avati 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
7740b05b183SAnand V. Avati 
775607ca46eSDavid Howells struct fuse_notify_inval_inode_out {
7764c82456eSMiklos Szeredi 	uint64_t	ino;
7774c82456eSMiklos Szeredi 	int64_t		off;
7784c82456eSMiklos Szeredi 	int64_t		len;
779607ca46eSDavid Howells };
780607ca46eSDavid Howells 
781607ca46eSDavid Howells struct fuse_notify_inval_entry_out {
7824c82456eSMiklos Szeredi 	uint64_t	parent;
7834c82456eSMiklos Szeredi 	uint32_t	namelen;
7844c82456eSMiklos Szeredi 	uint32_t	padding;
785607ca46eSDavid Howells };
786607ca46eSDavid Howells 
787607ca46eSDavid Howells struct fuse_notify_delete_out {
7884c82456eSMiklos Szeredi 	uint64_t	parent;
7894c82456eSMiklos Szeredi 	uint64_t	child;
7904c82456eSMiklos Szeredi 	uint32_t	namelen;
7914c82456eSMiklos Szeredi 	uint32_t	padding;
792607ca46eSDavid Howells };
793607ca46eSDavid Howells 
794607ca46eSDavid Howells struct fuse_notify_store_out {
7954c82456eSMiklos Szeredi 	uint64_t	nodeid;
7964c82456eSMiklos Szeredi 	uint64_t	offset;
7974c82456eSMiklos Szeredi 	uint32_t	size;
7984c82456eSMiklos Szeredi 	uint32_t	padding;
799607ca46eSDavid Howells };
800607ca46eSDavid Howells 
801607ca46eSDavid Howells struct fuse_notify_retrieve_out {
8024c82456eSMiklos Szeredi 	uint64_t	notify_unique;
8034c82456eSMiklos Szeredi 	uint64_t	nodeid;
8044c82456eSMiklos Szeredi 	uint64_t	offset;
8054c82456eSMiklos Szeredi 	uint32_t	size;
8064c82456eSMiklos Szeredi 	uint32_t	padding;
807607ca46eSDavid Howells };
808607ca46eSDavid Howells 
809607ca46eSDavid Howells /* Matches the size of fuse_write_in */
810607ca46eSDavid Howells struct fuse_notify_retrieve_in {
8114c82456eSMiklos Szeredi 	uint64_t	dummy1;
8124c82456eSMiklos Szeredi 	uint64_t	offset;
8134c82456eSMiklos Szeredi 	uint32_t	size;
8144c82456eSMiklos Szeredi 	uint32_t	dummy2;
8154c82456eSMiklos Szeredi 	uint64_t	dummy3;
8164c82456eSMiklos Szeredi 	uint64_t	dummy4;
817607ca46eSDavid Howells };
818607ca46eSDavid Howells 
81900c570f4SMiklos Szeredi /* Device ioctls: */
82000c570f4SMiklos Szeredi #define FUSE_DEV_IOC_CLONE	_IOR(229, 0, uint32_t)
82100c570f4SMiklos Szeredi 
8220b5da8dbSRavishankar N struct fuse_lseek_in {
8230b5da8dbSRavishankar N 	uint64_t	fh;
8240b5da8dbSRavishankar N 	uint64_t	offset;
8250b5da8dbSRavishankar N 	uint32_t	whence;
8260b5da8dbSRavishankar N 	uint32_t	padding;
8270b5da8dbSRavishankar N };
8280b5da8dbSRavishankar N 
8290b5da8dbSRavishankar N struct fuse_lseek_out {
8300b5da8dbSRavishankar N 	uint64_t	offset;
8310b5da8dbSRavishankar N };
8320b5da8dbSRavishankar N 
83388bc7d50SNiels de Vos struct fuse_copy_file_range_in {
83488bc7d50SNiels de Vos 	uint64_t	fh_in;
83588bc7d50SNiels de Vos 	uint64_t	off_in;
83688bc7d50SNiels de Vos 	uint64_t	nodeid_out;
83788bc7d50SNiels de Vos 	uint64_t	fh_out;
83888bc7d50SNiels de Vos 	uint64_t	off_out;
83988bc7d50SNiels de Vos 	uint64_t	len;
84088bc7d50SNiels de Vos 	uint64_t	flags;
84188bc7d50SNiels de Vos };
84288bc7d50SNiels de Vos 
843607ca46eSDavid Howells #endif /* _LINUX_FUSE_H */
844