]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/uapi/linux/fuse.h
s390: vfio-ap: implement VFIO_DEVICE_GET_INFO ioctl
[mirror_ubuntu-bionic-kernel.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
c79e322f 116 */
d8a5ba45 117
29d434b3
TH
118#ifndef _LINUX_FUSE_H
119#define _LINUX_FUSE_H
120
4c82456e 121#ifdef __KERNEL__
1f55ed06 122#include <linux/types.h>
7e98d530
MS
123#else
124#include <stdint.h>
7e98d530 125#endif
d8a5ba45 126
37d217f0
MS
127/*
128 * Version negotiation:
129 *
130 * Both the kernel and userspace send the version they support in the
131 * INIT request and reply respectively.
132 *
133 * If the major versions match then both shall use the smallest
134 * of the two minor versions for communication.
135 *
136 * If the kernel supports a larger major version, then userspace shall
137 * reply with the major version it supports, ignore the rest of the
138 * INIT message and expect a new INIT message from the kernel with a
139 * matching major version.
140 *
141 * If the library supports a larger major version, then it shall fall
142 * back to the major protocol version sent by the kernel for
143 * communication and reply with that major version (and an arbitrary
144 * supported minor version).
145 */
146
d8a5ba45 147/** Version number of this interface */
9e6268db 148#define FUSE_KERNEL_VERSION 7
d8a5ba45
MS
149
150/** Minor version number of this interface */
5e940c1d 151#define FUSE_KERNEL_MINOR_VERSION 26
d8a5ba45
MS
152
153/** The node ID of the root inode */
154#define FUSE_ROOT_ID 1
155
06663267
MS
156/* Make sure all structures are padded to 64bit boundary, so 32bit
157 userspace works under 64bit kernels */
158
d8a5ba45 159struct fuse_attr {
4c82456e
MS
160 uint64_t ino;
161 uint64_t size;
162 uint64_t blocks;
163 uint64_t atime;
164 uint64_t mtime;
165 uint64_t ctime;
166 uint32_t atimensec;
167 uint32_t mtimensec;
168 uint32_t ctimensec;
169 uint32_t mode;
170 uint32_t nlink;
171 uint32_t uid;
172 uint32_t gid;
173 uint32_t rdev;
174 uint32_t blksize;
175 uint32_t padding;
d8a5ba45
MS
176};
177
e5e5558e 178struct fuse_kstatfs {
4c82456e
MS
179 uint64_t blocks;
180 uint64_t bfree;
181 uint64_t bavail;
182 uint64_t files;
183 uint64_t ffree;
184 uint32_t bsize;
185 uint32_t namelen;
186 uint32_t frsize;
187 uint32_t padding;
188 uint32_t spare[6];
e5e5558e
MS
189};
190
71421259 191struct fuse_file_lock {
4c82456e
MS
192 uint64_t start;
193 uint64_t end;
194 uint32_t type;
195 uint32_t pid; /* tgid */
71421259
MS
196};
197
9cd68455
MS
198/**
199 * Bitmasks for fuse_setattr_in.valid
200 */
9e6268db
MS
201#define FATTR_MODE (1 << 0)
202#define FATTR_UID (1 << 1)
203#define FATTR_GID (1 << 2)
204#define FATTR_SIZE (1 << 3)
205#define FATTR_ATIME (1 << 4)
206#define FATTR_MTIME (1 << 5)
befc649c 207#define FATTR_FH (1 << 6)
17637cba
MS
208#define FATTR_ATIME_NOW (1 << 7)
209#define FATTR_MTIME_NOW (1 << 8)
f3332114 210#define FATTR_LOCKOWNER (1 << 9)
ab9e13f7 211#define FATTR_CTIME (1 << 10)
9e6268db 212
45323fb7
MS
213/**
214 * Flags returned by the OPEN request
215 *
216 * FOPEN_DIRECT_IO: bypass page cache for this open file
217 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
a7c1b990 218 * FOPEN_NONSEEKABLE: the file is not seekable
45323fb7
MS
219 */
220#define FOPEN_DIRECT_IO (1 << 0)
221#define FOPEN_KEEP_CACHE (1 << 1)
a7c1b990 222#define FOPEN_NONSEEKABLE (1 << 2)
45323fb7 223
9cd68455
MS
224/**
225 * INIT request/reply flags
33670fa2 226 *
f3840dc0 227 * FUSE_ASYNC_READ: asynchronous read requests
37fb3a30 228 * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
f3840dc0
MS
229 * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
230 * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
33670fa2 231 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
f3840dc0 232 * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
e0a43ddc 233 * FUSE_DONT_MASK: don't apply umask to file mode on create operations
69fe05c9
MS
234 * FUSE_SPLICE_WRITE: kernel supports splice write on the device
235 * FUSE_SPLICE_MOVE: kernel supports splice move on the device
236 * FUSE_SPLICE_READ: kernel supports splice read on the device
37fb3a30 237 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
69fe05c9 238 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
72d0d248 239 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
634734b6
EW
240 * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
241 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
60b9df7a 242 * FUSE_ASYNC_DIO: asynchronous direct I/O submission
4d99ff8f 243 * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
d7afaec0 244 * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
5c672ab3 245 * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
5e940c1d 246 * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
60bcc88a 247 * FUSE_POSIX_ACL: filesystem supports posix acls
9cd68455
MS
248 */
249#define FUSE_ASYNC_READ (1 << 0)
71421259 250#define FUSE_POSIX_LOCKS (1 << 1)
c79e322f 251#define FUSE_FILE_OPS (1 << 2)
6ff958ed 252#define FUSE_ATOMIC_O_TRUNC (1 << 3)
33670fa2 253#define FUSE_EXPORT_SUPPORT (1 << 4)
78bb6cb9 254#define FUSE_BIG_WRITES (1 << 5)
e0a43ddc 255#define FUSE_DONT_MASK (1 << 6)
69fe05c9
MS
256#define FUSE_SPLICE_WRITE (1 << 7)
257#define FUSE_SPLICE_MOVE (1 << 8)
258#define FUSE_SPLICE_READ (1 << 9)
37fb3a30 259#define FUSE_FLOCK_LOCKS (1 << 10)
69fe05c9 260#define FUSE_HAS_IOCTL_DIR (1 << 11)
72d0d248 261#define FUSE_AUTO_INVAL_DATA (1 << 12)
0b05b183 262#define FUSE_DO_READDIRPLUS (1 << 13)
634734b6 263#define FUSE_READDIRPLUS_AUTO (1 << 14)
60b9df7a 264#define FUSE_ASYNC_DIO (1 << 15)
4d99ff8f 265#define FUSE_WRITEBACK_CACHE (1 << 16)
d7afaec0 266#define FUSE_NO_OPEN_SUPPORT (1 << 17)
5c672ab3 267#define FUSE_PARALLEL_DIROPS (1 << 18)
5e940c1d 268#define FUSE_HANDLE_KILLPRIV (1 << 19)
60bcc88a 269#define FUSE_POSIX_ACL (1 << 20)
9cd68455 270
151060ac
TH
271/**
272 * CUSE INIT request/reply flags
273 *
274 * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
275 */
276#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
277
e9168c18
MS
278/**
279 * Release flags
280 */
281#define FUSE_RELEASE_FLUSH (1 << 0)
37fb3a30 282#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
e9168c18 283
c79e322f
MS
284/**
285 * Getattr flags
286 */
287#define FUSE_GETATTR_FH (1 << 0)
288
a9ff4f87
MS
289/**
290 * Lock flags
291 */
292#define FUSE_LK_FLOCK (1 << 0)
293
b25e82e5
MS
294/**
295 * WRITE flags
296 *
297 * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
f3332114 298 * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
b25e82e5
MS
299 */
300#define FUSE_WRITE_CACHE (1 << 0)
f3332114
MS
301#define FUSE_WRITE_LOCKOWNER (1 << 1)
302
303/**
304 * Read flags
305 */
306#define FUSE_READ_LOCKOWNER (1 << 1)
b25e82e5 307
59efec7b
TH
308/**
309 * Ioctl flags
310 *
311 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
312 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
313 * FUSE_IOCTL_RETRY: retry with new iovecs
1baa26b2 314 * FUSE_IOCTL_32BIT: 32bit ioctl
b18da0c5 315 * FUSE_IOCTL_DIR: is a directory
59efec7b
TH
316 *
317 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
318 */
319#define FUSE_IOCTL_COMPAT (1 << 0)
320#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
321#define FUSE_IOCTL_RETRY (1 << 2)
1baa26b2 322#define FUSE_IOCTL_32BIT (1 << 3)
b18da0c5 323#define FUSE_IOCTL_DIR (1 << 4)
59efec7b
TH
324
325#define FUSE_IOCTL_MAX_IOV 256
326
95668a69
TH
327/**
328 * Poll flags
329 *
330 * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
331 */
332#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
333
334f485d 334enum fuse_opcode {
e5e5558e
MS
335 FUSE_LOOKUP = 1,
336 FUSE_FORGET = 2, /* no reply */
337 FUSE_GETATTR = 3,
9e6268db 338 FUSE_SETATTR = 4,
e5e5558e 339 FUSE_READLINK = 5,
9e6268db 340 FUSE_SYMLINK = 6,
9e6268db
MS
341 FUSE_MKNOD = 8,
342 FUSE_MKDIR = 9,
343 FUSE_UNLINK = 10,
344 FUSE_RMDIR = 11,
345 FUSE_RENAME = 12,
346 FUSE_LINK = 13,
b6aeaded
MS
347 FUSE_OPEN = 14,
348 FUSE_READ = 15,
349 FUSE_WRITE = 16,
e5e5558e 350 FUSE_STATFS = 17,
b6aeaded
MS
351 FUSE_RELEASE = 18,
352 FUSE_FSYNC = 20,
92a8780e
MS
353 FUSE_SETXATTR = 21,
354 FUSE_GETXATTR = 22,
355 FUSE_LISTXATTR = 23,
356 FUSE_REMOVEXATTR = 24,
b6aeaded 357 FUSE_FLUSH = 25,
04730fef
MS
358 FUSE_INIT = 26,
359 FUSE_OPENDIR = 27,
360 FUSE_READDIR = 28,
82547981 361 FUSE_RELEASEDIR = 29,
31d40d74 362 FUSE_FSYNCDIR = 30,
71421259
MS
363 FUSE_GETLK = 31,
364 FUSE_SETLK = 32,
365 FUSE_SETLKW = 33,
fd72faac 366 FUSE_ACCESS = 34,
a4d27e75
MS
367 FUSE_CREATE = 35,
368 FUSE_INTERRUPT = 36,
b2d2272f 369 FUSE_BMAP = 37,
0ec7ca41 370 FUSE_DESTROY = 38,
59efec7b 371 FUSE_IOCTL = 39,
95668a69 372 FUSE_POLL = 40,
2d45ba38 373 FUSE_NOTIFY_REPLY = 41,
02c048b9 374 FUSE_BATCH_FORGET = 42,
05ba1f08 375 FUSE_FALLOCATE = 43,
0b05b183 376 FUSE_READDIRPLUS = 44,
1560c974 377 FUSE_RENAME2 = 45,
0b5da8db 378 FUSE_LSEEK = 46,
151060ac
TH
379
380 /* CUSE specific operations */
381 CUSE_INIT = 4096,
334f485d
MS
382};
383
8599396b 384enum fuse_notify_code {
95668a69 385 FUSE_NOTIFY_POLL = 1,
3b463ae0
JM
386 FUSE_NOTIFY_INVAL_INODE = 2,
387 FUSE_NOTIFY_INVAL_ENTRY = 3,
a1d75f25 388 FUSE_NOTIFY_STORE = 4,
2d45ba38 389 FUSE_NOTIFY_RETRIEVE = 5,
451d0f59 390 FUSE_NOTIFY_DELETE = 6,
8599396b
TH
391 FUSE_NOTIFY_CODE_MAX,
392};
393
1d3d752b
MS
394/* The read buffer is required to be at least 8k, but may be much larger */
395#define FUSE_MIN_READ_BUFFER 8192
e5e5558e 396
0e9663ee
MS
397#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
398
e5e5558e 399struct fuse_entry_out {
4c82456e
MS
400 uint64_t nodeid; /* Inode ID */
401 uint64_t generation; /* Inode generation: nodeid:gen must
402 be unique for the fs's lifetime */
403 uint64_t entry_valid; /* Cache timeout for the name */
404 uint64_t attr_valid; /* Cache timeout for the attributes */
405 uint32_t entry_valid_nsec;
406 uint32_t attr_valid_nsec;
e5e5558e
MS
407 struct fuse_attr attr;
408};
409
410struct fuse_forget_in {
4c82456e 411 uint64_t nlookup;
e5e5558e
MS
412};
413
02c048b9 414struct fuse_forget_one {
4c82456e
MS
415 uint64_t nodeid;
416 uint64_t nlookup;
02c048b9
MS
417};
418
419struct fuse_batch_forget_in {
4c82456e
MS
420 uint32_t count;
421 uint32_t dummy;
02c048b9
MS
422};
423
c79e322f 424struct fuse_getattr_in {
4c82456e
MS
425 uint32_t getattr_flags;
426 uint32_t dummy;
427 uint64_t fh;
c79e322f
MS
428};
429
0e9663ee
MS
430#define FUSE_COMPAT_ATTR_OUT_SIZE 96
431
e5e5558e 432struct fuse_attr_out {
4c82456e
MS
433 uint64_t attr_valid; /* Cache timeout for the attributes */
434 uint32_t attr_valid_nsec;
435 uint32_t dummy;
e5e5558e
MS
436 struct fuse_attr attr;
437};
438
e0a43ddc
MS
439#define FUSE_COMPAT_MKNOD_IN_SIZE 8
440
9e6268db 441struct fuse_mknod_in {
4c82456e
MS
442 uint32_t mode;
443 uint32_t rdev;
444 uint32_t umask;
445 uint32_t padding;
9e6268db
MS
446};
447
448struct fuse_mkdir_in {
4c82456e
MS
449 uint32_t mode;
450 uint32_t umask;
9e6268db
MS
451};
452
453struct fuse_rename_in {
4c82456e 454 uint64_t newdir;
9e6268db
MS
455};
456
1560c974
MS
457struct fuse_rename2_in {
458 uint64_t newdir;
459 uint32_t flags;
460 uint32_t padding;
461};
462
9e6268db 463struct fuse_link_in {
4c82456e 464 uint64_t oldnodeid;
9e6268db
MS
465};
466
467struct fuse_setattr_in {
4c82456e
MS
468 uint32_t valid;
469 uint32_t padding;
470 uint64_t fh;
471 uint64_t size;
472 uint64_t lock_owner;
473 uint64_t atime;
474 uint64_t mtime;
ab9e13f7 475 uint64_t ctime;
4c82456e
MS
476 uint32_t atimensec;
477 uint32_t mtimensec;
ab9e13f7 478 uint32_t ctimensec;
4c82456e
MS
479 uint32_t mode;
480 uint32_t unused4;
481 uint32_t uid;
482 uint32_t gid;
483 uint32_t unused5;
9e6268db
MS
484};
485
b6aeaded 486struct fuse_open_in {
4c82456e
MS
487 uint32_t flags;
488 uint32_t unused;
e0a43ddc
MS
489};
490
491struct fuse_create_in {
4c82456e
MS
492 uint32_t flags;
493 uint32_t mode;
494 uint32_t umask;
495 uint32_t padding;
b6aeaded
MS
496};
497
498struct fuse_open_out {
4c82456e
MS
499 uint64_t fh;
500 uint32_t open_flags;
501 uint32_t padding;
b6aeaded
MS
502};
503
504struct fuse_release_in {
4c82456e
MS
505 uint64_t fh;
506 uint32_t flags;
507 uint32_t release_flags;
508 uint64_t lock_owner;
b6aeaded
MS
509};
510
511struct fuse_flush_in {
4c82456e
MS
512 uint64_t fh;
513 uint32_t unused;
514 uint32_t padding;
515 uint64_t lock_owner;
b6aeaded
MS
516};
517
518struct fuse_read_in {
4c82456e
MS
519 uint64_t fh;
520 uint64_t offset;
521 uint32_t size;
522 uint32_t read_flags;
523 uint64_t lock_owner;
524 uint32_t flags;
525 uint32_t padding;
b6aeaded
MS
526};
527
f3332114
MS
528#define FUSE_COMPAT_WRITE_IN_SIZE 24
529
b6aeaded 530struct fuse_write_in {
4c82456e
MS
531 uint64_t fh;
532 uint64_t offset;
533 uint32_t size;
534 uint32_t write_flags;
535 uint64_t lock_owner;
536 uint32_t flags;
537 uint32_t padding;
b6aeaded
MS
538};
539
540struct fuse_write_out {
4c82456e
MS
541 uint32_t size;
542 uint32_t padding;
b6aeaded
MS
543};
544
de5f1202
MS
545#define FUSE_COMPAT_STATFS_SIZE 48
546
e5e5558e
MS
547struct fuse_statfs_out {
548 struct fuse_kstatfs st;
549};
550
b6aeaded 551struct fuse_fsync_in {
4c82456e
MS
552 uint64_t fh;
553 uint32_t fsync_flags;
554 uint32_t padding;
b6aeaded
MS
555};
556
92a8780e 557struct fuse_setxattr_in {
4c82456e
MS
558 uint32_t size;
559 uint32_t flags;
92a8780e
MS
560};
561
562struct fuse_getxattr_in {
4c82456e
MS
563 uint32_t size;
564 uint32_t padding;
92a8780e
MS
565};
566
567struct fuse_getxattr_out {
4c82456e
MS
568 uint32_t size;
569 uint32_t padding;
92a8780e
MS
570};
571
71421259 572struct fuse_lk_in {
4c82456e
MS
573 uint64_t fh;
574 uint64_t owner;
71421259 575 struct fuse_file_lock lk;
4c82456e
MS
576 uint32_t lk_flags;
577 uint32_t padding;
71421259
MS
578};
579
580struct fuse_lk_out {
581 struct fuse_file_lock lk;
582};
583
31d40d74 584struct fuse_access_in {
4c82456e
MS
585 uint32_t mask;
586 uint32_t padding;
31d40d74
MS
587};
588
3ec870d5 589struct fuse_init_in {
4c82456e
MS
590 uint32_t major;
591 uint32_t minor;
592 uint32_t max_readahead;
593 uint32_t flags;
334f485d
MS
594};
595
e27c9d38
MS
596#define FUSE_COMPAT_INIT_OUT_SIZE 8
597#define FUSE_COMPAT_22_INIT_OUT_SIZE 24
598
3ec870d5 599struct fuse_init_out {
4c82456e
MS
600 uint32_t major;
601 uint32_t minor;
602 uint32_t max_readahead;
603 uint32_t flags;
604 uint16_t max_background;
605 uint16_t congestion_threshold;
606 uint32_t max_write;
e27c9d38
MS
607 uint32_t time_gran;
608 uint32_t unused[9];
3ec870d5
MS
609};
610
151060ac
TH
611#define CUSE_INIT_INFO_MAX 4096
612
613struct cuse_init_in {
4c82456e
MS
614 uint32_t major;
615 uint32_t minor;
616 uint32_t unused;
617 uint32_t flags;
151060ac
TH
618};
619
620struct cuse_init_out {
4c82456e
MS
621 uint32_t major;
622 uint32_t minor;
623 uint32_t unused;
624 uint32_t flags;
625 uint32_t max_read;
626 uint32_t max_write;
627 uint32_t dev_major; /* chardev major */
628 uint32_t dev_minor; /* chardev minor */
629 uint32_t spare[10];
151060ac
TH
630};
631
a4d27e75 632struct fuse_interrupt_in {
4c82456e 633 uint64_t unique;
a4d27e75
MS
634};
635
b2d2272f 636struct fuse_bmap_in {
4c82456e
MS
637 uint64_t block;
638 uint32_t blocksize;
639 uint32_t padding;
b2d2272f
MS
640};
641
642struct fuse_bmap_out {
4c82456e 643 uint64_t block;
b2d2272f
MS
644};
645
59efec7b 646struct fuse_ioctl_in {
4c82456e
MS
647 uint64_t fh;
648 uint32_t flags;
649 uint32_t cmd;
650 uint64_t arg;
651 uint32_t in_size;
652 uint32_t out_size;
59efec7b
TH
653};
654
1baa26b2 655struct fuse_ioctl_iovec {
4c82456e
MS
656 uint64_t base;
657 uint64_t len;
1baa26b2
MS
658};
659
59efec7b 660struct fuse_ioctl_out {
4c82456e
MS
661 int32_t result;
662 uint32_t flags;
663 uint32_t in_iovs;
664 uint32_t out_iovs;
59efec7b
TH
665};
666
95668a69 667struct fuse_poll_in {
4c82456e
MS
668 uint64_t fh;
669 uint64_t kh;
670 uint32_t flags;
671 uint32_t events;
95668a69
TH
672};
673
674struct fuse_poll_out {
4c82456e
MS
675 uint32_t revents;
676 uint32_t padding;
95668a69
TH
677};
678
679struct fuse_notify_poll_wakeup_out {
4c82456e 680 uint64_t kh;
95668a69
TH
681};
682
05ba1f08 683struct fuse_fallocate_in {
4c82456e
MS
684 uint64_t fh;
685 uint64_t offset;
686 uint64_t length;
687 uint32_t mode;
688 uint32_t padding;
05ba1f08
AP
689};
690
334f485d 691struct fuse_in_header {
4c82456e
MS
692 uint32_t len;
693 uint32_t opcode;
694 uint64_t unique;
695 uint64_t nodeid;
696 uint32_t uid;
697 uint32_t gid;
698 uint32_t pid;
699 uint32_t padding;
334f485d
MS
700};
701
702struct fuse_out_header {
4c82456e
MS
703 uint32_t len;
704 int32_t error;
705 uint64_t unique;
334f485d
MS
706};
707
e5e5558e 708struct fuse_dirent {
4c82456e
MS
709 uint64_t ino;
710 uint64_t off;
711 uint32_t namelen;
712 uint32_t type;
c628ee67 713 char name[];
e5e5558e
MS
714};
715
21f3da95 716#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
4c82456e
MS
717#define FUSE_DIRENT_ALIGN(x) \
718 (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
e5e5558e
MS
719#define FUSE_DIRENT_SIZE(d) \
720 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
29d434b3 721
0b05b183
AA
722struct fuse_direntplus {
723 struct fuse_entry_out entry_out;
724 struct fuse_dirent dirent;
725};
726
727#define FUSE_NAME_OFFSET_DIRENTPLUS \
728 offsetof(struct fuse_direntplus, dirent.name)
729#define FUSE_DIRENTPLUS_SIZE(d) \
730 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
731
3b463ae0 732struct fuse_notify_inval_inode_out {
4c82456e
MS
733 uint64_t ino;
734 int64_t off;
735 int64_t len;
3b463ae0
JM
736};
737
738struct fuse_notify_inval_entry_out {
4c82456e
MS
739 uint64_t parent;
740 uint32_t namelen;
741 uint32_t padding;
3b463ae0
JM
742};
743
451d0f59 744struct fuse_notify_delete_out {
4c82456e
MS
745 uint64_t parent;
746 uint64_t child;
747 uint32_t namelen;
748 uint32_t padding;
451d0f59
JM
749};
750
a1d75f25 751struct fuse_notify_store_out {
4c82456e
MS
752 uint64_t nodeid;
753 uint64_t offset;
754 uint32_t size;
755 uint32_t padding;
a1d75f25
MS
756};
757
2d45ba38 758struct fuse_notify_retrieve_out {
4c82456e
MS
759 uint64_t notify_unique;
760 uint64_t nodeid;
761 uint64_t offset;
762 uint32_t size;
763 uint32_t padding;
2d45ba38
MS
764};
765
766/* Matches the size of fuse_write_in */
767struct fuse_notify_retrieve_in {
4c82456e
MS
768 uint64_t dummy1;
769 uint64_t offset;
770 uint32_t size;
771 uint32_t dummy2;
772 uint64_t dummy3;
773 uint64_t dummy4;
2d45ba38
MS
774};
775
00c570f4
MS
776/* Device ioctls: */
777#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
778
0b5da8db
R
779struct fuse_lseek_in {
780 uint64_t fh;
781 uint64_t offset;
782 uint32_t whence;
783 uint32_t padding;
784};
785
786struct fuse_lseek_out {
787 uint64_t offset;
788};
789
29d434b3 790#endif /* _LINUX_FUSE_H */