xref: /freebsd/sys/fs/fuse/fuse_kernel.h (revision a3a1ce3794e85fe27cb5af5e9f48a490a9ef70c2)
192bbfe1fSAlan Somers /*-
292bbfe1fSAlan Somers  * SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)
392bbfe1fSAlan Somers  *
45fe58019SAttilio Rao  * This file defines the kernel interface of FUSE
59c62bc70SAlan Somers  * Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu>
65fe58019SAttilio Rao  *
75fe58019SAttilio Rao  * This program can be distributed under the terms of the GNU GPL.
85fe58019SAttilio Rao  * See the file COPYING.
95fe58019SAttilio Rao  *
105fe58019SAttilio Rao  * This -- and only this -- header file may also be distributed under
115fe58019SAttilio Rao  * the terms of the BSD Licence as follows:
125fe58019SAttilio Rao  *
135fe58019SAttilio Rao  * Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
145fe58019SAttilio Rao  *
155fe58019SAttilio Rao  * Redistribution and use in source and binary forms, with or without
165fe58019SAttilio Rao  * modification, are permitted provided that the following conditions
175fe58019SAttilio Rao  * are met:
185fe58019SAttilio Rao  * 1. Redistributions of source code must retain the above copyright
195fe58019SAttilio Rao  *    notice, this list of conditions and the following disclaimer.
205fe58019SAttilio Rao  * 2. Redistributions in binary form must reproduce the above copyright
215fe58019SAttilio Rao  *    notice, this list of conditions and the following disclaimer in the
225fe58019SAttilio Rao  *    documentation and/or other materials provided with the distribution.
235fe58019SAttilio Rao  *
245fe58019SAttilio Rao  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
255fe58019SAttilio Rao  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
265fe58019SAttilio Rao  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
275fe58019SAttilio Rao  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
285fe58019SAttilio Rao  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
295fe58019SAttilio Rao  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
305fe58019SAttilio Rao  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
315fe58019SAttilio Rao  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
325fe58019SAttilio Rao  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
335fe58019SAttilio Rao  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
345fe58019SAttilio Rao  * SUCH DAMAGE.
355fe58019SAttilio Rao  *
365fe58019SAttilio Rao  * $FreeBSD$
375fe58019SAttilio Rao  */
385fe58019SAttilio Rao 
3916bd2d47SAlan Somers /*
4016bd2d47SAlan Somers  * This file defines the kernel interface of FUSE
4116bd2d47SAlan Somers  *
4216bd2d47SAlan Somers  * Protocol changelog:
4316bd2d47SAlan Somers  *
44*a3a1ce37SAlan Somers  * 7.1:
45*a3a1ce37SAlan Somers  *  - add the following messages:
46*a3a1ce37SAlan Somers  *      FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,
47*a3a1ce37SAlan Somers  *      FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,
48*a3a1ce37SAlan Somers  *      FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,
49*a3a1ce37SAlan Somers  *      FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,
50*a3a1ce37SAlan Somers  *      FUSE_RELEASEDIR
51*a3a1ce37SAlan Somers  *  - add padding to messages to accommodate 32-bit servers on 64-bit kernels
52*a3a1ce37SAlan Somers  *
53*a3a1ce37SAlan Somers  * 7.2:
54*a3a1ce37SAlan Somers  *  - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags
55*a3a1ce37SAlan Somers  *  - add FUSE_FSYNCDIR message
56*a3a1ce37SAlan Somers  *
57*a3a1ce37SAlan Somers  * 7.3:
58*a3a1ce37SAlan Somers  *  - add FUSE_ACCESS message
59*a3a1ce37SAlan Somers  *  - add FUSE_CREATE message
60*a3a1ce37SAlan Somers  *  - add filehandle to fuse_setattr_in
61*a3a1ce37SAlan Somers  *
62*a3a1ce37SAlan Somers  * 7.4:
63*a3a1ce37SAlan Somers  *  - add frsize to fuse_kstatfs
64*a3a1ce37SAlan Somers  *  - clean up request size limit checking
65*a3a1ce37SAlan Somers  *
66*a3a1ce37SAlan Somers  * 7.5:
67*a3a1ce37SAlan Somers  *  - add flags and max_write to fuse_init_out
68*a3a1ce37SAlan Somers  *
69*a3a1ce37SAlan Somers  * 7.6:
70*a3a1ce37SAlan Somers  *  - add max_readahead to fuse_init_in and fuse_init_out
71*a3a1ce37SAlan Somers  *
72*a3a1ce37SAlan Somers  * 7.7:
73*a3a1ce37SAlan Somers  *  - add FUSE_INTERRUPT message
74*a3a1ce37SAlan Somers  *  - add POSIX file lock support
75*a3a1ce37SAlan Somers  *
76*a3a1ce37SAlan Somers  * 7.8:
77*a3a1ce37SAlan Somers  *  - add lock_owner and flags fields to fuse_release_in
78*a3a1ce37SAlan Somers  *  - add FUSE_BMAP message
79*a3a1ce37SAlan Somers  *  - add FUSE_DESTROY message
80*a3a1ce37SAlan Somers  *
8116bd2d47SAlan Somers  * 7.9:
8216bd2d47SAlan Somers  *  - new fuse_getattr_in input argument of GETATTR
8316bd2d47SAlan Somers  *  - add lk_flags in fuse_lk_in
8416bd2d47SAlan Somers  *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
8516bd2d47SAlan Somers  *  - add blksize field to fuse_attr
8616bd2d47SAlan Somers  *  - add file flags field to fuse_read_in and fuse_write_in
87*a3a1ce37SAlan Somers  *  - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
883f105d16SAlan Somers  *
893f105d16SAlan Somers  * 7.10
903f105d16SAlan Somers  *  - add nonseekable open flag
919c62bc70SAlan Somers  *
929c62bc70SAlan Somers  * 7.11
939c62bc70SAlan Somers  *  - add IOCTL message
949c62bc70SAlan Somers  *  - add unsolicited notification support
95*a3a1ce37SAlan Somers  *  - add POLL message and NOTIFY_POLL notification
96a4856c96SAlan Somers  *
97a4856c96SAlan Somers  * 7.12
98*a3a1ce37SAlan Somers  *  - add umask flag to input argument of create, mknod and mkdir
99a4856c96SAlan Somers  *  - add notification messages for invalidation of inodes and
100a4856c96SAlan Somers  *    directory entries
1012ffddc5eSAlan Somers  *
1022ffddc5eSAlan Somers  * 7.13
1032ffddc5eSAlan Somers  *  - make max number of background requests and congestion threshold
1042ffddc5eSAlan Somers  *    tunables
105bb23d439SAlan Somers  *
106bb23d439SAlan Somers  * 7.14
107bb23d439SAlan Somers  *  - add splice support to fuse device
1087cbb8e8aSAlan Somers  *
1097cbb8e8aSAlan Somers  * 7.15
1107cbb8e8aSAlan Somers  *  - add store notify
1117cbb8e8aSAlan Somers  *  - add retrieve notify
112b160acd1SAlan Somers  *
113b160acd1SAlan Somers  * 7.16
114b160acd1SAlan Somers  *  - add BATCH_FORGET request
115b160acd1SAlan Somers  *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
116b160acd1SAlan Somers  *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
117b160acd1SAlan Somers  *  - add FUSE_IOCTL_32BIT flag
118b160acd1SAlan Somers  *
119b160acd1SAlan Somers  * 7.17
120b160acd1SAlan Somers  *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
121b160acd1SAlan Somers  *
122b160acd1SAlan Somers  * 7.18
123b160acd1SAlan Somers  *  - add FUSE_IOCTL_DIR flag
124b160acd1SAlan Somers  *  - add FUSE_NOTIFY_DELETE
125b160acd1SAlan Somers  *
126b160acd1SAlan Somers  * 7.19
127b160acd1SAlan Somers  *  - add FUSE_FALLOCATE
128b160acd1SAlan Somers  *
129b160acd1SAlan Somers  * 7.20
130b160acd1SAlan Somers  *  - add FUSE_AUTO_INVAL_DATA
131*a3a1ce37SAlan Somers  *
132b160acd1SAlan Somers  * 7.21
133b160acd1SAlan Somers  *  - add FUSE_READDIRPLUS
134b160acd1SAlan Somers  *  - send the requested events in POLL request
13587ff949aSAlan Somers  *
13687ff949aSAlan Somers  * 7.22
13787ff949aSAlan Somers  *  - add FUSE_ASYNC_DIO
13887ff949aSAlan Somers  *
13987ff949aSAlan Somers  * 7.23
14087ff949aSAlan Somers  *  - add FUSE_WRITEBACK_CACHE
14187ff949aSAlan Somers  *  - add time_gran to fuse_init_out
14287ff949aSAlan Somers  *  - add reserved space to fuse_init_out
14387ff949aSAlan Somers  *  - add FATTR_CTIME
14487ff949aSAlan Somers  *  - add ctime and ctimensec to fuse_setattr_in
14587ff949aSAlan Somers  *  - add FUSE_RENAME2 request
14687ff949aSAlan Somers  *  - add FUSE_NO_OPEN_SUPPORT flag
14737df9d3bSAlan Somers  *
14837df9d3bSAlan Somers  *  7.24
14937df9d3bSAlan Somers  *  - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
15092bbfe1fSAlan Somers  *
15192bbfe1fSAlan Somers  *  7.25
15292bbfe1fSAlan Somers  *  - add FUSE_PARALLEL_DIROPS
15392bbfe1fSAlan Somers  *
15492bbfe1fSAlan Somers  *  7.26
15592bbfe1fSAlan Somers  *  - add FUSE_HANDLE_KILLPRIV
15692bbfe1fSAlan Somers  *  - add FUSE_POSIX_ACL
15792bbfe1fSAlan Somers  *
15892bbfe1fSAlan Somers  *  7.27
15992bbfe1fSAlan Somers  *  - add FUSE_ABORT_ERROR
16092bbfe1fSAlan Somers  *
16192bbfe1fSAlan Somers  *  7.28
16292bbfe1fSAlan Somers  *  - add FUSE_COPY_FILE_RANGE
16392bbfe1fSAlan Somers  *  - add FOPEN_CACHE_DIR
16492bbfe1fSAlan Somers  *  - add FUSE_MAX_PAGES, add max_pages to init_out
16592bbfe1fSAlan Somers  *  - add FUSE_CACHE_SYMLINKS
16616bd2d47SAlan Somers  */
16716bd2d47SAlan Somers 
16816bd2d47SAlan Somers #ifndef _FUSE_FUSE_KERNEL_H
16916bd2d47SAlan Somers #define _FUSE_FUSE_KERNEL_H
17016bd2d47SAlan Somers 
171b160acd1SAlan Somers #ifdef __linux__
172b160acd1SAlan Somers #include <linux/types.h>
173b160acd1SAlan Somers #else
1745fe58019SAttilio Rao #include <sys/types.h>
1755fe58019SAttilio Rao #endif
1765fe58019SAttilio Rao 
177*a3a1ce37SAlan Somers /*
178*a3a1ce37SAlan Somers  * Version negotiation:
179*a3a1ce37SAlan Somers  *
180*a3a1ce37SAlan Somers  * Both the kernel and userspace send the version they support in the
181*a3a1ce37SAlan Somers  * INIT request and reply respectively.
182*a3a1ce37SAlan Somers  *
183*a3a1ce37SAlan Somers  * If the major versions match then both shall use the smallest
184*a3a1ce37SAlan Somers  * of the two minor versions for communication.
185*a3a1ce37SAlan Somers  *
186*a3a1ce37SAlan Somers  * If the kernel supports a larger major version, then userspace shall
187*a3a1ce37SAlan Somers  * reply with the major version it supports, ignore the rest of the
188*a3a1ce37SAlan Somers  * INIT message and expect a new INIT message from the kernel with a
189*a3a1ce37SAlan Somers  * matching major version.
190*a3a1ce37SAlan Somers  *
191*a3a1ce37SAlan Somers  * If the library supports a larger major version, then it shall fall
192*a3a1ce37SAlan Somers  * back to the major protocol version sent by the kernel for
193*a3a1ce37SAlan Somers  * communication and reply with that major version (and an arbitrary
194*a3a1ce37SAlan Somers  * supported minor version).
195*a3a1ce37SAlan Somers  */
196*a3a1ce37SAlan Somers 
1975fe58019SAttilio Rao /** Version number of this interface */
1985fe58019SAttilio Rao #define FUSE_KERNEL_VERSION 7
1995fe58019SAttilio Rao 
2005fe58019SAttilio Rao /** Minor version number of this interface */
20192bbfe1fSAlan Somers #define FUSE_KERNEL_MINOR_VERSION 28
2025fe58019SAttilio Rao 
2035fe58019SAttilio Rao /** The node ID of the root inode */
2045fe58019SAttilio Rao #define FUSE_ROOT_ID 1
2055fe58019SAttilio Rao 
2065fe58019SAttilio Rao /* Make sure all structures are padded to 64bit boundary, so 32bit
2075fe58019SAttilio Rao    userspace works under 64bit kernels */
2085fe58019SAttilio Rao 
2095fe58019SAttilio Rao struct fuse_attr {
2108f9b3ba7SAlan Somers 	uint64_t	ino;
2118f9b3ba7SAlan Somers 	uint64_t	size;
2128f9b3ba7SAlan Somers 	uint64_t	blocks;
2138f9b3ba7SAlan Somers 	uint64_t	atime;
2148f9b3ba7SAlan Somers 	uint64_t	mtime;
2158f9b3ba7SAlan Somers 	uint64_t	ctime;
2168f9b3ba7SAlan Somers 	uint32_t	atimensec;
2178f9b3ba7SAlan Somers 	uint32_t	mtimensec;
2188f9b3ba7SAlan Somers 	uint32_t	ctimensec;
2198f9b3ba7SAlan Somers 	uint32_t	mode;
2208f9b3ba7SAlan Somers 	uint32_t	nlink;
2218f9b3ba7SAlan Somers 	uint32_t	uid;
2228f9b3ba7SAlan Somers 	uint32_t	gid;
2238f9b3ba7SAlan Somers 	uint32_t	rdev;
2248f9b3ba7SAlan Somers 	uint32_t	blksize;
2258f9b3ba7SAlan Somers 	uint32_t	padding;
2265fe58019SAttilio Rao };
2275fe58019SAttilio Rao 
2285fe58019SAttilio Rao struct fuse_kstatfs {
2298f9b3ba7SAlan Somers 	uint64_t	blocks;
2308f9b3ba7SAlan Somers 	uint64_t	bfree;
2318f9b3ba7SAlan Somers 	uint64_t	bavail;
2328f9b3ba7SAlan Somers 	uint64_t	files;
2338f9b3ba7SAlan Somers 	uint64_t	ffree;
2348f9b3ba7SAlan Somers 	uint32_t	bsize;
2358f9b3ba7SAlan Somers 	uint32_t	namelen;
2368f9b3ba7SAlan Somers 	uint32_t	frsize;
2378f9b3ba7SAlan Somers 	uint32_t	padding;
2388f9b3ba7SAlan Somers 	uint32_t	spare[6];
2395fe58019SAttilio Rao };
2405fe58019SAttilio Rao 
2415fe58019SAttilio Rao struct fuse_file_lock {
2428f9b3ba7SAlan Somers 	uint64_t	start;
2438f9b3ba7SAlan Somers 	uint64_t	end;
2448f9b3ba7SAlan Somers 	uint32_t	type;
2458f9b3ba7SAlan Somers 	uint32_t	pid; /* tgid */
2465fe58019SAttilio Rao };
2475fe58019SAttilio Rao 
2485fe58019SAttilio Rao /**
2495fe58019SAttilio Rao  * Bitmasks for fuse_setattr_in.valid
2505fe58019SAttilio Rao  */
2515fe58019SAttilio Rao #define FATTR_MODE	(1 << 0)
2525fe58019SAttilio Rao #define FATTR_UID	(1 << 1)
2535fe58019SAttilio Rao #define FATTR_GID	(1 << 2)
2545fe58019SAttilio Rao #define FATTR_SIZE	(1 << 3)
2555fe58019SAttilio Rao #define FATTR_ATIME	(1 << 4)
2565fe58019SAttilio Rao #define FATTR_MTIME	(1 << 5)
2575fe58019SAttilio Rao #define FATTR_FH	(1 << 6)
25816bd2d47SAlan Somers #define FATTR_ATIME_NOW	(1 << 7)
25916bd2d47SAlan Somers #define FATTR_MTIME_NOW	(1 << 8)
26016bd2d47SAlan Somers #define FATTR_LOCKOWNER	(1 << 9)
26187ff949aSAlan Somers #define FATTR_CTIME	(1 << 10)
2625fe58019SAttilio Rao 
2635fe58019SAttilio Rao /**
2645fe58019SAttilio Rao  * Flags returned by the OPEN request
2655fe58019SAttilio Rao  *
2665fe58019SAttilio Rao  * FOPEN_DIRECT_IO: bypass page cache for this open file
2675fe58019SAttilio Rao  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
2683f105d16SAlan Somers  * FOPEN_NONSEEKABLE: the file is not seekable
26992bbfe1fSAlan Somers  * FOPEN_CACHE_DIR: allow caching this directory
2705fe58019SAttilio Rao  */
2715fe58019SAttilio Rao #define FOPEN_DIRECT_IO		(1 << 0)
2725fe58019SAttilio Rao #define FOPEN_KEEP_CACHE	(1 << 1)
2733f105d16SAlan Somers #define FOPEN_NONSEEKABLE	(1 << 2)
27492bbfe1fSAlan Somers #define FOPEN_CACHE_DIR		(1 << 3)
2755fe58019SAttilio Rao 
2765fe58019SAttilio Rao /**
2775fe58019SAttilio Rao  * INIT request/reply flags
27816bd2d47SAlan Somers  *
279b160acd1SAlan Somers  * FUSE_ASYNC_READ: asynchronous read requests
280b160acd1SAlan Somers  * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
281b160acd1SAlan Somers  * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
282b160acd1SAlan Somers  * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
28316bd2d47SAlan Somers  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
284b160acd1SAlan Somers  * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
285a4856c96SAlan Somers  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
286b160acd1SAlan Somers  * FUSE_SPLICE_WRITE: kernel supports splice write on the device
287b160acd1SAlan Somers  * FUSE_SPLICE_MOVE: kernel supports splice move on the device
288b160acd1SAlan Somers  * FUSE_SPLICE_READ: kernel supports splice read on the device
289b160acd1SAlan Somers  * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
290b160acd1SAlan Somers  * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
291b160acd1SAlan Somers  * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
292b160acd1SAlan Somers  * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
293b160acd1SAlan Somers  * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
29487ff949aSAlan Somers  * FUSE_ASYNC_DIO: asynchronous direct I/O submission
29587ff949aSAlan Somers  * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
29687ff949aSAlan Somers  * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
29792bbfe1fSAlan Somers  * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
29892bbfe1fSAlan Somers  * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
29992bbfe1fSAlan Somers  * FUSE_POSIX_ACL: filesystem supports posix acls
30092bbfe1fSAlan Somers  * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
30192bbfe1fSAlan Somers  * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
30292bbfe1fSAlan Somers  * FUSE_CACHE_SYMLINKS: cache READLINK responses
3035fe58019SAttilio Rao  */
3045fe58019SAttilio Rao #define FUSE_ASYNC_READ		(1 << 0)
3055fe58019SAttilio Rao #define FUSE_POSIX_LOCKS	(1 << 1)
30616bd2d47SAlan Somers #define FUSE_FILE_OPS		(1 << 2)
30716bd2d47SAlan Somers #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
30816bd2d47SAlan Somers #define FUSE_EXPORT_SUPPORT	(1 << 4)
30916bd2d47SAlan Somers #define FUSE_BIG_WRITES		(1 << 5)
310a4856c96SAlan Somers #define FUSE_DONT_MASK		(1 << 6)
311b160acd1SAlan Somers #define FUSE_SPLICE_WRITE	(1 << 7)
312b160acd1SAlan Somers #define FUSE_SPLICE_MOVE	(1 << 8)
313b160acd1SAlan Somers #define FUSE_SPLICE_READ	(1 << 9)
314b160acd1SAlan Somers #define FUSE_FLOCK_LOCKS	(1 << 10)
315b160acd1SAlan Somers #define FUSE_HAS_IOCTL_DIR	(1 << 11)
316b160acd1SAlan Somers #define FUSE_AUTO_INVAL_DATA	(1 << 12)
317b160acd1SAlan Somers #define FUSE_DO_READDIRPLUS	(1 << 13)
318b160acd1SAlan Somers #define FUSE_READDIRPLUS_AUTO	(1 << 14)
31987ff949aSAlan Somers #define FUSE_ASYNC_DIO		(1 << 15)
32087ff949aSAlan Somers #define FUSE_WRITEBACK_CACHE	(1 << 16)
32187ff949aSAlan Somers #define FUSE_NO_OPEN_SUPPORT	(1 << 17)
32292bbfe1fSAlan Somers #define FUSE_PARALLEL_DIROPS    (1 << 18)
32392bbfe1fSAlan Somers #define FUSE_HANDLE_KILLPRIV	(1 << 19)
32492bbfe1fSAlan Somers #define FUSE_POSIX_ACL		(1 << 20)
32592bbfe1fSAlan Somers #define FUSE_ABORT_ERROR	(1 << 21)
32692bbfe1fSAlan Somers #define FUSE_MAX_PAGES		(1 << 22)
32792bbfe1fSAlan Somers #define FUSE_CACHE_SYMLINKS	(1 << 23)
3285fe58019SAttilio Rao 
3299c62bc70SAlan Somers #ifdef linux
3309c62bc70SAlan Somers /**
3319c62bc70SAlan Somers  * CUSE INIT request/reply flags
3329c62bc70SAlan Somers  *
3339c62bc70SAlan Somers  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
3349c62bc70SAlan Somers  */
3359c62bc70SAlan Somers #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
3369c62bc70SAlan Somers #endif /* linux */
3379c62bc70SAlan Somers 
3385fe58019SAttilio Rao /**
3395fe58019SAttilio Rao  * Release flags
3405fe58019SAttilio Rao  */
3415fe58019SAttilio Rao #define FUSE_RELEASE_FLUSH	(1 << 0)
342b160acd1SAlan Somers #define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
3435fe58019SAttilio Rao 
34416bd2d47SAlan Somers /**
34516bd2d47SAlan Somers  * Getattr flags
34616bd2d47SAlan Somers  */
34716bd2d47SAlan Somers #define FUSE_GETATTR_FH		(1 << 0)
34816bd2d47SAlan Somers 
34916bd2d47SAlan Somers /**
35016bd2d47SAlan Somers  * Lock flags
35116bd2d47SAlan Somers  */
35216bd2d47SAlan Somers #define FUSE_LK_FLOCK		(1 << 0)
35316bd2d47SAlan Somers 
35416bd2d47SAlan Somers /**
35516bd2d47SAlan Somers  * WRITE flags
35616bd2d47SAlan Somers  *
35716bd2d47SAlan Somers  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
35816bd2d47SAlan Somers  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
35916bd2d47SAlan Somers  */
36016bd2d47SAlan Somers #define FUSE_WRITE_CACHE	(1 << 0)
36116bd2d47SAlan Somers #define FUSE_WRITE_LOCKOWNER	(1 << 1)
36216bd2d47SAlan Somers 
36316bd2d47SAlan Somers /**
36416bd2d47SAlan Somers  * Read flags
36516bd2d47SAlan Somers  */
36616bd2d47SAlan Somers #define FUSE_READ_LOCKOWNER	(1 << 1)
36716bd2d47SAlan Somers 
3689c62bc70SAlan Somers /**
3699c62bc70SAlan Somers  * Ioctl flags
3709c62bc70SAlan Somers  *
3719c62bc70SAlan Somers  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
3729c62bc70SAlan Somers  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
3739c62bc70SAlan Somers  * FUSE_IOCTL_RETRY: retry with new iovecs
374b160acd1SAlan Somers  * FUSE_IOCTL_32BIT: 32bit ioctl
375b160acd1SAlan Somers  * FUSE_IOCTL_DIR: is a directory
3769c62bc70SAlan Somers  *
3779c62bc70SAlan Somers  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
3789c62bc70SAlan Somers  */
3799c62bc70SAlan Somers #define FUSE_IOCTL_COMPAT	(1 << 0)
3809c62bc70SAlan Somers #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
3819c62bc70SAlan Somers #define FUSE_IOCTL_RETRY	(1 << 2)
382b160acd1SAlan Somers #define FUSE_IOCTL_32BIT	(1 << 3)
383b160acd1SAlan Somers #define FUSE_IOCTL_DIR		(1 << 4)
3849c62bc70SAlan Somers 
3859c62bc70SAlan Somers #define FUSE_IOCTL_MAX_IOV	256
3869c62bc70SAlan Somers 
3879c62bc70SAlan Somers /**
3889c62bc70SAlan Somers  * Poll flags
3899c62bc70SAlan Somers  *
3909c62bc70SAlan Somers  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
3919c62bc70SAlan Somers  */
3929c62bc70SAlan Somers #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
3939c62bc70SAlan Somers 
394*a3a1ce37SAlan Somers /**
395*a3a1ce37SAlan Somers  * Fsync flags
396*a3a1ce37SAlan Somers  *
397*a3a1ce37SAlan Somers  * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata
398*a3a1ce37SAlan Somers  */
399*a3a1ce37SAlan Somers #define FUSE_FSYNC_FDATASYNC	(1 << 0)
400*a3a1ce37SAlan Somers 
4015fe58019SAttilio Rao enum fuse_opcode {
4025fe58019SAttilio Rao 	FUSE_LOOKUP		= 1,
4035fe58019SAttilio Rao 	FUSE_FORGET		= 2,  /* no reply */
4045fe58019SAttilio Rao 	FUSE_GETATTR		= 3,
4055fe58019SAttilio Rao 	FUSE_SETATTR		= 4,
4065fe58019SAttilio Rao 	FUSE_READLINK		= 5,
4075fe58019SAttilio Rao 	FUSE_SYMLINK		= 6,
4085fe58019SAttilio Rao 	FUSE_MKNOD		= 8,
4095fe58019SAttilio Rao 	FUSE_MKDIR		= 9,
4105fe58019SAttilio Rao 	FUSE_UNLINK		= 10,
4115fe58019SAttilio Rao 	FUSE_RMDIR		= 11,
4125fe58019SAttilio Rao 	FUSE_RENAME		= 12,
4135fe58019SAttilio Rao 	FUSE_LINK		= 13,
4145fe58019SAttilio Rao 	FUSE_OPEN		= 14,
4155fe58019SAttilio Rao 	FUSE_READ		= 15,
4165fe58019SAttilio Rao 	FUSE_WRITE		= 16,
4175fe58019SAttilio Rao 	FUSE_STATFS		= 17,
4185fe58019SAttilio Rao 	FUSE_RELEASE		= 18,
4195fe58019SAttilio Rao 	FUSE_FSYNC		= 20,
4205fe58019SAttilio Rao 	FUSE_SETXATTR		= 21,
4215fe58019SAttilio Rao 	FUSE_GETXATTR		= 22,
4225fe58019SAttilio Rao 	FUSE_LISTXATTR		= 23,
4235fe58019SAttilio Rao 	FUSE_REMOVEXATTR	= 24,
4245fe58019SAttilio Rao 	FUSE_FLUSH		= 25,
4255fe58019SAttilio Rao 	FUSE_INIT		= 26,
4265fe58019SAttilio Rao 	FUSE_OPENDIR		= 27,
4275fe58019SAttilio Rao 	FUSE_READDIR		= 28,
4285fe58019SAttilio Rao 	FUSE_RELEASEDIR		= 29,
4295fe58019SAttilio Rao 	FUSE_FSYNCDIR		= 30,
4305fe58019SAttilio Rao 	FUSE_GETLK		= 31,
4315fe58019SAttilio Rao 	FUSE_SETLK		= 32,
4325fe58019SAttilio Rao 	FUSE_SETLKW		= 33,
4335fe58019SAttilio Rao 	FUSE_ACCESS		= 34,
4345fe58019SAttilio Rao 	FUSE_CREATE		= 35,
4355fe58019SAttilio Rao 	FUSE_INTERRUPT		= 36,
4365fe58019SAttilio Rao 	FUSE_BMAP		= 37,
4375fe58019SAttilio Rao 	FUSE_DESTROY		= 38,
4389c62bc70SAlan Somers 	FUSE_IOCTL		= 39,
4399c62bc70SAlan Somers 	FUSE_POLL		= 40,
4407cbb8e8aSAlan Somers 	FUSE_NOTIFY_REPLY	= 41,
441b160acd1SAlan Somers 	FUSE_BATCH_FORGET	= 42,
442b160acd1SAlan Somers 	FUSE_FALLOCATE		= 43,
443b160acd1SAlan Somers 	FUSE_READDIRPLUS	= 44,
44487ff949aSAlan Somers 	FUSE_RENAME2		= 45,
44537df9d3bSAlan Somers 	FUSE_LSEEK		= 46,
44692bbfe1fSAlan Somers 	FUSE_COPY_FILE_RANGE	= 47,
4479c62bc70SAlan Somers 
4489c62bc70SAlan Somers #ifdef linux
4499c62bc70SAlan Somers 	/* CUSE specific operations */
4509c62bc70SAlan Somers 	CUSE_INIT		= 4096,
4519c62bc70SAlan Somers #endif /* linux */
4529c62bc70SAlan Somers };
4539c62bc70SAlan Somers 
4549c62bc70SAlan Somers enum fuse_notify_code {
4559c62bc70SAlan Somers 	FUSE_NOTIFY_POLL   = 1,
456a4856c96SAlan Somers 	FUSE_NOTIFY_INVAL_INODE = 2,
457a4856c96SAlan Somers 	FUSE_NOTIFY_INVAL_ENTRY = 3,
4587cbb8e8aSAlan Somers 	FUSE_NOTIFY_STORE = 4,
4597cbb8e8aSAlan Somers 	FUSE_NOTIFY_RETRIEVE = 5,
460b160acd1SAlan Somers 	FUSE_NOTIFY_DELETE = 6,
4619c62bc70SAlan Somers 	FUSE_NOTIFY_CODE_MAX,
4625fe58019SAttilio Rao };
4635fe58019SAttilio Rao 
4645fe58019SAttilio Rao /* The read buffer is required to be at least 8k, but may be much larger */
4655fe58019SAttilio Rao #define FUSE_MIN_READ_BUFFER 8192
4665fe58019SAttilio Rao 
46716bd2d47SAlan Somers #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
46816bd2d47SAlan Somers 
4695fe58019SAttilio Rao struct fuse_entry_out {
4708f9b3ba7SAlan Somers 	uint64_t	nodeid;		/* Inode ID */
4718f9b3ba7SAlan Somers 	uint64_t	generation;	/* Inode generation: nodeid:gen must
4725fe58019SAttilio Rao 					   be unique for the fs's lifetime */
4738f9b3ba7SAlan Somers 	uint64_t	entry_valid;	/* Cache timeout for the name */
4748f9b3ba7SAlan Somers 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
4758f9b3ba7SAlan Somers 	uint32_t	entry_valid_nsec;
4768f9b3ba7SAlan Somers 	uint32_t	attr_valid_nsec;
4775fe58019SAttilio Rao 	struct fuse_attr attr;
4785fe58019SAttilio Rao };
4795fe58019SAttilio Rao 
4805fe58019SAttilio Rao struct fuse_forget_in {
4818f9b3ba7SAlan Somers 	uint64_t	nlookup;
4825fe58019SAttilio Rao };
4835fe58019SAttilio Rao 
484b160acd1SAlan Somers struct fuse_forget_one {
4858f9b3ba7SAlan Somers 	uint64_t	nodeid;
4868f9b3ba7SAlan Somers 	uint64_t	nlookup;
487b160acd1SAlan Somers };
488b160acd1SAlan Somers 
489b160acd1SAlan Somers struct fuse_batch_forget_in {
4908f9b3ba7SAlan Somers 	uint32_t	count;
4918f9b3ba7SAlan Somers 	uint32_t	dummy;
492b160acd1SAlan Somers };
493b160acd1SAlan Somers 
49416bd2d47SAlan Somers struct fuse_getattr_in {
4958f9b3ba7SAlan Somers 	uint32_t	getattr_flags;
4968f9b3ba7SAlan Somers 	uint32_t	dummy;
4978f9b3ba7SAlan Somers 	uint64_t	fh;
49816bd2d47SAlan Somers };
49916bd2d47SAlan Somers 
50016bd2d47SAlan Somers #define FUSE_COMPAT_ATTR_OUT_SIZE 96
50116bd2d47SAlan Somers 
5025fe58019SAttilio Rao struct fuse_attr_out {
5038f9b3ba7SAlan Somers 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
5048f9b3ba7SAlan Somers 	uint32_t	attr_valid_nsec;
5058f9b3ba7SAlan Somers 	uint32_t	dummy;
5065fe58019SAttilio Rao 	struct fuse_attr attr;
5075fe58019SAttilio Rao };
5085fe58019SAttilio Rao 
509a4856c96SAlan Somers #define FUSE_COMPAT_MKNOD_IN_SIZE 8
510a4856c96SAlan Somers 
5114cbb4f88SAlan Somers struct fuse_mknod_in {
5128f9b3ba7SAlan Somers 	uint32_t	mode;
5138f9b3ba7SAlan Somers 	uint32_t	rdev;
5148f9b3ba7SAlan Somers 	uint32_t	umask;
5158f9b3ba7SAlan Somers 	uint32_t	padding;
5164cbb4f88SAlan Somers };
5174cbb4f88SAlan Somers 
5185fe58019SAttilio Rao struct fuse_mkdir_in {
5198f9b3ba7SAlan Somers 	uint32_t	mode;
5208f9b3ba7SAlan Somers 	uint32_t	umask;
5215fe58019SAttilio Rao };
5225fe58019SAttilio Rao 
5235fe58019SAttilio Rao struct fuse_rename_in {
5248f9b3ba7SAlan Somers 	uint64_t	newdir;
5255fe58019SAttilio Rao };
5265fe58019SAttilio Rao 
52787ff949aSAlan Somers struct fuse_rename2_in {
52887ff949aSAlan Somers 	uint64_t	newdir;
52987ff949aSAlan Somers 	uint32_t	flags;
53087ff949aSAlan Somers 	uint32_t	padding;
53187ff949aSAlan Somers };
53287ff949aSAlan Somers 
5335fe58019SAttilio Rao struct fuse_link_in {
5348f9b3ba7SAlan Somers 	uint64_t	oldnodeid;
5355fe58019SAttilio Rao };
5365fe58019SAttilio Rao 
5375fe58019SAttilio Rao struct fuse_setattr_in {
5388f9b3ba7SAlan Somers 	uint32_t	valid;
5398f9b3ba7SAlan Somers 	uint32_t	padding;
5408f9b3ba7SAlan Somers 	uint64_t	fh;
5418f9b3ba7SAlan Somers 	uint64_t	size;
5428f9b3ba7SAlan Somers 	uint64_t	lock_owner;
5438f9b3ba7SAlan Somers 	uint64_t	atime;
5448f9b3ba7SAlan Somers 	uint64_t	mtime;
54587ff949aSAlan Somers 	uint64_t	ctime;
5468f9b3ba7SAlan Somers 	uint32_t	atimensec;
5478f9b3ba7SAlan Somers 	uint32_t	mtimensec;
54887ff949aSAlan Somers 	uint32_t	ctimensec;
5498f9b3ba7SAlan Somers 	uint32_t	mode;
5508f9b3ba7SAlan Somers 	uint32_t	unused4;
5518f9b3ba7SAlan Somers 	uint32_t	uid;
5528f9b3ba7SAlan Somers 	uint32_t	gid;
5538f9b3ba7SAlan Somers 	uint32_t	unused5;
5545fe58019SAttilio Rao };
5555fe58019SAttilio Rao 
5565fe58019SAttilio Rao struct fuse_open_in {
5578f9b3ba7SAlan Somers 	uint32_t	flags;
5588f9b3ba7SAlan Somers 	uint32_t	unused;
559a4856c96SAlan Somers };
560a4856c96SAlan Somers 
561a4856c96SAlan Somers struct fuse_create_in {
5628f9b3ba7SAlan Somers 	uint32_t	flags;
5638f9b3ba7SAlan Somers 	uint32_t	mode;
5648f9b3ba7SAlan Somers 	uint32_t	umask;
5658f9b3ba7SAlan Somers 	uint32_t	padding;
5665fe58019SAttilio Rao };
5675fe58019SAttilio Rao 
5685fe58019SAttilio Rao struct fuse_open_out {
5698f9b3ba7SAlan Somers 	uint64_t	fh;
5708f9b3ba7SAlan Somers 	uint32_t	open_flags;
5718f9b3ba7SAlan Somers 	uint32_t	padding;
5725fe58019SAttilio Rao };
5735fe58019SAttilio Rao 
5745fe58019SAttilio Rao struct fuse_release_in {
5758f9b3ba7SAlan Somers 	uint64_t	fh;
5768f9b3ba7SAlan Somers 	uint32_t	flags;
5778f9b3ba7SAlan Somers 	uint32_t	release_flags;
5788f9b3ba7SAlan Somers 	uint64_t	lock_owner;
5795fe58019SAttilio Rao };
5805fe58019SAttilio Rao 
5815fe58019SAttilio Rao struct fuse_flush_in {
5828f9b3ba7SAlan Somers 	uint64_t	fh;
5838f9b3ba7SAlan Somers 	uint32_t	unused;
5848f9b3ba7SAlan Somers 	uint32_t	padding;
5858f9b3ba7SAlan Somers 	uint64_t	lock_owner;
5865fe58019SAttilio Rao };
5875fe58019SAttilio Rao 
5885fe58019SAttilio Rao struct fuse_read_in {
5898f9b3ba7SAlan Somers 	uint64_t	fh;
5908f9b3ba7SAlan Somers 	uint64_t	offset;
5918f9b3ba7SAlan Somers 	uint32_t	size;
5928f9b3ba7SAlan Somers 	uint32_t	read_flags;
5938f9b3ba7SAlan Somers 	uint64_t	lock_owner;
5948f9b3ba7SAlan Somers 	uint32_t	flags;
5958f9b3ba7SAlan Somers 	uint32_t	padding;
5965fe58019SAttilio Rao };
5975fe58019SAttilio Rao 
59816bd2d47SAlan Somers #define FUSE_COMPAT_WRITE_IN_SIZE 24
59916bd2d47SAlan Somers 
6005fe58019SAttilio Rao struct fuse_write_in {
6018f9b3ba7SAlan Somers 	uint64_t	fh;
6028f9b3ba7SAlan Somers 	uint64_t	offset;
6038f9b3ba7SAlan Somers 	uint32_t	size;
6048f9b3ba7SAlan Somers 	uint32_t	write_flags;
6058f9b3ba7SAlan Somers 	uint64_t	lock_owner;
6068f9b3ba7SAlan Somers 	uint32_t	flags;
6078f9b3ba7SAlan Somers 	uint32_t	padding;
6085fe58019SAttilio Rao };
6095fe58019SAttilio Rao 
6105fe58019SAttilio Rao struct fuse_write_out {
6118f9b3ba7SAlan Somers 	uint32_t	size;
6128f9b3ba7SAlan Somers 	uint32_t	padding;
6135fe58019SAttilio Rao };
6145fe58019SAttilio Rao 
6155fe58019SAttilio Rao #define FUSE_COMPAT_STATFS_SIZE 48
6165fe58019SAttilio Rao 
6175fe58019SAttilio Rao struct fuse_statfs_out {
6185fe58019SAttilio Rao 	struct fuse_kstatfs st;
6195fe58019SAttilio Rao };
6205fe58019SAttilio Rao 
6215fe58019SAttilio Rao struct fuse_fsync_in {
6228f9b3ba7SAlan Somers 	uint64_t	fh;
6238f9b3ba7SAlan Somers 	uint32_t	fsync_flags;
6248f9b3ba7SAlan Somers 	uint32_t	padding;
6255fe58019SAttilio Rao };
6265fe58019SAttilio Rao 
62796192dfcSAlan Somers struct fuse_setxattr_in {
6288f9b3ba7SAlan Somers 	uint32_t	size;
6298f9b3ba7SAlan Somers 	uint32_t	flags;
630493b4a8cSFedor Uporov };
631493b4a8cSFedor Uporov 
63296192dfcSAlan Somers struct fuse_listxattr_in {
6338f9b3ba7SAlan Somers 	uint32_t	size;
6348f9b3ba7SAlan Somers 	uint32_t	padding;
63596192dfcSAlan Somers };
63696192dfcSAlan Somers 
637493b4a8cSFedor Uporov struct fuse_listxattr_out {
6388f9b3ba7SAlan Somers 	uint32_t	size;
6398f9b3ba7SAlan Somers 	uint32_t	padding;
6405fe58019SAttilio Rao };
6415fe58019SAttilio Rao 
6425fe58019SAttilio Rao struct fuse_getxattr_in {
6438f9b3ba7SAlan Somers 	uint32_t	size;
6448f9b3ba7SAlan Somers 	uint32_t	padding;
6455fe58019SAttilio Rao };
6465fe58019SAttilio Rao 
6475fe58019SAttilio Rao struct fuse_getxattr_out {
6488f9b3ba7SAlan Somers 	uint32_t	size;
6498f9b3ba7SAlan Somers 	uint32_t	padding;
6505fe58019SAttilio Rao };
6515fe58019SAttilio Rao 
6525fe58019SAttilio Rao struct fuse_lk_in {
6538f9b3ba7SAlan Somers 	uint64_t	fh;
6548f9b3ba7SAlan Somers 	uint64_t	owner;
6555fe58019SAttilio Rao 	struct fuse_file_lock lk;
6568f9b3ba7SAlan Somers 	uint32_t	lk_flags;
6578f9b3ba7SAlan Somers 	uint32_t	padding;
6585fe58019SAttilio Rao };
6595fe58019SAttilio Rao 
6605fe58019SAttilio Rao struct fuse_lk_out {
6615fe58019SAttilio Rao 	struct fuse_file_lock lk;
6625fe58019SAttilio Rao };
6635fe58019SAttilio Rao 
6645fe58019SAttilio Rao struct fuse_access_in {
6658f9b3ba7SAlan Somers 	uint32_t	mask;
6668f9b3ba7SAlan Somers 	uint32_t	padding;
6675fe58019SAttilio Rao };
6685fe58019SAttilio Rao 
6695fe58019SAttilio Rao struct fuse_init_in {
6708f9b3ba7SAlan Somers 	uint32_t	major;
6718f9b3ba7SAlan Somers 	uint32_t	minor;
6728f9b3ba7SAlan Somers 	uint32_t	max_readahead;
6738f9b3ba7SAlan Somers 	uint32_t	flags;
6745fe58019SAttilio Rao };
6755fe58019SAttilio Rao 
67687ff949aSAlan Somers #define FUSE_COMPAT_INIT_OUT_SIZE 8
67787ff949aSAlan Somers #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
67887ff949aSAlan Somers 
6795fe58019SAttilio Rao struct fuse_init_out {
6808f9b3ba7SAlan Somers 	uint32_t	major;
6818f9b3ba7SAlan Somers 	uint32_t	minor;
6828f9b3ba7SAlan Somers 	uint32_t	max_readahead;
6838f9b3ba7SAlan Somers 	uint32_t	flags;
6848f9b3ba7SAlan Somers 	uint16_t	max_background;
6858f9b3ba7SAlan Somers 	uint16_t	congestion_threshold;
6868f9b3ba7SAlan Somers 	uint32_t	max_write;
68787ff949aSAlan Somers 	uint32_t	time_gran;
68892bbfe1fSAlan Somers 	uint16_t	max_pages;
68992bbfe1fSAlan Somers 	uint16_t	padding;
69092bbfe1fSAlan Somers 	uint32_t	unused[8];
6915fe58019SAttilio Rao };
6925fe58019SAttilio Rao 
6939c62bc70SAlan Somers #ifdef linux
6949c62bc70SAlan Somers #define CUSE_INIT_INFO_MAX 4096
6959c62bc70SAlan Somers 
6969c62bc70SAlan Somers struct cuse_init_in {
6978f9b3ba7SAlan Somers 	uint32_t	major;
6988f9b3ba7SAlan Somers 	uint32_t	minor;
6998f9b3ba7SAlan Somers 	uint32_t	unused;
7008f9b3ba7SAlan Somers 	uint32_t	flags;
7019c62bc70SAlan Somers };
7029c62bc70SAlan Somers 
7039c62bc70SAlan Somers struct cuse_init_out {
7048f9b3ba7SAlan Somers 	uint32_t	major;
7058f9b3ba7SAlan Somers 	uint32_t	minor;
7068f9b3ba7SAlan Somers 	uint32_t	unused;
7078f9b3ba7SAlan Somers 	uint32_t	flags;
7088f9b3ba7SAlan Somers 	uint32_t	max_read;
7098f9b3ba7SAlan Somers 	uint32_t	max_write;
7108f9b3ba7SAlan Somers 	uint32_t	dev_major;		/* chardev major */
7118f9b3ba7SAlan Somers 	uint32_t	dev_minor;		/* chardev minor */
7128f9b3ba7SAlan Somers 	uint32_t	spare[10];
7139c62bc70SAlan Somers };
7149c62bc70SAlan Somers #endif /* linux */
7159c62bc70SAlan Somers 
7165fe58019SAttilio Rao struct fuse_interrupt_in {
7178f9b3ba7SAlan Somers 	uint64_t	unique;
7185fe58019SAttilio Rao };
7195fe58019SAttilio Rao 
7205fe58019SAttilio Rao struct fuse_bmap_in {
7218f9b3ba7SAlan Somers 	uint64_t	block;
7228f9b3ba7SAlan Somers 	uint32_t	blocksize;
7238f9b3ba7SAlan Somers 	uint32_t	padding;
7245fe58019SAttilio Rao };
7255fe58019SAttilio Rao 
7265fe58019SAttilio Rao struct fuse_bmap_out {
7278f9b3ba7SAlan Somers 	uint64_t	block;
7285fe58019SAttilio Rao };
7295fe58019SAttilio Rao 
7309c62bc70SAlan Somers struct fuse_ioctl_in {
7318f9b3ba7SAlan Somers 	uint64_t	fh;
7328f9b3ba7SAlan Somers 	uint32_t	flags;
7338f9b3ba7SAlan Somers 	uint32_t	cmd;
7348f9b3ba7SAlan Somers 	uint64_t	arg;
7358f9b3ba7SAlan Somers 	uint32_t	in_size;
7368f9b3ba7SAlan Somers 	uint32_t	out_size;
7379c62bc70SAlan Somers };
7389c62bc70SAlan Somers 
739b160acd1SAlan Somers struct fuse_ioctl_iovec {
7408f9b3ba7SAlan Somers 	uint64_t	base;
7418f9b3ba7SAlan Somers 	uint64_t	len;
742b160acd1SAlan Somers };
743b160acd1SAlan Somers 
7449c62bc70SAlan Somers struct fuse_ioctl_out {
7458f9b3ba7SAlan Somers 	int32_t		result;
7468f9b3ba7SAlan Somers 	uint32_t	flags;
7478f9b3ba7SAlan Somers 	uint32_t	in_iovs;
7488f9b3ba7SAlan Somers 	uint32_t	out_iovs;
7499c62bc70SAlan Somers };
7509c62bc70SAlan Somers 
7519c62bc70SAlan Somers struct fuse_poll_in {
7528f9b3ba7SAlan Somers 	uint64_t	fh;
7538f9b3ba7SAlan Somers 	uint64_t	kh;
7548f9b3ba7SAlan Somers 	uint32_t	flags;
7558f9b3ba7SAlan Somers 	uint32_t	events;
7569c62bc70SAlan Somers };
7579c62bc70SAlan Somers 
7589c62bc70SAlan Somers struct fuse_poll_out {
7598f9b3ba7SAlan Somers 	uint32_t	revents;
7608f9b3ba7SAlan Somers 	uint32_t	padding;
7619c62bc70SAlan Somers };
7629c62bc70SAlan Somers 
7639c62bc70SAlan Somers struct fuse_notify_poll_wakeup_out {
7648f9b3ba7SAlan Somers 	uint64_t	kh;
7659c62bc70SAlan Somers };
7669c62bc70SAlan Somers 
767b160acd1SAlan Somers struct fuse_fallocate_in {
7688f9b3ba7SAlan Somers 	uint64_t	fh;
7698f9b3ba7SAlan Somers 	uint64_t	offset;
7708f9b3ba7SAlan Somers 	uint64_t	length;
7718f9b3ba7SAlan Somers 	uint32_t	mode;
7728f9b3ba7SAlan Somers 	uint32_t	padding;
773b160acd1SAlan Somers };
774b160acd1SAlan Somers 
7755fe58019SAttilio Rao struct fuse_in_header {
7768f9b3ba7SAlan Somers 	uint32_t	len;
7778f9b3ba7SAlan Somers 	uint32_t	opcode;
7788f9b3ba7SAlan Somers 	uint64_t	unique;
7798f9b3ba7SAlan Somers 	uint64_t	nodeid;
7808f9b3ba7SAlan Somers 	uint32_t	uid;
7818f9b3ba7SAlan Somers 	uint32_t	gid;
7828f9b3ba7SAlan Somers 	uint32_t	pid;
7838f9b3ba7SAlan Somers 	uint32_t	padding;
7845fe58019SAttilio Rao };
7855fe58019SAttilio Rao 
7865fe58019SAttilio Rao struct fuse_out_header {
7878f9b3ba7SAlan Somers 	uint32_t	len;
7888f9b3ba7SAlan Somers 	int32_t		error;
7898f9b3ba7SAlan Somers 	uint64_t	unique;
7905fe58019SAttilio Rao };
7915fe58019SAttilio Rao 
7925fe58019SAttilio Rao struct fuse_dirent {
7938f9b3ba7SAlan Somers 	uint64_t	ino;
7948f9b3ba7SAlan Somers 	uint64_t	off;
7958f9b3ba7SAlan Somers 	uint32_t	namelen;
7968f9b3ba7SAlan Somers 	uint32_t	type;
797b160acd1SAlan Somers 	char name[];
7985fe58019SAttilio Rao };
7995fe58019SAttilio Rao 
8005fe58019SAttilio Rao #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
80187ff949aSAlan Somers #define FUSE_DIRENT_ALIGN(x) \
80287ff949aSAlan Somers 	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
8035fe58019SAttilio Rao #define FUSE_DIRENT_SIZE(d) \
8045fe58019SAttilio Rao 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
80516bd2d47SAlan Somers 
806b160acd1SAlan Somers struct fuse_direntplus {
807b160acd1SAlan Somers 	struct fuse_entry_out entry_out;
808b160acd1SAlan Somers 	struct fuse_dirent dirent;
809b160acd1SAlan Somers };
810b160acd1SAlan Somers 
811b160acd1SAlan Somers #define FUSE_NAME_OFFSET_DIRENTPLUS \
812b160acd1SAlan Somers 	offsetof(struct fuse_direntplus, dirent.name)
813b160acd1SAlan Somers #define FUSE_DIRENTPLUS_SIZE(d) \
814b160acd1SAlan Somers 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
815b160acd1SAlan Somers 
816a4856c96SAlan Somers struct fuse_notify_inval_inode_out {
8178f9b3ba7SAlan Somers 	uint64_t	ino;
8188f9b3ba7SAlan Somers 	int64_t		off;
8198f9b3ba7SAlan Somers 	int64_t		len;
820a4856c96SAlan Somers };
821a4856c96SAlan Somers 
822a4856c96SAlan Somers struct fuse_notify_inval_entry_out {
8238f9b3ba7SAlan Somers 	uint64_t	parent;
8248f9b3ba7SAlan Somers 	uint32_t	namelen;
8258f9b3ba7SAlan Somers 	uint32_t	padding;
826a4856c96SAlan Somers };
827a4856c96SAlan Somers 
828b160acd1SAlan Somers struct fuse_notify_delete_out {
8298f9b3ba7SAlan Somers 	uint64_t	parent;
8308f9b3ba7SAlan Somers 	uint64_t	child;
8318f9b3ba7SAlan Somers 	uint32_t	namelen;
8328f9b3ba7SAlan Somers 	uint32_t	padding;
833b160acd1SAlan Somers };
834b160acd1SAlan Somers 
835ecb48915SAlan Somers struct fuse_notify_store_out {
8368f9b3ba7SAlan Somers 	uint64_t	nodeid;
8378f9b3ba7SAlan Somers 	uint64_t	offset;
8388f9b3ba7SAlan Somers 	uint32_t	size;
8398f9b3ba7SAlan Somers 	uint32_t	padding;
840ecb48915SAlan Somers };
841ecb48915SAlan Somers 
842ecb48915SAlan Somers struct fuse_notify_retrieve_out {
8438f9b3ba7SAlan Somers 	uint64_t	notify_unique;
8448f9b3ba7SAlan Somers 	uint64_t	nodeid;
8458f9b3ba7SAlan Somers 	uint64_t	offset;
8468f9b3ba7SAlan Somers 	uint32_t	size;
8478f9b3ba7SAlan Somers 	uint32_t	padding;
848ecb48915SAlan Somers };
849ecb48915SAlan Somers 
850ecb48915SAlan Somers /* Matches the size of fuse_write_in */
851ecb48915SAlan Somers struct fuse_notify_retrieve_in {
8528f9b3ba7SAlan Somers 	uint64_t	dummy1;
8538f9b3ba7SAlan Somers 	uint64_t	offset;
8548f9b3ba7SAlan Somers 	uint32_t	size;
8558f9b3ba7SAlan Somers 	uint32_t	dummy2;
8568f9b3ba7SAlan Somers 	uint64_t	dummy3;
8578f9b3ba7SAlan Somers 	uint64_t	dummy4;
858ecb48915SAlan Somers };
859ecb48915SAlan Somers 
86037df9d3bSAlan Somers struct fuse_lseek_in {
86137df9d3bSAlan Somers 	uint64_t	fh;
86237df9d3bSAlan Somers 	uint64_t	offset;
86337df9d3bSAlan Somers 	uint32_t	whence;
86437df9d3bSAlan Somers 	uint32_t	padding;
86537df9d3bSAlan Somers };
86637df9d3bSAlan Somers 
86737df9d3bSAlan Somers struct fuse_lseek_out {
86837df9d3bSAlan Somers 	uint64_t	offset;
86937df9d3bSAlan Somers };
87037df9d3bSAlan Somers 
87192bbfe1fSAlan Somers struct fuse_copy_file_range_in {
87292bbfe1fSAlan Somers 	uint64_t	fh_in;
87392bbfe1fSAlan Somers 	uint64_t	off_in;
87492bbfe1fSAlan Somers 	uint64_t	nodeid_out;
87592bbfe1fSAlan Somers 	uint64_t	fh_out;
87692bbfe1fSAlan Somers 	uint64_t	off_out;
87792bbfe1fSAlan Somers 	uint64_t	len;
87892bbfe1fSAlan Somers 	uint64_t	flags;
87992bbfe1fSAlan Somers };
88092bbfe1fSAlan Somers 
88116bd2d47SAlan Somers #endif /* _FUSE_FUSE_KERNEL_H */
882