1a62a9e19SDr. David Alan Gilbert /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2a62a9e19SDr. David Alan Gilbert /*
3a62a9e19SDr. David Alan Gilbert     This file defines the kernel interface of FUSE
4a62a9e19SDr. David Alan Gilbert     Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu>
5a62a9e19SDr. David Alan Gilbert 
6a62a9e19SDr. David Alan Gilbert     This program can be distributed under the terms of the GNU GPL.
7a62a9e19SDr. David Alan Gilbert     See the file COPYING.
8a62a9e19SDr. David Alan Gilbert 
9a62a9e19SDr. David Alan Gilbert     This -- and only this -- header file may also be distributed under
10a62a9e19SDr. David Alan Gilbert     the terms of the BSD Licence as follows:
11a62a9e19SDr. David Alan Gilbert 
12a62a9e19SDr. David Alan Gilbert     Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
13a62a9e19SDr. David Alan Gilbert 
14a62a9e19SDr. David Alan Gilbert     Redistribution and use in source and binary forms, with or without
15a62a9e19SDr. David Alan Gilbert     modification, are permitted provided that the following conditions
16a62a9e19SDr. David Alan Gilbert     are met:
17a62a9e19SDr. David Alan Gilbert     1. Redistributions of source code must retain the above copyright
18a62a9e19SDr. David Alan Gilbert        notice, this list of conditions and the following disclaimer.
19a62a9e19SDr. David Alan Gilbert     2. Redistributions in binary form must reproduce the above copyright
20a62a9e19SDr. David Alan Gilbert        notice, this list of conditions and the following disclaimer in the
21a62a9e19SDr. David Alan Gilbert        documentation and/or other materials provided with the distribution.
22a62a9e19SDr. David Alan Gilbert 
23a62a9e19SDr. David Alan Gilbert     THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24a62a9e19SDr. David Alan Gilbert     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25a62a9e19SDr. David Alan Gilbert     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26a62a9e19SDr. David Alan Gilbert     ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
27a62a9e19SDr. David Alan Gilbert     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28a62a9e19SDr. David Alan Gilbert     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29a62a9e19SDr. David Alan Gilbert     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30a62a9e19SDr. David Alan Gilbert     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31a62a9e19SDr. David Alan Gilbert     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32a62a9e19SDr. David Alan Gilbert     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33a62a9e19SDr. David Alan Gilbert     SUCH DAMAGE.
34a62a9e19SDr. David Alan Gilbert */
35a62a9e19SDr. David Alan Gilbert 
36a62a9e19SDr. David Alan Gilbert /*
37a62a9e19SDr. David Alan Gilbert  * This file defines the kernel interface of FUSE
38a62a9e19SDr. David Alan Gilbert  *
39a62a9e19SDr. David Alan Gilbert  * Protocol changelog:
40a62a9e19SDr. David Alan Gilbert  *
41a62a9e19SDr. David Alan Gilbert  * 7.1:
42a62a9e19SDr. David Alan Gilbert  *  - add the following messages:
43a62a9e19SDr. David Alan Gilbert  *      FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,
44a62a9e19SDr. David Alan Gilbert  *      FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,
45a62a9e19SDr. David Alan Gilbert  *      FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,
46a62a9e19SDr. David Alan Gilbert  *      FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,
47a62a9e19SDr. David Alan Gilbert  *      FUSE_RELEASEDIR
48a62a9e19SDr. David Alan Gilbert  *  - add padding to messages to accommodate 32-bit servers on 64-bit kernels
49a62a9e19SDr. David Alan Gilbert  *
50a62a9e19SDr. David Alan Gilbert  * 7.2:
51a62a9e19SDr. David Alan Gilbert  *  - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags
52a62a9e19SDr. David Alan Gilbert  *  - add FUSE_FSYNCDIR message
53a62a9e19SDr. David Alan Gilbert  *
54a62a9e19SDr. David Alan Gilbert  * 7.3:
55a62a9e19SDr. David Alan Gilbert  *  - add FUSE_ACCESS message
56a62a9e19SDr. David Alan Gilbert  *  - add FUSE_CREATE message
57a62a9e19SDr. David Alan Gilbert  *  - add filehandle to fuse_setattr_in
58a62a9e19SDr. David Alan Gilbert  *
59a62a9e19SDr. David Alan Gilbert  * 7.4:
60a62a9e19SDr. David Alan Gilbert  *  - add frsize to fuse_kstatfs
61a62a9e19SDr. David Alan Gilbert  *  - clean up request size limit checking
62a62a9e19SDr. David Alan Gilbert  *
63a62a9e19SDr. David Alan Gilbert  * 7.5:
64a62a9e19SDr. David Alan Gilbert  *  - add flags and max_write to fuse_init_out
65a62a9e19SDr. David Alan Gilbert  *
66a62a9e19SDr. David Alan Gilbert  * 7.6:
67a62a9e19SDr. David Alan Gilbert  *  - add max_readahead to fuse_init_in and fuse_init_out
68a62a9e19SDr. David Alan Gilbert  *
69a62a9e19SDr. David Alan Gilbert  * 7.7:
70a62a9e19SDr. David Alan Gilbert  *  - add FUSE_INTERRUPT message
71a62a9e19SDr. David Alan Gilbert  *  - add POSIX file lock support
72a62a9e19SDr. David Alan Gilbert  *
73a62a9e19SDr. David Alan Gilbert  * 7.8:
74a62a9e19SDr. David Alan Gilbert  *  - add lock_owner and flags fields to fuse_release_in
75a62a9e19SDr. David Alan Gilbert  *  - add FUSE_BMAP message
76a62a9e19SDr. David Alan Gilbert  *  - add FUSE_DESTROY message
77a62a9e19SDr. David Alan Gilbert  *
78a62a9e19SDr. David Alan Gilbert  * 7.9:
79a62a9e19SDr. David Alan Gilbert  *  - new fuse_getattr_in input argument of GETATTR
80a62a9e19SDr. David Alan Gilbert  *  - add lk_flags in fuse_lk_in
81a62a9e19SDr. David Alan Gilbert  *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
82a62a9e19SDr. David Alan Gilbert  *  - add blksize field to fuse_attr
83a62a9e19SDr. David Alan Gilbert  *  - add file flags field to fuse_read_in and fuse_write_in
84a62a9e19SDr. David Alan Gilbert  *  - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
85a62a9e19SDr. David Alan Gilbert  *
86a62a9e19SDr. David Alan Gilbert  * 7.10
87a62a9e19SDr. David Alan Gilbert  *  - add nonseekable open flag
88a62a9e19SDr. David Alan Gilbert  *
89a62a9e19SDr. David Alan Gilbert  * 7.11
90a62a9e19SDr. David Alan Gilbert  *  - add IOCTL message
91a62a9e19SDr. David Alan Gilbert  *  - add unsolicited notification support
92a62a9e19SDr. David Alan Gilbert  *  - add POLL message and NOTIFY_POLL notification
93a62a9e19SDr. David Alan Gilbert  *
94a62a9e19SDr. David Alan Gilbert  * 7.12
95a62a9e19SDr. David Alan Gilbert  *  - add umask flag to input argument of create, mknod and mkdir
96a62a9e19SDr. David Alan Gilbert  *  - add notification messages for invalidation of inodes and
97a62a9e19SDr. David Alan Gilbert  *    directory entries
98a62a9e19SDr. David Alan Gilbert  *
99a62a9e19SDr. David Alan Gilbert  * 7.13
100a62a9e19SDr. David Alan Gilbert  *  - make max number of background requests and congestion threshold
101a62a9e19SDr. David Alan Gilbert  *    tunables
102a62a9e19SDr. David Alan Gilbert  *
103a62a9e19SDr. David Alan Gilbert  * 7.14
104a62a9e19SDr. David Alan Gilbert  *  - add splice support to fuse device
105a62a9e19SDr. David Alan Gilbert  *
106a62a9e19SDr. David Alan Gilbert  * 7.15
107a62a9e19SDr. David Alan Gilbert  *  - add store notify
108a62a9e19SDr. David Alan Gilbert  *  - add retrieve notify
109a62a9e19SDr. David Alan Gilbert  *
110a62a9e19SDr. David Alan Gilbert  * 7.16
111a62a9e19SDr. David Alan Gilbert  *  - add BATCH_FORGET request
112a62a9e19SDr. David Alan Gilbert  *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
113a62a9e19SDr. David Alan Gilbert  *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
114a62a9e19SDr. David Alan Gilbert  *  - add FUSE_IOCTL_32BIT flag
115a62a9e19SDr. David Alan Gilbert  *
116a62a9e19SDr. David Alan Gilbert  * 7.17
117a62a9e19SDr. David Alan Gilbert  *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
118a62a9e19SDr. David Alan Gilbert  *
119a62a9e19SDr. David Alan Gilbert  * 7.18
120a62a9e19SDr. David Alan Gilbert  *  - add FUSE_IOCTL_DIR flag
121a62a9e19SDr. David Alan Gilbert  *  - add FUSE_NOTIFY_DELETE
122a62a9e19SDr. David Alan Gilbert  *
123a62a9e19SDr. David Alan Gilbert  * 7.19
124a62a9e19SDr. David Alan Gilbert  *  - add FUSE_FALLOCATE
125a62a9e19SDr. David Alan Gilbert  *
126a62a9e19SDr. David Alan Gilbert  * 7.20
127a62a9e19SDr. David Alan Gilbert  *  - add FUSE_AUTO_INVAL_DATA
128a62a9e19SDr. David Alan Gilbert  *
129a62a9e19SDr. David Alan Gilbert  * 7.21
130a62a9e19SDr. David Alan Gilbert  *  - add FUSE_READDIRPLUS
131a62a9e19SDr. David Alan Gilbert  *  - send the requested events in POLL request
132a62a9e19SDr. David Alan Gilbert  *
133a62a9e19SDr. David Alan Gilbert  * 7.22
134a62a9e19SDr. David Alan Gilbert  *  - add FUSE_ASYNC_DIO
135a62a9e19SDr. David Alan Gilbert  *
136a62a9e19SDr. David Alan Gilbert  * 7.23
137a62a9e19SDr. David Alan Gilbert  *  - add FUSE_WRITEBACK_CACHE
138a62a9e19SDr. David Alan Gilbert  *  - add time_gran to fuse_init_out
139a62a9e19SDr. David Alan Gilbert  *  - add reserved space to fuse_init_out
140a62a9e19SDr. David Alan Gilbert  *  - add FATTR_CTIME
141a62a9e19SDr. David Alan Gilbert  *  - add ctime and ctimensec to fuse_setattr_in
142a62a9e19SDr. David Alan Gilbert  *  - add FUSE_RENAME2 request
143a62a9e19SDr. David Alan Gilbert  *  - add FUSE_NO_OPEN_SUPPORT flag
144a62a9e19SDr. David Alan Gilbert  *
145a62a9e19SDr. David Alan Gilbert  *  7.24
146a62a9e19SDr. David Alan Gilbert  *  - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
147a62a9e19SDr. David Alan Gilbert  *
148a62a9e19SDr. David Alan Gilbert  *  7.25
149a62a9e19SDr. David Alan Gilbert  *  - add FUSE_PARALLEL_DIROPS
150a62a9e19SDr. David Alan Gilbert  *
151a62a9e19SDr. David Alan Gilbert  *  7.26
152a62a9e19SDr. David Alan Gilbert  *  - add FUSE_HANDLE_KILLPRIV
153a62a9e19SDr. David Alan Gilbert  *  - add FUSE_POSIX_ACL
154a62a9e19SDr. David Alan Gilbert  *
155a62a9e19SDr. David Alan Gilbert  *  7.27
156a62a9e19SDr. David Alan Gilbert  *  - add FUSE_ABORT_ERROR
157a62a9e19SDr. David Alan Gilbert  *
158a62a9e19SDr. David Alan Gilbert  *  7.28
159a62a9e19SDr. David Alan Gilbert  *  - add FUSE_COPY_FILE_RANGE
160a62a9e19SDr. David Alan Gilbert  *  - add FOPEN_CACHE_DIR
161a62a9e19SDr. David Alan Gilbert  *  - add FUSE_MAX_PAGES, add max_pages to init_out
162a62a9e19SDr. David Alan Gilbert  *  - add FUSE_CACHE_SYMLINKS
163a62a9e19SDr. David Alan Gilbert  *
164a62a9e19SDr. David Alan Gilbert  *  7.29
165a62a9e19SDr. David Alan Gilbert  *  - add FUSE_NO_OPENDIR_SUPPORT flag
166a62a9e19SDr. David Alan Gilbert  *
167a62a9e19SDr. David Alan Gilbert  *  7.30
168a62a9e19SDr. David Alan Gilbert  *  - add FUSE_EXPLICIT_INVAL_DATA
169a62a9e19SDr. David Alan Gilbert  *  - add FUSE_IOCTL_COMPAT_X32
170a62a9e19SDr. David Alan Gilbert  *
171a62a9e19SDr. David Alan Gilbert  *  7.31
172a62a9e19SDr. David Alan Gilbert  *  - add FUSE_WRITE_KILL_PRIV flag
173a62a9e19SDr. David Alan Gilbert  *  - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
174a62a9e19SDr. David Alan Gilbert  *  - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
17553ba2eeeSMatthew Rosato  *
17653ba2eeeSMatthew Rosato  *  7.32
17753ba2eeeSMatthew Rosato  *  - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS
178*b3c818a4SEric Farman  *
179*b3c818a4SEric Farman  *  7.33
180*b3c818a4SEric Farman  *  - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID
181*b3c818a4SEric Farman  *  - add FUSE_OPEN_KILL_SUIDGID
182a62a9e19SDr. David Alan Gilbert  */
183a62a9e19SDr. David Alan Gilbert 
184a62a9e19SDr. David Alan Gilbert #ifndef _LINUX_FUSE_H
185a62a9e19SDr. David Alan Gilbert #define _LINUX_FUSE_H
186a62a9e19SDr. David Alan Gilbert 
187a62a9e19SDr. David Alan Gilbert #include <stdint.h>
188a62a9e19SDr. David Alan Gilbert 
189a62a9e19SDr. David Alan Gilbert /*
190a62a9e19SDr. David Alan Gilbert  * Version negotiation:
191a62a9e19SDr. David Alan Gilbert  *
192a62a9e19SDr. David Alan Gilbert  * Both the kernel and userspace send the version they support in the
193a62a9e19SDr. David Alan Gilbert  * INIT request and reply respectively.
194a62a9e19SDr. David Alan Gilbert  *
195a62a9e19SDr. David Alan Gilbert  * If the major versions match then both shall use the smallest
196a62a9e19SDr. David Alan Gilbert  * of the two minor versions for communication.
197a62a9e19SDr. David Alan Gilbert  *
198a62a9e19SDr. David Alan Gilbert  * If the kernel supports a larger major version, then userspace shall
199a62a9e19SDr. David Alan Gilbert  * reply with the major version it supports, ignore the rest of the
200a62a9e19SDr. David Alan Gilbert  * INIT message and expect a new INIT message from the kernel with a
201a62a9e19SDr. David Alan Gilbert  * matching major version.
202a62a9e19SDr. David Alan Gilbert  *
203a62a9e19SDr. David Alan Gilbert  * If the library supports a larger major version, then it shall fall
204a62a9e19SDr. David Alan Gilbert  * back to the major protocol version sent by the kernel for
205a62a9e19SDr. David Alan Gilbert  * communication and reply with that major version (and an arbitrary
206a62a9e19SDr. David Alan Gilbert  * supported minor version).
207a62a9e19SDr. David Alan Gilbert  */
208a62a9e19SDr. David Alan Gilbert 
209a62a9e19SDr. David Alan Gilbert /** Version number of this interface */
210a62a9e19SDr. David Alan Gilbert #define FUSE_KERNEL_VERSION 7
211a62a9e19SDr. David Alan Gilbert 
212a62a9e19SDr. David Alan Gilbert /** Minor version number of this interface */
213*b3c818a4SEric Farman #define FUSE_KERNEL_MINOR_VERSION 33
214a62a9e19SDr. David Alan Gilbert 
215a62a9e19SDr. David Alan Gilbert /** The node ID of the root inode */
216a62a9e19SDr. David Alan Gilbert #define FUSE_ROOT_ID 1
217a62a9e19SDr. David Alan Gilbert 
218a62a9e19SDr. David Alan Gilbert /* Make sure all structures are padded to 64bit boundary, so 32bit
219a62a9e19SDr. David Alan Gilbert    userspace works under 64bit kernels */
220a62a9e19SDr. David Alan Gilbert 
221a62a9e19SDr. David Alan Gilbert struct fuse_attr {
222a62a9e19SDr. David Alan Gilbert 	uint64_t	ino;
223a62a9e19SDr. David Alan Gilbert 	uint64_t	size;
224a62a9e19SDr. David Alan Gilbert 	uint64_t	blocks;
225a62a9e19SDr. David Alan Gilbert 	uint64_t	atime;
226a62a9e19SDr. David Alan Gilbert 	uint64_t	mtime;
227a62a9e19SDr. David Alan Gilbert 	uint64_t	ctime;
228a62a9e19SDr. David Alan Gilbert 	uint32_t	atimensec;
229a62a9e19SDr. David Alan Gilbert 	uint32_t	mtimensec;
230a62a9e19SDr. David Alan Gilbert 	uint32_t	ctimensec;
231a62a9e19SDr. David Alan Gilbert 	uint32_t	mode;
232a62a9e19SDr. David Alan Gilbert 	uint32_t	nlink;
233a62a9e19SDr. David Alan Gilbert 	uint32_t	uid;
234a62a9e19SDr. David Alan Gilbert 	uint32_t	gid;
235a62a9e19SDr. David Alan Gilbert 	uint32_t	rdev;
236a62a9e19SDr. David Alan Gilbert 	uint32_t	blksize;
23753ba2eeeSMatthew Rosato 	uint32_t	flags;
238a62a9e19SDr. David Alan Gilbert };
239a62a9e19SDr. David Alan Gilbert 
240a62a9e19SDr. David Alan Gilbert struct fuse_kstatfs {
241a62a9e19SDr. David Alan Gilbert 	uint64_t	blocks;
242a62a9e19SDr. David Alan Gilbert 	uint64_t	bfree;
243a62a9e19SDr. David Alan Gilbert 	uint64_t	bavail;
244a62a9e19SDr. David Alan Gilbert 	uint64_t	files;
245a62a9e19SDr. David Alan Gilbert 	uint64_t	ffree;
246a62a9e19SDr. David Alan Gilbert 	uint32_t	bsize;
247a62a9e19SDr. David Alan Gilbert 	uint32_t	namelen;
248a62a9e19SDr. David Alan Gilbert 	uint32_t	frsize;
249a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
250a62a9e19SDr. David Alan Gilbert 	uint32_t	spare[6];
251a62a9e19SDr. David Alan Gilbert };
252a62a9e19SDr. David Alan Gilbert 
253a62a9e19SDr. David Alan Gilbert struct fuse_file_lock {
254a62a9e19SDr. David Alan Gilbert 	uint64_t	start;
255a62a9e19SDr. David Alan Gilbert 	uint64_t	end;
256a62a9e19SDr. David Alan Gilbert 	uint32_t	type;
257a62a9e19SDr. David Alan Gilbert 	uint32_t	pid; /* tgid */
258a62a9e19SDr. David Alan Gilbert };
259a62a9e19SDr. David Alan Gilbert 
260a62a9e19SDr. David Alan Gilbert /**
261a62a9e19SDr. David Alan Gilbert  * Bitmasks for fuse_setattr_in.valid
262a62a9e19SDr. David Alan Gilbert  */
263a62a9e19SDr. David Alan Gilbert #define FATTR_MODE	(1 << 0)
264a62a9e19SDr. David Alan Gilbert #define FATTR_UID	(1 << 1)
265a62a9e19SDr. David Alan Gilbert #define FATTR_GID	(1 << 2)
266a62a9e19SDr. David Alan Gilbert #define FATTR_SIZE	(1 << 3)
267a62a9e19SDr. David Alan Gilbert #define FATTR_ATIME	(1 << 4)
268a62a9e19SDr. David Alan Gilbert #define FATTR_MTIME	(1 << 5)
269a62a9e19SDr. David Alan Gilbert #define FATTR_FH	(1 << 6)
270a62a9e19SDr. David Alan Gilbert #define FATTR_ATIME_NOW	(1 << 7)
271a62a9e19SDr. David Alan Gilbert #define FATTR_MTIME_NOW	(1 << 8)
272a62a9e19SDr. David Alan Gilbert #define FATTR_LOCKOWNER	(1 << 9)
273a62a9e19SDr. David Alan Gilbert #define FATTR_CTIME	(1 << 10)
274*b3c818a4SEric Farman #define FATTR_KILL_SUIDGID	(1 << 11)
275a62a9e19SDr. David Alan Gilbert 
276a62a9e19SDr. David Alan Gilbert /**
277a62a9e19SDr. David Alan Gilbert  * Flags returned by the OPEN request
278a62a9e19SDr. David Alan Gilbert  *
279a62a9e19SDr. David Alan Gilbert  * FOPEN_DIRECT_IO: bypass page cache for this open file
280a62a9e19SDr. David Alan Gilbert  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
281a62a9e19SDr. David Alan Gilbert  * FOPEN_NONSEEKABLE: the file is not seekable
282a62a9e19SDr. David Alan Gilbert  * FOPEN_CACHE_DIR: allow caching this directory
283a62a9e19SDr. David Alan Gilbert  * FOPEN_STREAM: the file is stream-like (no file position at all)
284a62a9e19SDr. David Alan Gilbert  */
285a62a9e19SDr. David Alan Gilbert #define FOPEN_DIRECT_IO		(1 << 0)
286a62a9e19SDr. David Alan Gilbert #define FOPEN_KEEP_CACHE	(1 << 1)
287a62a9e19SDr. David Alan Gilbert #define FOPEN_NONSEEKABLE	(1 << 2)
288a62a9e19SDr. David Alan Gilbert #define FOPEN_CACHE_DIR		(1 << 3)
289a62a9e19SDr. David Alan Gilbert #define FOPEN_STREAM		(1 << 4)
290a62a9e19SDr. David Alan Gilbert 
291a62a9e19SDr. David Alan Gilbert /**
292a62a9e19SDr. David Alan Gilbert  * INIT request/reply flags
293a62a9e19SDr. David Alan Gilbert  *
294a62a9e19SDr. David Alan Gilbert  * FUSE_ASYNC_READ: asynchronous read requests
295a62a9e19SDr. David Alan Gilbert  * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
296a62a9e19SDr. David Alan Gilbert  * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
297a62a9e19SDr. David Alan Gilbert  * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
298a62a9e19SDr. David Alan Gilbert  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
299a62a9e19SDr. David Alan Gilbert  * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
300a62a9e19SDr. David Alan Gilbert  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
301a62a9e19SDr. David Alan Gilbert  * FUSE_SPLICE_WRITE: kernel supports splice write on the device
302a62a9e19SDr. David Alan Gilbert  * FUSE_SPLICE_MOVE: kernel supports splice move on the device
303a62a9e19SDr. David Alan Gilbert  * FUSE_SPLICE_READ: kernel supports splice read on the device
304a62a9e19SDr. David Alan Gilbert  * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
305a62a9e19SDr. David Alan Gilbert  * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
306a62a9e19SDr. David Alan Gilbert  * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
307a62a9e19SDr. David Alan Gilbert  * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
308a62a9e19SDr. David Alan Gilbert  * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
309a62a9e19SDr. David Alan Gilbert  * FUSE_ASYNC_DIO: asynchronous direct I/O submission
310a62a9e19SDr. David Alan Gilbert  * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
311a62a9e19SDr. David Alan Gilbert  * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
312a62a9e19SDr. David Alan Gilbert  * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
313a62a9e19SDr. David Alan Gilbert  * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
314a62a9e19SDr. David Alan Gilbert  * FUSE_POSIX_ACL: filesystem supports posix acls
315a62a9e19SDr. David Alan Gilbert  * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
316a62a9e19SDr. David Alan Gilbert  * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
317a62a9e19SDr. David Alan Gilbert  * FUSE_CACHE_SYMLINKS: cache READLINK responses
318a62a9e19SDr. David Alan Gilbert  * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
319a62a9e19SDr. David Alan Gilbert  * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
32053ba2eeeSMatthew Rosato  * FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for
32153ba2eeeSMatthew Rosato  *		       foffset and moffset fields in struct
32253ba2eeeSMatthew Rosato  *		       fuse_setupmapping_out and fuse_removemapping_one.
32353ba2eeeSMatthew Rosato  * FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts
324*b3c818a4SEric Farman  * FUSE_HANDLE_KILLPRIV_V2: fs kills suid/sgid/cap on write/chown/trunc.
325*b3c818a4SEric Farman  *			Upon write/truncate suid/sgid is only killed if caller
326*b3c818a4SEric Farman  *			does not have CAP_FSETID. Additionally upon
327*b3c818a4SEric Farman  *			write/truncate sgid is killed only if file has group
328*b3c818a4SEric Farman  *			execute permission. (Same as Linux VFS behavior).
329a62a9e19SDr. David Alan Gilbert  */
330a62a9e19SDr. David Alan Gilbert #define FUSE_ASYNC_READ		(1 << 0)
331a62a9e19SDr. David Alan Gilbert #define FUSE_POSIX_LOCKS	(1 << 1)
332a62a9e19SDr. David Alan Gilbert #define FUSE_FILE_OPS		(1 << 2)
333a62a9e19SDr. David Alan Gilbert #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
334a62a9e19SDr. David Alan Gilbert #define FUSE_EXPORT_SUPPORT	(1 << 4)
335a62a9e19SDr. David Alan Gilbert #define FUSE_BIG_WRITES		(1 << 5)
336a62a9e19SDr. David Alan Gilbert #define FUSE_DONT_MASK		(1 << 6)
337a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_WRITE	(1 << 7)
338a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_MOVE	(1 << 8)
339a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_READ	(1 << 9)
340a62a9e19SDr. David Alan Gilbert #define FUSE_FLOCK_LOCKS	(1 << 10)
341a62a9e19SDr. David Alan Gilbert #define FUSE_HAS_IOCTL_DIR	(1 << 11)
342a62a9e19SDr. David Alan Gilbert #define FUSE_AUTO_INVAL_DATA	(1 << 12)
343a62a9e19SDr. David Alan Gilbert #define FUSE_DO_READDIRPLUS	(1 << 13)
344a62a9e19SDr. David Alan Gilbert #define FUSE_READDIRPLUS_AUTO	(1 << 14)
345a62a9e19SDr. David Alan Gilbert #define FUSE_ASYNC_DIO		(1 << 15)
346a62a9e19SDr. David Alan Gilbert #define FUSE_WRITEBACK_CACHE	(1 << 16)
347a62a9e19SDr. David Alan Gilbert #define FUSE_NO_OPEN_SUPPORT	(1 << 17)
348a62a9e19SDr. David Alan Gilbert #define FUSE_PARALLEL_DIROPS    (1 << 18)
349a62a9e19SDr. David Alan Gilbert #define FUSE_HANDLE_KILLPRIV	(1 << 19)
350a62a9e19SDr. David Alan Gilbert #define FUSE_POSIX_ACL		(1 << 20)
351a62a9e19SDr. David Alan Gilbert #define FUSE_ABORT_ERROR	(1 << 21)
352a62a9e19SDr. David Alan Gilbert #define FUSE_MAX_PAGES		(1 << 22)
353a62a9e19SDr. David Alan Gilbert #define FUSE_CACHE_SYMLINKS	(1 << 23)
354a62a9e19SDr. David Alan Gilbert #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
355a62a9e19SDr. David Alan Gilbert #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
356a62a9e19SDr. David Alan Gilbert #define FUSE_MAP_ALIGNMENT	(1 << 26)
35753ba2eeeSMatthew Rosato #define FUSE_SUBMOUNTS		(1 << 27)
358*b3c818a4SEric Farman #define FUSE_HANDLE_KILLPRIV_V2	(1 << 28)
359a62a9e19SDr. David Alan Gilbert 
360a62a9e19SDr. David Alan Gilbert /**
361a62a9e19SDr. David Alan Gilbert  * CUSE INIT request/reply flags
362a62a9e19SDr. David Alan Gilbert  *
363a62a9e19SDr. David Alan Gilbert  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
364a62a9e19SDr. David Alan Gilbert  */
365a62a9e19SDr. David Alan Gilbert #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
366a62a9e19SDr. David Alan Gilbert 
367a62a9e19SDr. David Alan Gilbert /**
368a62a9e19SDr. David Alan Gilbert  * Release flags
369a62a9e19SDr. David Alan Gilbert  */
370a62a9e19SDr. David Alan Gilbert #define FUSE_RELEASE_FLUSH	(1 << 0)
371a62a9e19SDr. David Alan Gilbert #define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
372a62a9e19SDr. David Alan Gilbert 
373a62a9e19SDr. David Alan Gilbert /**
374a62a9e19SDr. David Alan Gilbert  * Getattr flags
375a62a9e19SDr. David Alan Gilbert  */
376a62a9e19SDr. David Alan Gilbert #define FUSE_GETATTR_FH		(1 << 0)
377a62a9e19SDr. David Alan Gilbert 
378a62a9e19SDr. David Alan Gilbert /**
379a62a9e19SDr. David Alan Gilbert  * Lock flags
380a62a9e19SDr. David Alan Gilbert  */
381a62a9e19SDr. David Alan Gilbert #define FUSE_LK_FLOCK		(1 << 0)
382a62a9e19SDr. David Alan Gilbert 
383a62a9e19SDr. David Alan Gilbert /**
384a62a9e19SDr. David Alan Gilbert  * WRITE flags
385a62a9e19SDr. David Alan Gilbert  *
386a62a9e19SDr. David Alan Gilbert  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
387a62a9e19SDr. David Alan Gilbert  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
388*b3c818a4SEric Farman  * FUSE_WRITE_KILL_SUIDGID: kill suid and sgid bits
389a62a9e19SDr. David Alan Gilbert  */
390a62a9e19SDr. David Alan Gilbert #define FUSE_WRITE_CACHE	(1 << 0)
391a62a9e19SDr. David Alan Gilbert #define FUSE_WRITE_LOCKOWNER	(1 << 1)
392*b3c818a4SEric Farman #define FUSE_WRITE_KILL_SUIDGID (1 << 2)
393*b3c818a4SEric Farman 
394*b3c818a4SEric Farman /* Obsolete alias; this flag implies killing suid/sgid only. */
395*b3c818a4SEric Farman #define FUSE_WRITE_KILL_PRIV	FUSE_WRITE_KILL_SUIDGID
396a62a9e19SDr. David Alan Gilbert 
397a62a9e19SDr. David Alan Gilbert /**
398a62a9e19SDr. David Alan Gilbert  * Read flags
399a62a9e19SDr. David Alan Gilbert  */
400a62a9e19SDr. David Alan Gilbert #define FUSE_READ_LOCKOWNER	(1 << 1)
401a62a9e19SDr. David Alan Gilbert 
402a62a9e19SDr. David Alan Gilbert /**
403a62a9e19SDr. David Alan Gilbert  * Ioctl flags
404a62a9e19SDr. David Alan Gilbert  *
405a62a9e19SDr. David Alan Gilbert  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
406a62a9e19SDr. David Alan Gilbert  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
407a62a9e19SDr. David Alan Gilbert  * FUSE_IOCTL_RETRY: retry with new iovecs
408a62a9e19SDr. David Alan Gilbert  * FUSE_IOCTL_32BIT: 32bit ioctl
409a62a9e19SDr. David Alan Gilbert  * FUSE_IOCTL_DIR: is a directory
410a62a9e19SDr. David Alan Gilbert  * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t)
411a62a9e19SDr. David Alan Gilbert  *
412a62a9e19SDr. David Alan Gilbert  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
413a62a9e19SDr. David Alan Gilbert  */
414a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_COMPAT	(1 << 0)
415a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
416a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_RETRY	(1 << 2)
417a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_32BIT	(1 << 3)
418a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_DIR		(1 << 4)
419a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_COMPAT_X32	(1 << 5)
420a62a9e19SDr. David Alan Gilbert 
421a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_MAX_IOV	256
422a62a9e19SDr. David Alan Gilbert 
423a62a9e19SDr. David Alan Gilbert /**
424a62a9e19SDr. David Alan Gilbert  * Poll flags
425a62a9e19SDr. David Alan Gilbert  *
426a62a9e19SDr. David Alan Gilbert  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
427a62a9e19SDr. David Alan Gilbert  */
428a62a9e19SDr. David Alan Gilbert #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
429a62a9e19SDr. David Alan Gilbert 
430a62a9e19SDr. David Alan Gilbert /**
431a62a9e19SDr. David Alan Gilbert  * Fsync flags
432a62a9e19SDr. David Alan Gilbert  *
433a62a9e19SDr. David Alan Gilbert  * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata
434a62a9e19SDr. David Alan Gilbert  */
435a62a9e19SDr. David Alan Gilbert #define FUSE_FSYNC_FDATASYNC	(1 << 0)
436a62a9e19SDr. David Alan Gilbert 
43753ba2eeeSMatthew Rosato /**
43853ba2eeeSMatthew Rosato  * fuse_attr flags
43953ba2eeeSMatthew Rosato  *
44053ba2eeeSMatthew Rosato  * FUSE_ATTR_SUBMOUNT: Object is a submount root
44153ba2eeeSMatthew Rosato  */
44253ba2eeeSMatthew Rosato #define FUSE_ATTR_SUBMOUNT      (1 << 0)
44353ba2eeeSMatthew Rosato 
444*b3c818a4SEric Farman /**
445*b3c818a4SEric Farman  * Open flags
446*b3c818a4SEric Farman  * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable
447*b3c818a4SEric Farman  */
448*b3c818a4SEric Farman #define FUSE_OPEN_KILL_SUIDGID	(1 << 0)
449*b3c818a4SEric Farman 
450a62a9e19SDr. David Alan Gilbert enum fuse_opcode {
451a62a9e19SDr. David Alan Gilbert 	FUSE_LOOKUP		= 1,
452a62a9e19SDr. David Alan Gilbert 	FUSE_FORGET		= 2,  /* no reply */
453a62a9e19SDr. David Alan Gilbert 	FUSE_GETATTR		= 3,
454a62a9e19SDr. David Alan Gilbert 	FUSE_SETATTR		= 4,
455a62a9e19SDr. David Alan Gilbert 	FUSE_READLINK		= 5,
456a62a9e19SDr. David Alan Gilbert 	FUSE_SYMLINK		= 6,
457a62a9e19SDr. David Alan Gilbert 	FUSE_MKNOD		= 8,
458a62a9e19SDr. David Alan Gilbert 	FUSE_MKDIR		= 9,
459a62a9e19SDr. David Alan Gilbert 	FUSE_UNLINK		= 10,
460a62a9e19SDr. David Alan Gilbert 	FUSE_RMDIR		= 11,
461a62a9e19SDr. David Alan Gilbert 	FUSE_RENAME		= 12,
462a62a9e19SDr. David Alan Gilbert 	FUSE_LINK		= 13,
463a62a9e19SDr. David Alan Gilbert 	FUSE_OPEN		= 14,
464a62a9e19SDr. David Alan Gilbert 	FUSE_READ		= 15,
465a62a9e19SDr. David Alan Gilbert 	FUSE_WRITE		= 16,
466a62a9e19SDr. David Alan Gilbert 	FUSE_STATFS		= 17,
467a62a9e19SDr. David Alan Gilbert 	FUSE_RELEASE		= 18,
468a62a9e19SDr. David Alan Gilbert 	FUSE_FSYNC		= 20,
469a62a9e19SDr. David Alan Gilbert 	FUSE_SETXATTR		= 21,
470a62a9e19SDr. David Alan Gilbert 	FUSE_GETXATTR		= 22,
471a62a9e19SDr. David Alan Gilbert 	FUSE_LISTXATTR		= 23,
472a62a9e19SDr. David Alan Gilbert 	FUSE_REMOVEXATTR	= 24,
473a62a9e19SDr. David Alan Gilbert 	FUSE_FLUSH		= 25,
474a62a9e19SDr. David Alan Gilbert 	FUSE_INIT		= 26,
475a62a9e19SDr. David Alan Gilbert 	FUSE_OPENDIR		= 27,
476a62a9e19SDr. David Alan Gilbert 	FUSE_READDIR		= 28,
477a62a9e19SDr. David Alan Gilbert 	FUSE_RELEASEDIR		= 29,
478a62a9e19SDr. David Alan Gilbert 	FUSE_FSYNCDIR		= 30,
479a62a9e19SDr. David Alan Gilbert 	FUSE_GETLK		= 31,
480a62a9e19SDr. David Alan Gilbert 	FUSE_SETLK		= 32,
481a62a9e19SDr. David Alan Gilbert 	FUSE_SETLKW		= 33,
482a62a9e19SDr. David Alan Gilbert 	FUSE_ACCESS		= 34,
483a62a9e19SDr. David Alan Gilbert 	FUSE_CREATE		= 35,
484a62a9e19SDr. David Alan Gilbert 	FUSE_INTERRUPT		= 36,
485a62a9e19SDr. David Alan Gilbert 	FUSE_BMAP		= 37,
486a62a9e19SDr. David Alan Gilbert 	FUSE_DESTROY		= 38,
487a62a9e19SDr. David Alan Gilbert 	FUSE_IOCTL		= 39,
488a62a9e19SDr. David Alan Gilbert 	FUSE_POLL		= 40,
489a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_REPLY	= 41,
490a62a9e19SDr. David Alan Gilbert 	FUSE_BATCH_FORGET	= 42,
491a62a9e19SDr. David Alan Gilbert 	FUSE_FALLOCATE		= 43,
492a62a9e19SDr. David Alan Gilbert 	FUSE_READDIRPLUS	= 44,
493a62a9e19SDr. David Alan Gilbert 	FUSE_RENAME2		= 45,
494a62a9e19SDr. David Alan Gilbert 	FUSE_LSEEK		= 46,
495a62a9e19SDr. David Alan Gilbert 	FUSE_COPY_FILE_RANGE	= 47,
496a62a9e19SDr. David Alan Gilbert 	FUSE_SETUPMAPPING	= 48,
497a62a9e19SDr. David Alan Gilbert 	FUSE_REMOVEMAPPING	= 49,
498a62a9e19SDr. David Alan Gilbert 
499a62a9e19SDr. David Alan Gilbert 	/* CUSE specific operations */
500a62a9e19SDr. David Alan Gilbert 	CUSE_INIT		= 4096,
501a62a9e19SDr. David Alan Gilbert 
502a62a9e19SDr. David Alan Gilbert 	/* Reserved opcodes: helpful to detect structure endian-ness */
503a62a9e19SDr. David Alan Gilbert 	CUSE_INIT_BSWAP_RESERVED	= 1048576,	/* CUSE_INIT << 8 */
504a62a9e19SDr. David Alan Gilbert 	FUSE_INIT_BSWAP_RESERVED	= 436207616,	/* FUSE_INIT << 24 */
505a62a9e19SDr. David Alan Gilbert };
506a62a9e19SDr. David Alan Gilbert 
507a62a9e19SDr. David Alan Gilbert enum fuse_notify_code {
508a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_POLL   = 1,
509a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_INVAL_INODE = 2,
510a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_INVAL_ENTRY = 3,
511a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_STORE = 4,
512a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_RETRIEVE = 5,
513a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_DELETE = 6,
514a62a9e19SDr. David Alan Gilbert 	FUSE_NOTIFY_CODE_MAX,
515a62a9e19SDr. David Alan Gilbert };
516a62a9e19SDr. David Alan Gilbert 
517a62a9e19SDr. David Alan Gilbert /* The read buffer is required to be at least 8k, but may be much larger */
518a62a9e19SDr. David Alan Gilbert #define FUSE_MIN_READ_BUFFER 8192
519a62a9e19SDr. David Alan Gilbert 
520a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
521a62a9e19SDr. David Alan Gilbert 
522a62a9e19SDr. David Alan Gilbert struct fuse_entry_out {
523a62a9e19SDr. David Alan Gilbert 	uint64_t	nodeid;		/* Inode ID */
524a62a9e19SDr. David Alan Gilbert 	uint64_t	generation;	/* Inode generation: nodeid:gen must
525a62a9e19SDr. David Alan Gilbert 					   be unique for the fs's lifetime */
526a62a9e19SDr. David Alan Gilbert 	uint64_t	entry_valid;	/* Cache timeout for the name */
527a62a9e19SDr. David Alan Gilbert 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
528a62a9e19SDr. David Alan Gilbert 	uint32_t	entry_valid_nsec;
529a62a9e19SDr. David Alan Gilbert 	uint32_t	attr_valid_nsec;
530a62a9e19SDr. David Alan Gilbert 	struct fuse_attr attr;
531a62a9e19SDr. David Alan Gilbert };
532a62a9e19SDr. David Alan Gilbert 
533a62a9e19SDr. David Alan Gilbert struct fuse_forget_in {
534a62a9e19SDr. David Alan Gilbert 	uint64_t	nlookup;
535a62a9e19SDr. David Alan Gilbert };
536a62a9e19SDr. David Alan Gilbert 
537a62a9e19SDr. David Alan Gilbert struct fuse_forget_one {
538a62a9e19SDr. David Alan Gilbert 	uint64_t	nodeid;
539a62a9e19SDr. David Alan Gilbert 	uint64_t	nlookup;
540a62a9e19SDr. David Alan Gilbert };
541a62a9e19SDr. David Alan Gilbert 
542a62a9e19SDr. David Alan Gilbert struct fuse_batch_forget_in {
543a62a9e19SDr. David Alan Gilbert 	uint32_t	count;
544a62a9e19SDr. David Alan Gilbert 	uint32_t	dummy;
545a62a9e19SDr. David Alan Gilbert };
546a62a9e19SDr. David Alan Gilbert 
547a62a9e19SDr. David Alan Gilbert struct fuse_getattr_in {
548a62a9e19SDr. David Alan Gilbert 	uint32_t	getattr_flags;
549a62a9e19SDr. David Alan Gilbert 	uint32_t	dummy;
550a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
551a62a9e19SDr. David Alan Gilbert };
552a62a9e19SDr. David Alan Gilbert 
553a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_ATTR_OUT_SIZE 96
554a62a9e19SDr. David Alan Gilbert 
555a62a9e19SDr. David Alan Gilbert struct fuse_attr_out {
556a62a9e19SDr. David Alan Gilbert 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
557a62a9e19SDr. David Alan Gilbert 	uint32_t	attr_valid_nsec;
558a62a9e19SDr. David Alan Gilbert 	uint32_t	dummy;
559a62a9e19SDr. David Alan Gilbert 	struct fuse_attr attr;
560a62a9e19SDr. David Alan Gilbert };
561a62a9e19SDr. David Alan Gilbert 
562a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_MKNOD_IN_SIZE 8
563a62a9e19SDr. David Alan Gilbert 
564a62a9e19SDr. David Alan Gilbert struct fuse_mknod_in {
565a62a9e19SDr. David Alan Gilbert 	uint32_t	mode;
566a62a9e19SDr. David Alan Gilbert 	uint32_t	rdev;
567a62a9e19SDr. David Alan Gilbert 	uint32_t	umask;
568a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
569a62a9e19SDr. David Alan Gilbert };
570a62a9e19SDr. David Alan Gilbert 
571a62a9e19SDr. David Alan Gilbert struct fuse_mkdir_in {
572a62a9e19SDr. David Alan Gilbert 	uint32_t	mode;
573a62a9e19SDr. David Alan Gilbert 	uint32_t	umask;
574a62a9e19SDr. David Alan Gilbert };
575a62a9e19SDr. David Alan Gilbert 
576a62a9e19SDr. David Alan Gilbert struct fuse_rename_in {
577a62a9e19SDr. David Alan Gilbert 	uint64_t	newdir;
578a62a9e19SDr. David Alan Gilbert };
579a62a9e19SDr. David Alan Gilbert 
580a62a9e19SDr. David Alan Gilbert struct fuse_rename2_in {
581a62a9e19SDr. David Alan Gilbert 	uint64_t	newdir;
582a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
583a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
584a62a9e19SDr. David Alan Gilbert };
585a62a9e19SDr. David Alan Gilbert 
586a62a9e19SDr. David Alan Gilbert struct fuse_link_in {
587a62a9e19SDr. David Alan Gilbert 	uint64_t	oldnodeid;
588a62a9e19SDr. David Alan Gilbert };
589a62a9e19SDr. David Alan Gilbert 
590a62a9e19SDr. David Alan Gilbert struct fuse_setattr_in {
591a62a9e19SDr. David Alan Gilbert 	uint32_t	valid;
592a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
593a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
594a62a9e19SDr. David Alan Gilbert 	uint64_t	size;
595a62a9e19SDr. David Alan Gilbert 	uint64_t	lock_owner;
596a62a9e19SDr. David Alan Gilbert 	uint64_t	atime;
597a62a9e19SDr. David Alan Gilbert 	uint64_t	mtime;
598a62a9e19SDr. David Alan Gilbert 	uint64_t	ctime;
599a62a9e19SDr. David Alan Gilbert 	uint32_t	atimensec;
600a62a9e19SDr. David Alan Gilbert 	uint32_t	mtimensec;
601a62a9e19SDr. David Alan Gilbert 	uint32_t	ctimensec;
602a62a9e19SDr. David Alan Gilbert 	uint32_t	mode;
603a62a9e19SDr. David Alan Gilbert 	uint32_t	unused4;
604a62a9e19SDr. David Alan Gilbert 	uint32_t	uid;
605a62a9e19SDr. David Alan Gilbert 	uint32_t	gid;
606a62a9e19SDr. David Alan Gilbert 	uint32_t	unused5;
607a62a9e19SDr. David Alan Gilbert };
608a62a9e19SDr. David Alan Gilbert 
609a62a9e19SDr. David Alan Gilbert struct fuse_open_in {
610a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
611*b3c818a4SEric Farman 	uint32_t	open_flags;	/* FUSE_OPEN_... */
612a62a9e19SDr. David Alan Gilbert };
613a62a9e19SDr. David Alan Gilbert 
614a62a9e19SDr. David Alan Gilbert struct fuse_create_in {
615a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
616a62a9e19SDr. David Alan Gilbert 	uint32_t	mode;
617a62a9e19SDr. David Alan Gilbert 	uint32_t	umask;
618*b3c818a4SEric Farman 	uint32_t	open_flags;	/* FUSE_OPEN_... */
619a62a9e19SDr. David Alan Gilbert };
620a62a9e19SDr. David Alan Gilbert 
621a62a9e19SDr. David Alan Gilbert struct fuse_open_out {
622a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
623a62a9e19SDr. David Alan Gilbert 	uint32_t	open_flags;
624a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
625a62a9e19SDr. David Alan Gilbert };
626a62a9e19SDr. David Alan Gilbert 
627a62a9e19SDr. David Alan Gilbert struct fuse_release_in {
628a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
629a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
630a62a9e19SDr. David Alan Gilbert 	uint32_t	release_flags;
631a62a9e19SDr. David Alan Gilbert 	uint64_t	lock_owner;
632a62a9e19SDr. David Alan Gilbert };
633a62a9e19SDr. David Alan Gilbert 
634a62a9e19SDr. David Alan Gilbert struct fuse_flush_in {
635a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
636a62a9e19SDr. David Alan Gilbert 	uint32_t	unused;
637a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
638a62a9e19SDr. David Alan Gilbert 	uint64_t	lock_owner;
639a62a9e19SDr. David Alan Gilbert };
640a62a9e19SDr. David Alan Gilbert 
641a62a9e19SDr. David Alan Gilbert struct fuse_read_in {
642a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
643a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
644a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
645a62a9e19SDr. David Alan Gilbert 	uint32_t	read_flags;
646a62a9e19SDr. David Alan Gilbert 	uint64_t	lock_owner;
647a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
648a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
649a62a9e19SDr. David Alan Gilbert };
650a62a9e19SDr. David Alan Gilbert 
651a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_WRITE_IN_SIZE 24
652a62a9e19SDr. David Alan Gilbert 
653a62a9e19SDr. David Alan Gilbert struct fuse_write_in {
654a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
655a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
656a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
657a62a9e19SDr. David Alan Gilbert 	uint32_t	write_flags;
658a62a9e19SDr. David Alan Gilbert 	uint64_t	lock_owner;
659a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
660a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
661a62a9e19SDr. David Alan Gilbert };
662a62a9e19SDr. David Alan Gilbert 
663a62a9e19SDr. David Alan Gilbert struct fuse_write_out {
664a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
665a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
666a62a9e19SDr. David Alan Gilbert };
667a62a9e19SDr. David Alan Gilbert 
668a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_STATFS_SIZE 48
669a62a9e19SDr. David Alan Gilbert 
670a62a9e19SDr. David Alan Gilbert struct fuse_statfs_out {
671a62a9e19SDr. David Alan Gilbert 	struct fuse_kstatfs st;
672a62a9e19SDr. David Alan Gilbert };
673a62a9e19SDr. David Alan Gilbert 
674a62a9e19SDr. David Alan Gilbert struct fuse_fsync_in {
675a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
676a62a9e19SDr. David Alan Gilbert 	uint32_t	fsync_flags;
677a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
678a62a9e19SDr. David Alan Gilbert };
679a62a9e19SDr. David Alan Gilbert 
680a62a9e19SDr. David Alan Gilbert struct fuse_setxattr_in {
681a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
682a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
683a62a9e19SDr. David Alan Gilbert };
684a62a9e19SDr. David Alan Gilbert 
685a62a9e19SDr. David Alan Gilbert struct fuse_getxattr_in {
686a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
687a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
688a62a9e19SDr. David Alan Gilbert };
689a62a9e19SDr. David Alan Gilbert 
690a62a9e19SDr. David Alan Gilbert struct fuse_getxattr_out {
691a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
692a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
693a62a9e19SDr. David Alan Gilbert };
694a62a9e19SDr. David Alan Gilbert 
695a62a9e19SDr. David Alan Gilbert struct fuse_lk_in {
696a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
697a62a9e19SDr. David Alan Gilbert 	uint64_t	owner;
698a62a9e19SDr. David Alan Gilbert 	struct fuse_file_lock lk;
699a62a9e19SDr. David Alan Gilbert 	uint32_t	lk_flags;
700a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
701a62a9e19SDr. David Alan Gilbert };
702a62a9e19SDr. David Alan Gilbert 
703a62a9e19SDr. David Alan Gilbert struct fuse_lk_out {
704a62a9e19SDr. David Alan Gilbert 	struct fuse_file_lock lk;
705a62a9e19SDr. David Alan Gilbert };
706a62a9e19SDr. David Alan Gilbert 
707a62a9e19SDr. David Alan Gilbert struct fuse_access_in {
708a62a9e19SDr. David Alan Gilbert 	uint32_t	mask;
709a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
710a62a9e19SDr. David Alan Gilbert };
711a62a9e19SDr. David Alan Gilbert 
712a62a9e19SDr. David Alan Gilbert struct fuse_init_in {
713a62a9e19SDr. David Alan Gilbert 	uint32_t	major;
714a62a9e19SDr. David Alan Gilbert 	uint32_t	minor;
715a62a9e19SDr. David Alan Gilbert 	uint32_t	max_readahead;
716a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
717a62a9e19SDr. David Alan Gilbert };
718a62a9e19SDr. David Alan Gilbert 
719a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_INIT_OUT_SIZE 8
720a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
721a62a9e19SDr. David Alan Gilbert 
722a62a9e19SDr. David Alan Gilbert struct fuse_init_out {
723a62a9e19SDr. David Alan Gilbert 	uint32_t	major;
724a62a9e19SDr. David Alan Gilbert 	uint32_t	minor;
725a62a9e19SDr. David Alan Gilbert 	uint32_t	max_readahead;
726a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
727a62a9e19SDr. David Alan Gilbert 	uint16_t	max_background;
728a62a9e19SDr. David Alan Gilbert 	uint16_t	congestion_threshold;
729a62a9e19SDr. David Alan Gilbert 	uint32_t	max_write;
730a62a9e19SDr. David Alan Gilbert 	uint32_t	time_gran;
731a62a9e19SDr. David Alan Gilbert 	uint16_t	max_pages;
732a62a9e19SDr. David Alan Gilbert 	uint16_t	map_alignment;
733a62a9e19SDr. David Alan Gilbert 	uint32_t	unused[8];
734a62a9e19SDr. David Alan Gilbert };
735a62a9e19SDr. David Alan Gilbert 
736a62a9e19SDr. David Alan Gilbert #define CUSE_INIT_INFO_MAX 4096
737a62a9e19SDr. David Alan Gilbert 
738a62a9e19SDr. David Alan Gilbert struct cuse_init_in {
739a62a9e19SDr. David Alan Gilbert 	uint32_t	major;
740a62a9e19SDr. David Alan Gilbert 	uint32_t	minor;
741a62a9e19SDr. David Alan Gilbert 	uint32_t	unused;
742a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
743a62a9e19SDr. David Alan Gilbert };
744a62a9e19SDr. David Alan Gilbert 
745a62a9e19SDr. David Alan Gilbert struct cuse_init_out {
746a62a9e19SDr. David Alan Gilbert 	uint32_t	major;
747a62a9e19SDr. David Alan Gilbert 	uint32_t	minor;
748a62a9e19SDr. David Alan Gilbert 	uint32_t	unused;
749a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
750a62a9e19SDr. David Alan Gilbert 	uint32_t	max_read;
751a62a9e19SDr. David Alan Gilbert 	uint32_t	max_write;
752a62a9e19SDr. David Alan Gilbert 	uint32_t	dev_major;		/* chardev major */
753a62a9e19SDr. David Alan Gilbert 	uint32_t	dev_minor;		/* chardev minor */
754a62a9e19SDr. David Alan Gilbert 	uint32_t	spare[10];
755a62a9e19SDr. David Alan Gilbert };
756a62a9e19SDr. David Alan Gilbert 
757a62a9e19SDr. David Alan Gilbert struct fuse_interrupt_in {
758a62a9e19SDr. David Alan Gilbert 	uint64_t	unique;
759a62a9e19SDr. David Alan Gilbert };
760a62a9e19SDr. David Alan Gilbert 
761a62a9e19SDr. David Alan Gilbert struct fuse_bmap_in {
762a62a9e19SDr. David Alan Gilbert 	uint64_t	block;
763a62a9e19SDr. David Alan Gilbert 	uint32_t	blocksize;
764a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
765a62a9e19SDr. David Alan Gilbert };
766a62a9e19SDr. David Alan Gilbert 
767a62a9e19SDr. David Alan Gilbert struct fuse_bmap_out {
768a62a9e19SDr. David Alan Gilbert 	uint64_t	block;
769a62a9e19SDr. David Alan Gilbert };
770a62a9e19SDr. David Alan Gilbert 
771a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_in {
772a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
773a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
774a62a9e19SDr. David Alan Gilbert 	uint32_t	cmd;
775a62a9e19SDr. David Alan Gilbert 	uint64_t	arg;
776a62a9e19SDr. David Alan Gilbert 	uint32_t	in_size;
777a62a9e19SDr. David Alan Gilbert 	uint32_t	out_size;
778a62a9e19SDr. David Alan Gilbert };
779a62a9e19SDr. David Alan Gilbert 
780a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_iovec {
781a62a9e19SDr. David Alan Gilbert 	uint64_t	base;
782a62a9e19SDr. David Alan Gilbert 	uint64_t	len;
783a62a9e19SDr. David Alan Gilbert };
784a62a9e19SDr. David Alan Gilbert 
785a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_out {
786a62a9e19SDr. David Alan Gilbert 	int32_t		result;
787a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
788a62a9e19SDr. David Alan Gilbert 	uint32_t	in_iovs;
789a62a9e19SDr. David Alan Gilbert 	uint32_t	out_iovs;
790a62a9e19SDr. David Alan Gilbert };
791a62a9e19SDr. David Alan Gilbert 
792a62a9e19SDr. David Alan Gilbert struct fuse_poll_in {
793a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
794a62a9e19SDr. David Alan Gilbert 	uint64_t	kh;
795a62a9e19SDr. David Alan Gilbert 	uint32_t	flags;
796a62a9e19SDr. David Alan Gilbert 	uint32_t	events;
797a62a9e19SDr. David Alan Gilbert };
798a62a9e19SDr. David Alan Gilbert 
799a62a9e19SDr. David Alan Gilbert struct fuse_poll_out {
800a62a9e19SDr. David Alan Gilbert 	uint32_t	revents;
801a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
802a62a9e19SDr. David Alan Gilbert };
803a62a9e19SDr. David Alan Gilbert 
804a62a9e19SDr. David Alan Gilbert struct fuse_notify_poll_wakeup_out {
805a62a9e19SDr. David Alan Gilbert 	uint64_t	kh;
806a62a9e19SDr. David Alan Gilbert };
807a62a9e19SDr. David Alan Gilbert 
808a62a9e19SDr. David Alan Gilbert struct fuse_fallocate_in {
809a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
810a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
811a62a9e19SDr. David Alan Gilbert 	uint64_t	length;
812a62a9e19SDr. David Alan Gilbert 	uint32_t	mode;
813a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
814a62a9e19SDr. David Alan Gilbert };
815a62a9e19SDr. David Alan Gilbert 
816a62a9e19SDr. David Alan Gilbert struct fuse_in_header {
817a62a9e19SDr. David Alan Gilbert 	uint32_t	len;
818a62a9e19SDr. David Alan Gilbert 	uint32_t	opcode;
819a62a9e19SDr. David Alan Gilbert 	uint64_t	unique;
820a62a9e19SDr. David Alan Gilbert 	uint64_t	nodeid;
821a62a9e19SDr. David Alan Gilbert 	uint32_t	uid;
822a62a9e19SDr. David Alan Gilbert 	uint32_t	gid;
823a62a9e19SDr. David Alan Gilbert 	uint32_t	pid;
824a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
825a62a9e19SDr. David Alan Gilbert };
826a62a9e19SDr. David Alan Gilbert 
827a62a9e19SDr. David Alan Gilbert struct fuse_out_header {
828a62a9e19SDr. David Alan Gilbert 	uint32_t	len;
829a62a9e19SDr. David Alan Gilbert 	int32_t		error;
830a62a9e19SDr. David Alan Gilbert 	uint64_t	unique;
831a62a9e19SDr. David Alan Gilbert };
832a62a9e19SDr. David Alan Gilbert 
833a62a9e19SDr. David Alan Gilbert struct fuse_dirent {
834a62a9e19SDr. David Alan Gilbert 	uint64_t	ino;
835a62a9e19SDr. David Alan Gilbert 	uint64_t	off;
836a62a9e19SDr. David Alan Gilbert 	uint32_t	namelen;
837a62a9e19SDr. David Alan Gilbert 	uint32_t	type;
838a62a9e19SDr. David Alan Gilbert 	char name[];
839a62a9e19SDr. David Alan Gilbert };
840a62a9e19SDr. David Alan Gilbert 
841a62a9e19SDr. David Alan Gilbert #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
842a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENT_ALIGN(x) \
843a62a9e19SDr. David Alan Gilbert 	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
844a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENT_SIZE(d) \
845a62a9e19SDr. David Alan Gilbert 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
846a62a9e19SDr. David Alan Gilbert 
847a62a9e19SDr. David Alan Gilbert struct fuse_direntplus {
848a62a9e19SDr. David Alan Gilbert 	struct fuse_entry_out entry_out;
849a62a9e19SDr. David Alan Gilbert 	struct fuse_dirent dirent;
850a62a9e19SDr. David Alan Gilbert };
851a62a9e19SDr. David Alan Gilbert 
852a62a9e19SDr. David Alan Gilbert #define FUSE_NAME_OFFSET_DIRENTPLUS \
853a62a9e19SDr. David Alan Gilbert 	offsetof(struct fuse_direntplus, dirent.name)
854a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENTPLUS_SIZE(d) \
855a62a9e19SDr. David Alan Gilbert 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
856a62a9e19SDr. David Alan Gilbert 
857a62a9e19SDr. David Alan Gilbert struct fuse_notify_inval_inode_out {
858a62a9e19SDr. David Alan Gilbert 	uint64_t	ino;
859a62a9e19SDr. David Alan Gilbert 	int64_t		off;
860a62a9e19SDr. David Alan Gilbert 	int64_t		len;
861a62a9e19SDr. David Alan Gilbert };
862a62a9e19SDr. David Alan Gilbert 
863a62a9e19SDr. David Alan Gilbert struct fuse_notify_inval_entry_out {
864a62a9e19SDr. David Alan Gilbert 	uint64_t	parent;
865a62a9e19SDr. David Alan Gilbert 	uint32_t	namelen;
866a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
867a62a9e19SDr. David Alan Gilbert };
868a62a9e19SDr. David Alan Gilbert 
869a62a9e19SDr. David Alan Gilbert struct fuse_notify_delete_out {
870a62a9e19SDr. David Alan Gilbert 	uint64_t	parent;
871a62a9e19SDr. David Alan Gilbert 	uint64_t	child;
872a62a9e19SDr. David Alan Gilbert 	uint32_t	namelen;
873a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
874a62a9e19SDr. David Alan Gilbert };
875a62a9e19SDr. David Alan Gilbert 
876a62a9e19SDr. David Alan Gilbert struct fuse_notify_store_out {
877a62a9e19SDr. David Alan Gilbert 	uint64_t	nodeid;
878a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
879a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
880a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
881a62a9e19SDr. David Alan Gilbert };
882a62a9e19SDr. David Alan Gilbert 
883a62a9e19SDr. David Alan Gilbert struct fuse_notify_retrieve_out {
884a62a9e19SDr. David Alan Gilbert 	uint64_t	notify_unique;
885a62a9e19SDr. David Alan Gilbert 	uint64_t	nodeid;
886a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
887a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
888a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
889a62a9e19SDr. David Alan Gilbert };
890a62a9e19SDr. David Alan Gilbert 
891a62a9e19SDr. David Alan Gilbert /* Matches the size of fuse_write_in */
892a62a9e19SDr. David Alan Gilbert struct fuse_notify_retrieve_in {
893a62a9e19SDr. David Alan Gilbert 	uint64_t	dummy1;
894a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
895a62a9e19SDr. David Alan Gilbert 	uint32_t	size;
896a62a9e19SDr. David Alan Gilbert 	uint32_t	dummy2;
897a62a9e19SDr. David Alan Gilbert 	uint64_t	dummy3;
898a62a9e19SDr. David Alan Gilbert 	uint64_t	dummy4;
899a62a9e19SDr. David Alan Gilbert };
900a62a9e19SDr. David Alan Gilbert 
901a62a9e19SDr. David Alan Gilbert /* Device ioctls: */
902a62a9e19SDr. David Alan Gilbert #define FUSE_DEV_IOC_CLONE	_IOR(229, 0, uint32_t)
903a62a9e19SDr. David Alan Gilbert 
904a62a9e19SDr. David Alan Gilbert struct fuse_lseek_in {
905a62a9e19SDr. David Alan Gilbert 	uint64_t	fh;
906a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
907a62a9e19SDr. David Alan Gilbert 	uint32_t	whence;
908a62a9e19SDr. David Alan Gilbert 	uint32_t	padding;
909a62a9e19SDr. David Alan Gilbert };
910a62a9e19SDr. David Alan Gilbert 
911a62a9e19SDr. David Alan Gilbert struct fuse_lseek_out {
912a62a9e19SDr. David Alan Gilbert 	uint64_t	offset;
913a62a9e19SDr. David Alan Gilbert };
914a62a9e19SDr. David Alan Gilbert 
915a62a9e19SDr. David Alan Gilbert struct fuse_copy_file_range_in {
916a62a9e19SDr. David Alan Gilbert 	uint64_t	fh_in;
917a62a9e19SDr. David Alan Gilbert 	uint64_t	off_in;
918a62a9e19SDr. David Alan Gilbert 	uint64_t	nodeid_out;
919a62a9e19SDr. David Alan Gilbert 	uint64_t	fh_out;
920a62a9e19SDr. David Alan Gilbert 	uint64_t	off_out;
921a62a9e19SDr. David Alan Gilbert 	uint64_t	len;
922a62a9e19SDr. David Alan Gilbert 	uint64_t	flags;
923a62a9e19SDr. David Alan Gilbert };
924a62a9e19SDr. David Alan Gilbert 
92553ba2eeeSMatthew Rosato #define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
92653ba2eeeSMatthew Rosato #define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
92753ba2eeeSMatthew Rosato struct fuse_setupmapping_in {
92853ba2eeeSMatthew Rosato 	/* An already open handle */
92953ba2eeeSMatthew Rosato 	uint64_t	fh;
93053ba2eeeSMatthew Rosato 	/* Offset into the file to start the mapping */
93153ba2eeeSMatthew Rosato 	uint64_t	foffset;
93253ba2eeeSMatthew Rosato 	/* Length of mapping required */
93353ba2eeeSMatthew Rosato 	uint64_t	len;
93453ba2eeeSMatthew Rosato 	/* Flags, FUSE_SETUPMAPPING_FLAG_* */
93553ba2eeeSMatthew Rosato 	uint64_t	flags;
93653ba2eeeSMatthew Rosato 	/* Offset in Memory Window */
93753ba2eeeSMatthew Rosato 	uint64_t	moffset;
93853ba2eeeSMatthew Rosato };
93953ba2eeeSMatthew Rosato 
94053ba2eeeSMatthew Rosato struct fuse_removemapping_in {
94153ba2eeeSMatthew Rosato 	/* number of fuse_removemapping_one follows */
94253ba2eeeSMatthew Rosato 	uint32_t        count;
94353ba2eeeSMatthew Rosato };
94453ba2eeeSMatthew Rosato 
94553ba2eeeSMatthew Rosato struct fuse_removemapping_one {
94653ba2eeeSMatthew Rosato 	/* Offset into the dax window start the unmapping */
94753ba2eeeSMatthew Rosato 	uint64_t        moffset;
94853ba2eeeSMatthew Rosato 	/* Length of mapping required */
94953ba2eeeSMatthew Rosato 	uint64_t	len;
95053ba2eeeSMatthew Rosato };
95153ba2eeeSMatthew Rosato 
95253ba2eeeSMatthew Rosato #define FUSE_REMOVEMAPPING_MAX_ENTRY   \
95353ba2eeeSMatthew Rosato 		(PAGE_SIZE / sizeof(struct fuse_removemapping_one))
95453ba2eeeSMatthew Rosato 
955a62a9e19SDr. David Alan Gilbert #endif /* _LINUX_FUSE_H */
956