fuse: require /dev/fuse reads to have enough buffer capacity
[linux-block.git] / include / uapi / linux / fuse.h
CommitLineData
e2be04c7 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
d8a5ba45 2/*
7e98d530 3 This file defines the kernel interface of FUSE
1f55ed06 4 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
d8a5ba45
MS
5
6 This program can be distributed under the terms of the GNU GPL.
7 See the file COPYING.
7e98d530
MS
8
9 This -- and only this -- header file may also be distributed under
10 the terms of the BSD Licence as follows:
11
12 Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions
16 are met:
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
27 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 SUCH DAMAGE.
d8a5ba45
MS
34*/
35
c79e322f
MS
36/*
37 * This file defines the kernel interface of FUSE
38 *
39 * Protocol changelog:
40 *
41 * 7.9:
42 * - new fuse_getattr_in input argument of GETATTR
a9ff4f87 43 * - add lk_flags in fuse_lk_in
f3332114 44 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
0e9663ee 45 * - add blksize field to fuse_attr
a6643094 46 * - add file flags field to fuse_read_in and fuse_write_in
a7c1b990
TH
47 *
48 * 7.10
49 * - add nonseekable open flag
1f55ed06
MS
50 *
51 * 7.11
52 * - add IOCTL message
53 * - add unsolicited notification support
54 * - add POLL message and NOTIFY_POLL notification
e0a43ddc
MS
55 *
56 * 7.12
57 * - add umask flag to input argument of open, mknod and mkdir
3b463ae0
JM
58 * - add notification messages for invalidation of inodes and
59 * directory entries
7a6d3c8b
CH
60 *
61 * 7.13
62 * - make max number of background requests and congestion threshold
63 * tunables
dd3bb14f
MS
64 *
65 * 7.14
66 * - add splice support to fuse device
a1d75f25
MS
67 *
68 * 7.15
69 * - add store notify
2d45ba38 70 * - add retrieve notify
02c048b9
MS
71 *
72 * 7.16
73 * - add BATCH_FORGET request
1baa26b2
MS
74 * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
75 * fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
76 * - add FUSE_IOCTL_32BIT flag
37fb3a30
MS
77 *
78 * 7.17
79 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
b18da0c5
MS
80 *
81 * 7.18
82 * - add FUSE_IOCTL_DIR flag
451d0f59 83 * - add FUSE_NOTIFY_DELETE
05ba1f08
AP
84 *
85 * 7.19
86 * - add FUSE_FALLOCATE
72d0d248
BF
87 *
88 * 7.20
89 * - add FUSE_AUTO_INVAL_DATA
23c153e5
MS
90 *
91 * 7.21
92 * - add FUSE_READDIRPLUS
0415d291 93 * - send the requested events in POLL request
60b9df7a
MS
94 *
95 * 7.22
96 * - add FUSE_ASYNC_DIO
4d99ff8f
PE
97 *
98 * 7.23
99 * - add FUSE_WRITEBACK_CACHE
e27c9d38
MS
100 * - add time_gran to fuse_init_out
101 * - add reserved space to fuse_init_out
ab9e13f7
MP
102 * - add FATTR_CTIME
103 * - add ctime and ctimensec to fuse_setattr_in
1560c974 104 * - add FUSE_RENAME2 request
d7afaec0 105 * - add FUSE_NO_OPEN_SUPPORT flag
0b5da8db
R
106 *
107 * 7.24
108 * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
5c672ab3
MS
109 *
110 * 7.25
111 * - add FUSE_PARALLEL_DIROPS
5e940c1d
MS
112 *
113 * 7.26
114 * - add FUSE_HANDLE_KILLPRIV
60bcc88a 115 * - add FUSE_POSIX_ACL
3b7008b2
SL
116 *
117 * 7.27
118 * - add FUSE_ABORT_ERROR
88bc7d50
NV
119 *
120 * 7.28
121 * - add FUSE_COPY_FILE_RANGE
6433b899 122 * - add FOPEN_CACHE_DIR
5da784cc 123 * - add FUSE_MAX_PAGES, add max_pages to init_out
5571f1e6 124 * - add FUSE_CACHE_SYMLINKS
d9a9ea94
CA
125 *
126 * 7.29
127 * - add FUSE_NO_OPENDIR_SUPPORT flag
ad2ba64d
KS
128 *
129 * 7.30
130 * - add FUSE_EXPLICIT_INVAL_DATA
c79e322f 131 */
d8a5ba45 132
29d434b3
TH
133#ifndef _LINUX_FUSE_H
134#define _LINUX_FUSE_H
135
4c82456e 136#ifdef __KERNEL__
1f55ed06 137#include <linux/types.h>
7e98d530
MS
138#else
139#include <stdint.h>
7e98d530 140#endif
d8a5ba45 141
37d217f0
MS
142/*
143 * Version negotiation:
144 *
145 * Both the kernel and userspace send the version they support in the
146 * INIT request and reply respectively.
147 *
148 * If the major versions match then both shall use the smallest
149 * of the two minor versions for communication.
150 *
151 * If the kernel supports a larger major version, then userspace shall
152 * reply with the major version it supports, ignore the rest of the
153 * INIT message and expect a new INIT message from the kernel with a
154 * matching major version.
155 *
156 * If the library supports a larger major version, then it shall fall
157 * back to the major protocol version sent by the kernel for
158 * communication and reply with that major version (and an arbitrary
159 * supported minor version).
160 */
161
d8a5ba45 162/** Version number of this interface */
9e6268db 163#define FUSE_KERNEL_VERSION 7
d8a5ba45
MS
164
165/** Minor version number of this interface */
ad2ba64d 166#define FUSE_KERNEL_MINOR_VERSION 30
d8a5ba45
MS
167
168/** The node ID of the root inode */
169#define FUSE_ROOT_ID 1
170
06663267
MS
171/* Make sure all structures are padded to 64bit boundary, so 32bit
172 userspace works under 64bit kernels */
173
d8a5ba45 174struct fuse_attr {
4c82456e
MS
175 uint64_t ino;
176 uint64_t size;
177 uint64_t blocks;
178 uint64_t atime;
179 uint64_t mtime;
180 uint64_t ctime;
181 uint32_t atimensec;
182 uint32_t mtimensec;
183 uint32_t ctimensec;
184 uint32_t mode;
185 uint32_t nlink;
186 uint32_t uid;
187 uint32_t gid;
188 uint32_t rdev;
189 uint32_t blksize;
190 uint32_t padding;
d8a5ba45
MS
191};
192
e5e5558e 193struct fuse_kstatfs {
4c82456e
MS
194 uint64_t blocks;
195 uint64_t bfree;
196 uint64_t bavail;
197 uint64_t files;
198 uint64_t ffree;
199 uint32_t bsize;
200 uint32_t namelen;
201 uint32_t frsize;
202 uint32_t padding;
203 uint32_t spare[6];
e5e5558e
MS
204};
205
71421259 206struct fuse_file_lock {
4c82456e
MS
207 uint64_t start;
208 uint64_t end;
209 uint32_t type;
210 uint32_t pid; /* tgid */
71421259
MS
211};
212
9cd68455
MS
213/**
214 * Bitmasks for fuse_setattr_in.valid
215 */
9e6268db
MS
216#define FATTR_MODE (1 << 0)
217#define FATTR_UID (1 << 1)
218#define FATTR_GID (1 << 2)
219#define FATTR_SIZE (1 << 3)
220#define FATTR_ATIME (1 << 4)
221#define FATTR_MTIME (1 << 5)
befc649c 222#define FATTR_FH (1 << 6)
17637cba
MS
223#define FATTR_ATIME_NOW (1 << 7)
224#define FATTR_MTIME_NOW (1 << 8)
f3332114 225#define FATTR_LOCKOWNER (1 << 9)
ab9e13f7 226#define FATTR_CTIME (1 << 10)
9e6268db 227
45323fb7
MS
228/**
229 * Flags returned by the OPEN request
230 *
231 * FOPEN_DIRECT_IO: bypass page cache for this open file
232 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
a7c1b990 233 * FOPEN_NONSEEKABLE: the file is not seekable
6433b899 234 * FOPEN_CACHE_DIR: allow caching this directory
45323fb7
MS
235 */
236#define FOPEN_DIRECT_IO (1 << 0)
237#define FOPEN_KEEP_CACHE (1 << 1)
a7c1b990 238#define FOPEN_NONSEEKABLE (1 << 2)
6433b899 239#define FOPEN_CACHE_DIR (1 << 3)
45323fb7 240
9cd68455
MS
241/**
242 * INIT request/reply flags
33670fa2 243 *
f3840dc0 244 * FUSE_ASYNC_READ: asynchronous read requests
37fb3a30 245 * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
f3840dc0
MS
246 * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
247 * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
33670fa2 248 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
f3840dc0 249 * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
e0a43ddc 250 * FUSE_DONT_MASK: don't apply umask to file mode on create operations
69fe05c9
MS
251 * FUSE_SPLICE_WRITE: kernel supports splice write on the device
252 * FUSE_SPLICE_MOVE: kernel supports splice move on the device
253 * FUSE_SPLICE_READ: kernel supports splice read on the device
37fb3a30 254 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
69fe05c9 255 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
72d0d248 256 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
634734b6
EW
257 * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
258 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
60b9df7a 259 * FUSE_ASYNC_DIO: asynchronous direct I/O submission
4d99ff8f 260 * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
d7afaec0 261 * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
5c672ab3 262 * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
5e940c1d 263 * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
60bcc88a 264 * FUSE_POSIX_ACL: filesystem supports posix acls
3b7008b2 265 * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
5da784cc 266 * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
5571f1e6 267 * FUSE_CACHE_SYMLINKS: cache READLINK responses
d9a9ea94 268 * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
ad2ba64d 269 * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
9cd68455
MS
270 */
271#define FUSE_ASYNC_READ (1 << 0)
71421259 272#define FUSE_POSIX_LOCKS (1 << 1)
c79e322f 273#define FUSE_FILE_OPS (1 << 2)
6ff958ed 274#define FUSE_ATOMIC_O_TRUNC (1 << 3)
33670fa2 275#define FUSE_EXPORT_SUPPORT (1 << 4)
78bb6cb9 276#define FUSE_BIG_WRITES (1 << 5)
e0a43ddc 277#define FUSE_DONT_MASK (1 << 6)
69fe05c9
MS
278#define FUSE_SPLICE_WRITE (1 << 7)
279#define FUSE_SPLICE_MOVE (1 << 8)
280#define FUSE_SPLICE_READ (1 << 9)
37fb3a30 281#define FUSE_FLOCK_LOCKS (1 << 10)
69fe05c9 282#define FUSE_HAS_IOCTL_DIR (1 << 11)
72d0d248 283#define FUSE_AUTO_INVAL_DATA (1 << 12)
0b05b183 284#define FUSE_DO_READDIRPLUS (1 << 13)
634734b6 285#define FUSE_READDIRPLUS_AUTO (1 << 14)
60b9df7a 286#define FUSE_ASYNC_DIO (1 << 15)
4d99ff8f 287#define FUSE_WRITEBACK_CACHE (1 << 16)
d7afaec0 288#define FUSE_NO_OPEN_SUPPORT (1 << 17)
5c672ab3 289#define FUSE_PARALLEL_DIROPS (1 << 18)
5e940c1d 290#define FUSE_HANDLE_KILLPRIV (1 << 19)
60bcc88a 291#define FUSE_POSIX_ACL (1 << 20)
3b7008b2 292#define FUSE_ABORT_ERROR (1 << 21)
5da784cc 293#define FUSE_MAX_PAGES (1 << 22)
5571f1e6 294#define FUSE_CACHE_SYMLINKS (1 << 23)
d9a9ea94 295#define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
ad2ba64d 296#define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
9cd68455 297
151060ac
TH
298/**
299 * CUSE INIT request/reply flags
300 *
301 * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
302 */
303#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
304
e9168c18
MS
305/**
306 * Release flags
307 */
308#define FUSE_RELEASE_FLUSH (1 << 0)
37fb3a30 309#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
e9168c18 310
c79e322f
MS
311/**
312 * Getattr flags
313 */
314#define FUSE_GETATTR_FH (1 << 0)
315
a9ff4f87
MS
316/**
317 * Lock flags
318 */
319#define FUSE_LK_FLOCK (1 << 0)
320
b25e82e5
MS
321/**
322 * WRITE flags
323 *
324 * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
f3332114 325 * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
b25e82e5
MS
326 */
327#define FUSE_WRITE_CACHE (1 << 0)
f3332114
MS
328#define FUSE_WRITE_LOCKOWNER (1 << 1)
329
330/**
331 * Read flags
332 */
333#define FUSE_READ_LOCKOWNER (1 << 1)
b25e82e5 334
59efec7b
TH
335/**
336 * Ioctl flags
337 *
338 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
339 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
340 * FUSE_IOCTL_RETRY: retry with new iovecs
1baa26b2 341 * FUSE_IOCTL_32BIT: 32bit ioctl
b18da0c5 342 * FUSE_IOCTL_DIR: is a directory
59efec7b
TH
343 *
344 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
345 */
346#define FUSE_IOCTL_COMPAT (1 << 0)
347#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
348#define FUSE_IOCTL_RETRY (1 << 2)
1baa26b2 349#define FUSE_IOCTL_32BIT (1 << 3)
b18da0c5 350#define FUSE_IOCTL_DIR (1 << 4)
59efec7b
TH
351
352#define FUSE_IOCTL_MAX_IOV 256
353
95668a69
TH
354/**
355 * Poll flags
356 *
357 * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
358 */
359#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
360
334f485d 361enum fuse_opcode {
88bc7d50
NV
362 FUSE_LOOKUP = 1,
363 FUSE_FORGET = 2, /* no reply */
364 FUSE_GETATTR = 3,
365 FUSE_SETATTR = 4,
366 FUSE_READLINK = 5,
367 FUSE_SYMLINK = 6,
368 FUSE_MKNOD = 8,
369 FUSE_MKDIR = 9,
370 FUSE_UNLINK = 10,
371 FUSE_RMDIR = 11,
372 FUSE_RENAME = 12,
373 FUSE_LINK = 13,
374 FUSE_OPEN = 14,
375 FUSE_READ = 15,
376 FUSE_WRITE = 16,
377 FUSE_STATFS = 17,
378 FUSE_RELEASE = 18,
379 FUSE_FSYNC = 20,
380 FUSE_SETXATTR = 21,
381 FUSE_GETXATTR = 22,
382 FUSE_LISTXATTR = 23,
383 FUSE_REMOVEXATTR = 24,
384 FUSE_FLUSH = 25,
385 FUSE_INIT = 26,
386 FUSE_OPENDIR = 27,
387 FUSE_READDIR = 28,
388 FUSE_RELEASEDIR = 29,
389 FUSE_FSYNCDIR = 30,
390 FUSE_GETLK = 31,
391 FUSE_SETLK = 32,
392 FUSE_SETLKW = 33,
393 FUSE_ACCESS = 34,
394 FUSE_CREATE = 35,
395 FUSE_INTERRUPT = 36,
396 FUSE_BMAP = 37,
397 FUSE_DESTROY = 38,
398 FUSE_IOCTL = 39,
399 FUSE_POLL = 40,
400 FUSE_NOTIFY_REPLY = 41,
401 FUSE_BATCH_FORGET = 42,
402 FUSE_FALLOCATE = 43,
403 FUSE_READDIRPLUS = 44,
404 FUSE_RENAME2 = 45,
405 FUSE_LSEEK = 46,
406 FUSE_COPY_FILE_RANGE = 47,
151060ac
TH
407
408 /* CUSE specific operations */
88bc7d50 409 CUSE_INIT = 4096,
334f485d
MS
410};
411
8599396b 412enum fuse_notify_code {
95668a69 413 FUSE_NOTIFY_POLL = 1,
3b463ae0
JM
414 FUSE_NOTIFY_INVAL_INODE = 2,
415 FUSE_NOTIFY_INVAL_ENTRY = 3,
a1d75f25 416 FUSE_NOTIFY_STORE = 4,
2d45ba38 417 FUSE_NOTIFY_RETRIEVE = 5,
451d0f59 418 FUSE_NOTIFY_DELETE = 6,
8599396b
TH
419 FUSE_NOTIFY_CODE_MAX,
420};
421
1d3d752b
MS
422/* The read buffer is required to be at least 8k, but may be much larger */
423#define FUSE_MIN_READ_BUFFER 8192
e5e5558e 424
0e9663ee
MS
425#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
426
e5e5558e 427struct fuse_entry_out {
4c82456e
MS
428 uint64_t nodeid; /* Inode ID */
429 uint64_t generation; /* Inode generation: nodeid:gen must
430 be unique for the fs's lifetime */
431 uint64_t entry_valid; /* Cache timeout for the name */
432 uint64_t attr_valid; /* Cache timeout for the attributes */
433 uint32_t entry_valid_nsec;
434 uint32_t attr_valid_nsec;
e5e5558e
MS
435 struct fuse_attr attr;
436};
437
438struct fuse_forget_in {
4c82456e 439 uint64_t nlookup;
e5e5558e
MS
440};
441
02c048b9 442struct fuse_forget_one {
4c82456e
MS
443 uint64_t nodeid;
444 uint64_t nlookup;
02c048b9
MS
445};
446
447struct fuse_batch_forget_in {
4c82456e
MS
448 uint32_t count;
449 uint32_t dummy;
02c048b9
MS
450};
451
c79e322f 452struct fuse_getattr_in {
4c82456e
MS
453 uint32_t getattr_flags;
454 uint32_t dummy;
455 uint64_t fh;
c79e322f
MS
456};
457
0e9663ee
MS
458#define FUSE_COMPAT_ATTR_OUT_SIZE 96
459
e5e5558e 460struct fuse_attr_out {
4c82456e
MS
461 uint64_t attr_valid; /* Cache timeout for the attributes */
462 uint32_t attr_valid_nsec;
463 uint32_t dummy;
e5e5558e
MS
464 struct fuse_attr attr;
465};
466
e0a43ddc
MS
467#define FUSE_COMPAT_MKNOD_IN_SIZE 8
468
9e6268db 469struct fuse_mknod_in {
4c82456e
MS
470 uint32_t mode;
471 uint32_t rdev;
472 uint32_t umask;
473 uint32_t padding;
9e6268db
MS
474};
475
476struct fuse_mkdir_in {
4c82456e
MS
477 uint32_t mode;
478 uint32_t umask;
9e6268db
MS
479};
480
481struct fuse_rename_in {
4c82456e 482 uint64_t newdir;
9e6268db
MS
483};
484
1560c974
MS
485struct fuse_rename2_in {
486 uint64_t newdir;
487 uint32_t flags;
488 uint32_t padding;
489};
490
9e6268db 491struct fuse_link_in {
4c82456e 492 uint64_t oldnodeid;
9e6268db
MS
493};
494
495struct fuse_setattr_in {
4c82456e
MS
496 uint32_t valid;
497 uint32_t padding;
498 uint64_t fh;
499 uint64_t size;
500 uint64_t lock_owner;
501 uint64_t atime;
502 uint64_t mtime;
ab9e13f7 503 uint64_t ctime;
4c82456e
MS
504 uint32_t atimensec;
505 uint32_t mtimensec;
ab9e13f7 506 uint32_t ctimensec;
4c82456e
MS
507 uint32_t mode;
508 uint32_t unused4;
509 uint32_t uid;
510 uint32_t gid;
511 uint32_t unused5;
9e6268db
MS
512};
513
b6aeaded 514struct fuse_open_in {
4c82456e
MS
515 uint32_t flags;
516 uint32_t unused;
e0a43ddc
MS
517};
518
519struct fuse_create_in {
4c82456e
MS
520 uint32_t flags;
521 uint32_t mode;
522 uint32_t umask;
523 uint32_t padding;
b6aeaded
MS
524};
525
526struct fuse_open_out {
4c82456e
MS
527 uint64_t fh;
528 uint32_t open_flags;
529 uint32_t padding;
b6aeaded
MS
530};
531
532struct fuse_release_in {
4c82456e
MS
533 uint64_t fh;
534 uint32_t flags;
535 uint32_t release_flags;
536 uint64_t lock_owner;
b6aeaded
MS
537};
538
539struct fuse_flush_in {
4c82456e
MS
540 uint64_t fh;
541 uint32_t unused;
542 uint32_t padding;
543 uint64_t lock_owner;
b6aeaded
MS
544};
545
546struct fuse_read_in {
4c82456e
MS
547 uint64_t fh;
548 uint64_t offset;
549 uint32_t size;
550 uint32_t read_flags;
551 uint64_t lock_owner;
552 uint32_t flags;
553 uint32_t padding;
b6aeaded
MS
554};
555
f3332114
MS
556#define FUSE_COMPAT_WRITE_IN_SIZE 24
557
b6aeaded 558struct fuse_write_in {
4c82456e
MS
559 uint64_t fh;
560 uint64_t offset;
561 uint32_t size;
562 uint32_t write_flags;
563 uint64_t lock_owner;
564 uint32_t flags;
565 uint32_t padding;
b6aeaded
MS
566};
567
568struct fuse_write_out {
4c82456e
MS
569 uint32_t size;
570 uint32_t padding;
b6aeaded
MS
571};
572
de5f1202
MS
573#define FUSE_COMPAT_STATFS_SIZE 48
574
e5e5558e
MS
575struct fuse_statfs_out {
576 struct fuse_kstatfs st;
577};
578
b6aeaded 579struct fuse_fsync_in {
4c82456e
MS
580 uint64_t fh;
581 uint32_t fsync_flags;
582 uint32_t padding;
b6aeaded
MS
583};
584
92a8780e 585struct fuse_setxattr_in {
4c82456e
MS
586 uint32_t size;
587 uint32_t flags;
92a8780e
MS
588};
589
590struct fuse_getxattr_in {
4c82456e
MS
591 uint32_t size;
592 uint32_t padding;
92a8780e
MS
593};
594
595struct fuse_getxattr_out {
4c82456e
MS
596 uint32_t size;
597 uint32_t padding;
92a8780e
MS
598};
599
71421259 600struct fuse_lk_in {
4c82456e
MS
601 uint64_t fh;
602 uint64_t owner;
71421259 603 struct fuse_file_lock lk;
4c82456e
MS
604 uint32_t lk_flags;
605 uint32_t padding;
71421259
MS
606};
607
608struct fuse_lk_out {
609 struct fuse_file_lock lk;
610};
611
31d40d74 612struct fuse_access_in {
4c82456e
MS
613 uint32_t mask;
614 uint32_t padding;
31d40d74
MS
615};
616
3ec870d5 617struct fuse_init_in {
4c82456e
MS
618 uint32_t major;
619 uint32_t minor;
620 uint32_t max_readahead;
621 uint32_t flags;
334f485d
MS
622};
623
e27c9d38
MS
624#define FUSE_COMPAT_INIT_OUT_SIZE 8
625#define FUSE_COMPAT_22_INIT_OUT_SIZE 24
626
3ec870d5 627struct fuse_init_out {
4c82456e
MS
628 uint32_t major;
629 uint32_t minor;
630 uint32_t max_readahead;
631 uint32_t flags;
632 uint16_t max_background;
633 uint16_t congestion_threshold;
634 uint32_t max_write;
e27c9d38 635 uint32_t time_gran;
5da784cc
CS
636 uint16_t max_pages;
637 uint16_t padding;
638 uint32_t unused[8];
3ec870d5
MS
639};
640
151060ac
TH
641#define CUSE_INIT_INFO_MAX 4096
642
643struct cuse_init_in {
4c82456e
MS
644 uint32_t major;
645 uint32_t minor;
646 uint32_t unused;
647 uint32_t flags;
151060ac
TH
648};
649
650struct cuse_init_out {
4c82456e
MS
651 uint32_t major;
652 uint32_t minor;
653 uint32_t unused;
654 uint32_t flags;
655 uint32_t max_read;
656 uint32_t max_write;
657 uint32_t dev_major; /* chardev major */
658 uint32_t dev_minor; /* chardev minor */
659 uint32_t spare[10];
151060ac
TH
660};
661
a4d27e75 662struct fuse_interrupt_in {
4c82456e 663 uint64_t unique;
a4d27e75
MS
664};
665
b2d2272f 666struct fuse_bmap_in {
4c82456e
MS
667 uint64_t block;
668 uint32_t blocksize;
669 uint32_t padding;
b2d2272f
MS
670};
671
672struct fuse_bmap_out {
4c82456e 673 uint64_t block;
b2d2272f
MS
674};
675
59efec7b 676struct fuse_ioctl_in {
4c82456e
MS
677 uint64_t fh;
678 uint32_t flags;
679 uint32_t cmd;
680 uint64_t arg;
681 uint32_t in_size;
682 uint32_t out_size;
59efec7b
TH
683};
684
1baa26b2 685struct fuse_ioctl_iovec {
4c82456e
MS
686 uint64_t base;
687 uint64_t len;
1baa26b2
MS
688};
689
59efec7b 690struct fuse_ioctl_out {
4c82456e
MS
691 int32_t result;
692 uint32_t flags;
693 uint32_t in_iovs;
694 uint32_t out_iovs;
59efec7b
TH
695};
696
95668a69 697struct fuse_poll_in {
4c82456e
MS
698 uint64_t fh;
699 uint64_t kh;
700 uint32_t flags;
701 uint32_t events;
95668a69
TH
702};
703
704struct fuse_poll_out {
4c82456e
MS
705 uint32_t revents;
706 uint32_t padding;
95668a69
TH
707};
708
709struct fuse_notify_poll_wakeup_out {
4c82456e 710 uint64_t kh;
95668a69
TH
711};
712
05ba1f08 713struct fuse_fallocate_in {
4c82456e
MS
714 uint64_t fh;
715 uint64_t offset;
716 uint64_t length;
717 uint32_t mode;
718 uint32_t padding;
05ba1f08
AP
719};
720
334f485d 721struct fuse_in_header {
4c82456e
MS
722 uint32_t len;
723 uint32_t opcode;
724 uint64_t unique;
725 uint64_t nodeid;
726 uint32_t uid;
727 uint32_t gid;
728 uint32_t pid;
729 uint32_t padding;
334f485d
MS
730};
731
732struct fuse_out_header {
4c82456e
MS
733 uint32_t len;
734 int32_t error;
735 uint64_t unique;
334f485d
MS
736};
737
e5e5558e 738struct fuse_dirent {
4c82456e
MS
739 uint64_t ino;
740 uint64_t off;
741 uint32_t namelen;
742 uint32_t type;
c628ee67 743 char name[];
e5e5558e
MS
744};
745
21f3da95 746#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
4c82456e
MS
747#define FUSE_DIRENT_ALIGN(x) \
748 (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
e5e5558e
MS
749#define FUSE_DIRENT_SIZE(d) \
750 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
29d434b3 751
0b05b183
AA
752struct fuse_direntplus {
753 struct fuse_entry_out entry_out;
754 struct fuse_dirent dirent;
755};
756
757#define FUSE_NAME_OFFSET_DIRENTPLUS \
758 offsetof(struct fuse_direntplus, dirent.name)
759#define FUSE_DIRENTPLUS_SIZE(d) \
760 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
761
3b463ae0 762struct fuse_notify_inval_inode_out {
4c82456e
MS
763 uint64_t ino;
764 int64_t off;
765 int64_t len;
3b463ae0
JM
766};
767
768struct fuse_notify_inval_entry_out {
4c82456e
MS
769 uint64_t parent;
770 uint32_t namelen;
771 uint32_t padding;
3b463ae0
JM
772};
773
451d0f59 774struct fuse_notify_delete_out {
4c82456e
MS
775 uint64_t parent;
776 uint64_t child;
777 uint32_t namelen;
778 uint32_t padding;
451d0f59
JM
779};
780
a1d75f25 781struct fuse_notify_store_out {
4c82456e
MS
782 uint64_t nodeid;
783 uint64_t offset;
784 uint32_t size;
785 uint32_t padding;
a1d75f25
MS
786};
787
2d45ba38 788struct fuse_notify_retrieve_out {
4c82456e
MS
789 uint64_t notify_unique;
790 uint64_t nodeid;
791 uint64_t offset;
792 uint32_t size;
793 uint32_t padding;
2d45ba38
MS
794};
795
796/* Matches the size of fuse_write_in */
797struct fuse_notify_retrieve_in {
4c82456e
MS
798 uint64_t dummy1;
799 uint64_t offset;
800 uint32_t size;
801 uint32_t dummy2;
802 uint64_t dummy3;
803 uint64_t dummy4;
2d45ba38
MS
804};
805
00c570f4
MS
806/* Device ioctls: */
807#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
808
0b5da8db
R
809struct fuse_lseek_in {
810 uint64_t fh;
811 uint64_t offset;
812 uint32_t whence;
813 uint32_t padding;
814};
815
816struct fuse_lseek_out {
817 uint64_t offset;
818};
819
88bc7d50
NV
820struct fuse_copy_file_range_in {
821 uint64_t fh_in;
822 uint64_t off_in;
823 uint64_t nodeid_out;
824 uint64_t fh_out;
825 uint64_t off_out;
826 uint64_t len;
827 uint64_t flags;
828};
829
29d434b3 830#endif /* _LINUX_FUSE_H */