Commit | Line | Data |
---|---|---|
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 | |
68065b84 | 57 | * - add umask flag to input argument of create, 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 | 174 | struct 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 | 193 | struct 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 | 206 | struct 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 |
bbd84f33 | 235 | * FOPEN_STREAM: the file is stream-like (no file position at all) |
45323fb7 MS |
236 | */ |
237 | #define FOPEN_DIRECT_IO (1 << 0) | |
238 | #define FOPEN_KEEP_CACHE (1 << 1) | |
a7c1b990 | 239 | #define FOPEN_NONSEEKABLE (1 << 2) |
6433b899 | 240 | #define FOPEN_CACHE_DIR (1 << 3) |
bbd84f33 | 241 | #define FOPEN_STREAM (1 << 4) |
45323fb7 | 242 | |
9cd68455 MS |
243 | /** |
244 | * INIT request/reply flags | |
33670fa2 | 245 | * |
f3840dc0 | 246 | * FUSE_ASYNC_READ: asynchronous read requests |
37fb3a30 | 247 | * FUSE_POSIX_LOCKS: remote locking for POSIX file locks |
f3840dc0 MS |
248 | * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) |
249 | * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem | |
33670fa2 | 250 | * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." |
f3840dc0 | 251 | * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB |
e0a43ddc | 252 | * FUSE_DONT_MASK: don't apply umask to file mode on create operations |
69fe05c9 MS |
253 | * FUSE_SPLICE_WRITE: kernel supports splice write on the device |
254 | * FUSE_SPLICE_MOVE: kernel supports splice move on the device | |
255 | * FUSE_SPLICE_READ: kernel supports splice read on the device | |
37fb3a30 | 256 | * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks |
69fe05c9 | 257 | * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories |
72d0d248 | 258 | * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages |
634734b6 EW |
259 | * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) |
260 | * FUSE_READDIRPLUS_AUTO: adaptive readdirplus | |
60b9df7a | 261 | * FUSE_ASYNC_DIO: asynchronous direct I/O submission |
4d99ff8f | 262 | * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes |
d7afaec0 | 263 | * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens |
5c672ab3 | 264 | * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir |
5e940c1d | 265 | * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc |
60bcc88a | 266 | * FUSE_POSIX_ACL: filesystem supports posix acls |
3b7008b2 | 267 | * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED |
5da784cc | 268 | * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages |
5571f1e6 | 269 | * FUSE_CACHE_SYMLINKS: cache READLINK responses |
d9a9ea94 | 270 | * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir |
ad2ba64d | 271 | * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request |
9cd68455 MS |
272 | */ |
273 | #define FUSE_ASYNC_READ (1 << 0) | |
71421259 | 274 | #define FUSE_POSIX_LOCKS (1 << 1) |
c79e322f | 275 | #define FUSE_FILE_OPS (1 << 2) |
6ff958ed | 276 | #define FUSE_ATOMIC_O_TRUNC (1 << 3) |
33670fa2 | 277 | #define FUSE_EXPORT_SUPPORT (1 << 4) |
78bb6cb9 | 278 | #define FUSE_BIG_WRITES (1 << 5) |
e0a43ddc | 279 | #define FUSE_DONT_MASK (1 << 6) |
69fe05c9 MS |
280 | #define FUSE_SPLICE_WRITE (1 << 7) |
281 | #define FUSE_SPLICE_MOVE (1 << 8) | |
282 | #define FUSE_SPLICE_READ (1 << 9) | |
37fb3a30 | 283 | #define FUSE_FLOCK_LOCKS (1 << 10) |
69fe05c9 | 284 | #define FUSE_HAS_IOCTL_DIR (1 << 11) |
72d0d248 | 285 | #define FUSE_AUTO_INVAL_DATA (1 << 12) |
0b05b183 | 286 | #define FUSE_DO_READDIRPLUS (1 << 13) |
634734b6 | 287 | #define FUSE_READDIRPLUS_AUTO (1 << 14) |
60b9df7a | 288 | #define FUSE_ASYNC_DIO (1 << 15) |
4d99ff8f | 289 | #define FUSE_WRITEBACK_CACHE (1 << 16) |
d7afaec0 | 290 | #define FUSE_NO_OPEN_SUPPORT (1 << 17) |
5c672ab3 | 291 | #define FUSE_PARALLEL_DIROPS (1 << 18) |
5e940c1d | 292 | #define FUSE_HANDLE_KILLPRIV (1 << 19) |
60bcc88a | 293 | #define FUSE_POSIX_ACL (1 << 20) |
3b7008b2 | 294 | #define FUSE_ABORT_ERROR (1 << 21) |
5da784cc | 295 | #define FUSE_MAX_PAGES (1 << 22) |
5571f1e6 | 296 | #define FUSE_CACHE_SYMLINKS (1 << 23) |
d9a9ea94 | 297 | #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) |
ad2ba64d | 298 | #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) |
9cd68455 | 299 | |
151060ac TH |
300 | /** |
301 | * CUSE INIT request/reply flags | |
302 | * | |
303 | * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl | |
304 | */ | |
305 | #define CUSE_UNRESTRICTED_IOCTL (1 << 0) | |
306 | ||
e9168c18 MS |
307 | /** |
308 | * Release flags | |
309 | */ | |
310 | #define FUSE_RELEASE_FLUSH (1 << 0) | |
37fb3a30 | 311 | #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) |
e9168c18 | 312 | |
c79e322f MS |
313 | /** |
314 | * Getattr flags | |
315 | */ | |
316 | #define FUSE_GETATTR_FH (1 << 0) | |
317 | ||
a9ff4f87 MS |
318 | /** |
319 | * Lock flags | |
320 | */ | |
321 | #define FUSE_LK_FLOCK (1 << 0) | |
322 | ||
b25e82e5 MS |
323 | /** |
324 | * WRITE flags | |
325 | * | |
326 | * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed | |
f3332114 | 327 | * FUSE_WRITE_LOCKOWNER: lock_owner field is valid |
b25e82e5 MS |
328 | */ |
329 | #define FUSE_WRITE_CACHE (1 << 0) | |
f3332114 MS |
330 | #define FUSE_WRITE_LOCKOWNER (1 << 1) |
331 | ||
332 | /** | |
333 | * Read flags | |
334 | */ | |
335 | #define FUSE_READ_LOCKOWNER (1 << 1) | |
b25e82e5 | 336 | |
59efec7b TH |
337 | /** |
338 | * Ioctl flags | |
339 | * | |
340 | * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine | |
341 | * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed | |
342 | * FUSE_IOCTL_RETRY: retry with new iovecs | |
1baa26b2 | 343 | * FUSE_IOCTL_32BIT: 32bit ioctl |
b18da0c5 | 344 | * FUSE_IOCTL_DIR: is a directory |
59efec7b TH |
345 | * |
346 | * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs | |
347 | */ | |
348 | #define FUSE_IOCTL_COMPAT (1 << 0) | |
349 | #define FUSE_IOCTL_UNRESTRICTED (1 << 1) | |
350 | #define FUSE_IOCTL_RETRY (1 << 2) | |
1baa26b2 | 351 | #define FUSE_IOCTL_32BIT (1 << 3) |
b18da0c5 | 352 | #define FUSE_IOCTL_DIR (1 << 4) |
59efec7b TH |
353 | |
354 | #define FUSE_IOCTL_MAX_IOV 256 | |
355 | ||
95668a69 TH |
356 | /** |
357 | * Poll flags | |
358 | * | |
359 | * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify | |
360 | */ | |
361 | #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) | |
362 | ||
154603fe AS |
363 | /** |
364 | * Fsync flags | |
365 | * | |
366 | * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata | |
367 | */ | |
368 | #define FUSE_FSYNC_FDATASYNC (1 << 0) | |
369 | ||
334f485d | 370 | enum fuse_opcode { |
88bc7d50 NV |
371 | FUSE_LOOKUP = 1, |
372 | FUSE_FORGET = 2, /* no reply */ | |
373 | FUSE_GETATTR = 3, | |
374 | FUSE_SETATTR = 4, | |
375 | FUSE_READLINK = 5, | |
376 | FUSE_SYMLINK = 6, | |
377 | FUSE_MKNOD = 8, | |
378 | FUSE_MKDIR = 9, | |
379 | FUSE_UNLINK = 10, | |
380 | FUSE_RMDIR = 11, | |
381 | FUSE_RENAME = 12, | |
382 | FUSE_LINK = 13, | |
383 | FUSE_OPEN = 14, | |
384 | FUSE_READ = 15, | |
385 | FUSE_WRITE = 16, | |
386 | FUSE_STATFS = 17, | |
387 | FUSE_RELEASE = 18, | |
388 | FUSE_FSYNC = 20, | |
389 | FUSE_SETXATTR = 21, | |
390 | FUSE_GETXATTR = 22, | |
391 | FUSE_LISTXATTR = 23, | |
392 | FUSE_REMOVEXATTR = 24, | |
393 | FUSE_FLUSH = 25, | |
394 | FUSE_INIT = 26, | |
395 | FUSE_OPENDIR = 27, | |
396 | FUSE_READDIR = 28, | |
397 | FUSE_RELEASEDIR = 29, | |
398 | FUSE_FSYNCDIR = 30, | |
399 | FUSE_GETLK = 31, | |
400 | FUSE_SETLK = 32, | |
401 | FUSE_SETLKW = 33, | |
402 | FUSE_ACCESS = 34, | |
403 | FUSE_CREATE = 35, | |
404 | FUSE_INTERRUPT = 36, | |
405 | FUSE_BMAP = 37, | |
406 | FUSE_DESTROY = 38, | |
407 | FUSE_IOCTL = 39, | |
408 | FUSE_POLL = 40, | |
409 | FUSE_NOTIFY_REPLY = 41, | |
410 | FUSE_BATCH_FORGET = 42, | |
411 | FUSE_FALLOCATE = 43, | |
412 | FUSE_READDIRPLUS = 44, | |
413 | FUSE_RENAME2 = 45, | |
414 | FUSE_LSEEK = 46, | |
415 | FUSE_COPY_FILE_RANGE = 47, | |
151060ac TH |
416 | |
417 | /* CUSE specific operations */ | |
88bc7d50 | 418 | CUSE_INIT = 4096, |
334f485d MS |
419 | }; |
420 | ||
8599396b | 421 | enum fuse_notify_code { |
95668a69 | 422 | FUSE_NOTIFY_POLL = 1, |
3b463ae0 JM |
423 | FUSE_NOTIFY_INVAL_INODE = 2, |
424 | FUSE_NOTIFY_INVAL_ENTRY = 3, | |
a1d75f25 | 425 | FUSE_NOTIFY_STORE = 4, |
2d45ba38 | 426 | FUSE_NOTIFY_RETRIEVE = 5, |
451d0f59 | 427 | FUSE_NOTIFY_DELETE = 6, |
8599396b TH |
428 | FUSE_NOTIFY_CODE_MAX, |
429 | }; | |
430 | ||
1d3d752b MS |
431 | /* The read buffer is required to be at least 8k, but may be much larger */ |
432 | #define FUSE_MIN_READ_BUFFER 8192 | |
e5e5558e | 433 | |
0e9663ee MS |
434 | #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 |
435 | ||
e5e5558e | 436 | struct fuse_entry_out { |
4c82456e MS |
437 | uint64_t nodeid; /* Inode ID */ |
438 | uint64_t generation; /* Inode generation: nodeid:gen must | |
439 | be unique for the fs's lifetime */ | |
440 | uint64_t entry_valid; /* Cache timeout for the name */ | |
441 | uint64_t attr_valid; /* Cache timeout for the attributes */ | |
442 | uint32_t entry_valid_nsec; | |
443 | uint32_t attr_valid_nsec; | |
e5e5558e MS |
444 | struct fuse_attr attr; |
445 | }; | |
446 | ||
447 | struct fuse_forget_in { | |
4c82456e | 448 | uint64_t nlookup; |
e5e5558e MS |
449 | }; |
450 | ||
02c048b9 | 451 | struct fuse_forget_one { |
4c82456e MS |
452 | uint64_t nodeid; |
453 | uint64_t nlookup; | |
02c048b9 MS |
454 | }; |
455 | ||
456 | struct fuse_batch_forget_in { | |
4c82456e MS |
457 | uint32_t count; |
458 | uint32_t dummy; | |
02c048b9 MS |
459 | }; |
460 | ||
c79e322f | 461 | struct fuse_getattr_in { |
4c82456e MS |
462 | uint32_t getattr_flags; |
463 | uint32_t dummy; | |
464 | uint64_t fh; | |
c79e322f MS |
465 | }; |
466 | ||
0e9663ee MS |
467 | #define FUSE_COMPAT_ATTR_OUT_SIZE 96 |
468 | ||
e5e5558e | 469 | struct fuse_attr_out { |
4c82456e MS |
470 | uint64_t attr_valid; /* Cache timeout for the attributes */ |
471 | uint32_t attr_valid_nsec; | |
472 | uint32_t dummy; | |
e5e5558e MS |
473 | struct fuse_attr attr; |
474 | }; | |
475 | ||
e0a43ddc MS |
476 | #define FUSE_COMPAT_MKNOD_IN_SIZE 8 |
477 | ||
9e6268db | 478 | struct fuse_mknod_in { |
4c82456e MS |
479 | uint32_t mode; |
480 | uint32_t rdev; | |
481 | uint32_t umask; | |
482 | uint32_t padding; | |
9e6268db MS |
483 | }; |
484 | ||
485 | struct fuse_mkdir_in { | |
4c82456e MS |
486 | uint32_t mode; |
487 | uint32_t umask; | |
9e6268db MS |
488 | }; |
489 | ||
490 | struct fuse_rename_in { | |
4c82456e | 491 | uint64_t newdir; |
9e6268db MS |
492 | }; |
493 | ||
1560c974 MS |
494 | struct fuse_rename2_in { |
495 | uint64_t newdir; | |
496 | uint32_t flags; | |
497 | uint32_t padding; | |
498 | }; | |
499 | ||
9e6268db | 500 | struct fuse_link_in { |
4c82456e | 501 | uint64_t oldnodeid; |
9e6268db MS |
502 | }; |
503 | ||
504 | struct fuse_setattr_in { | |
4c82456e MS |
505 | uint32_t valid; |
506 | uint32_t padding; | |
507 | uint64_t fh; | |
508 | uint64_t size; | |
509 | uint64_t lock_owner; | |
510 | uint64_t atime; | |
511 | uint64_t mtime; | |
ab9e13f7 | 512 | uint64_t ctime; |
4c82456e MS |
513 | uint32_t atimensec; |
514 | uint32_t mtimensec; | |
ab9e13f7 | 515 | uint32_t ctimensec; |
4c82456e MS |
516 | uint32_t mode; |
517 | uint32_t unused4; | |
518 | uint32_t uid; | |
519 | uint32_t gid; | |
520 | uint32_t unused5; | |
9e6268db MS |
521 | }; |
522 | ||
b6aeaded | 523 | struct fuse_open_in { |
4c82456e MS |
524 | uint32_t flags; |
525 | uint32_t unused; | |
e0a43ddc MS |
526 | }; |
527 | ||
528 | struct fuse_create_in { | |
4c82456e MS |
529 | uint32_t flags; |
530 | uint32_t mode; | |
531 | uint32_t umask; | |
532 | uint32_t padding; | |
b6aeaded MS |
533 | }; |
534 | ||
535 | struct fuse_open_out { | |
4c82456e MS |
536 | uint64_t fh; |
537 | uint32_t open_flags; | |
538 | uint32_t padding; | |
b6aeaded MS |
539 | }; |
540 | ||
541 | struct fuse_release_in { | |
4c82456e MS |
542 | uint64_t fh; |
543 | uint32_t flags; | |
544 | uint32_t release_flags; | |
545 | uint64_t lock_owner; | |
b6aeaded MS |
546 | }; |
547 | ||
548 | struct fuse_flush_in { | |
4c82456e MS |
549 | uint64_t fh; |
550 | uint32_t unused; | |
551 | uint32_t padding; | |
552 | uint64_t lock_owner; | |
b6aeaded MS |
553 | }; |
554 | ||
555 | struct fuse_read_in { | |
4c82456e MS |
556 | uint64_t fh; |
557 | uint64_t offset; | |
558 | uint32_t size; | |
559 | uint32_t read_flags; | |
560 | uint64_t lock_owner; | |
561 | uint32_t flags; | |
562 | uint32_t padding; | |
b6aeaded MS |
563 | }; |
564 | ||
f3332114 MS |
565 | #define FUSE_COMPAT_WRITE_IN_SIZE 24 |
566 | ||
b6aeaded | 567 | struct fuse_write_in { |
4c82456e MS |
568 | uint64_t fh; |
569 | uint64_t offset; | |
570 | uint32_t size; | |
571 | uint32_t write_flags; | |
572 | uint64_t lock_owner; | |
573 | uint32_t flags; | |
574 | uint32_t padding; | |
b6aeaded MS |
575 | }; |
576 | ||
577 | struct fuse_write_out { | |
4c82456e MS |
578 | uint32_t size; |
579 | uint32_t padding; | |
b6aeaded MS |
580 | }; |
581 | ||
de5f1202 MS |
582 | #define FUSE_COMPAT_STATFS_SIZE 48 |
583 | ||
e5e5558e MS |
584 | struct fuse_statfs_out { |
585 | struct fuse_kstatfs st; | |
586 | }; | |
587 | ||
b6aeaded | 588 | struct fuse_fsync_in { |
4c82456e MS |
589 | uint64_t fh; |
590 | uint32_t fsync_flags; | |
591 | uint32_t padding; | |
b6aeaded MS |
592 | }; |
593 | ||
92a8780e | 594 | struct fuse_setxattr_in { |
4c82456e MS |
595 | uint32_t size; |
596 | uint32_t flags; | |
92a8780e MS |
597 | }; |
598 | ||
599 | struct fuse_getxattr_in { | |
4c82456e MS |
600 | uint32_t size; |
601 | uint32_t padding; | |
92a8780e MS |
602 | }; |
603 | ||
604 | struct fuse_getxattr_out { | |
4c82456e MS |
605 | uint32_t size; |
606 | uint32_t padding; | |
92a8780e MS |
607 | }; |
608 | ||
71421259 | 609 | struct fuse_lk_in { |
4c82456e MS |
610 | uint64_t fh; |
611 | uint64_t owner; | |
71421259 | 612 | struct fuse_file_lock lk; |
4c82456e MS |
613 | uint32_t lk_flags; |
614 | uint32_t padding; | |
71421259 MS |
615 | }; |
616 | ||
617 | struct fuse_lk_out { | |
618 | struct fuse_file_lock lk; | |
619 | }; | |
620 | ||
31d40d74 | 621 | struct fuse_access_in { |
4c82456e MS |
622 | uint32_t mask; |
623 | uint32_t padding; | |
31d40d74 MS |
624 | }; |
625 | ||
3ec870d5 | 626 | struct fuse_init_in { |
4c82456e MS |
627 | uint32_t major; |
628 | uint32_t minor; | |
629 | uint32_t max_readahead; | |
630 | uint32_t flags; | |
334f485d MS |
631 | }; |
632 | ||
e27c9d38 MS |
633 | #define FUSE_COMPAT_INIT_OUT_SIZE 8 |
634 | #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 | |
635 | ||
3ec870d5 | 636 | struct fuse_init_out { |
4c82456e MS |
637 | uint32_t major; |
638 | uint32_t minor; | |
639 | uint32_t max_readahead; | |
640 | uint32_t flags; | |
641 | uint16_t max_background; | |
642 | uint16_t congestion_threshold; | |
643 | uint32_t max_write; | |
e27c9d38 | 644 | uint32_t time_gran; |
5da784cc CS |
645 | uint16_t max_pages; |
646 | uint16_t padding; | |
647 | uint32_t unused[8]; | |
3ec870d5 MS |
648 | }; |
649 | ||
151060ac TH |
650 | #define CUSE_INIT_INFO_MAX 4096 |
651 | ||
652 | struct cuse_init_in { | |
4c82456e MS |
653 | uint32_t major; |
654 | uint32_t minor; | |
655 | uint32_t unused; | |
656 | uint32_t flags; | |
151060ac TH |
657 | }; |
658 | ||
659 | struct cuse_init_out { | |
4c82456e MS |
660 | uint32_t major; |
661 | uint32_t minor; | |
662 | uint32_t unused; | |
663 | uint32_t flags; | |
664 | uint32_t max_read; | |
665 | uint32_t max_write; | |
666 | uint32_t dev_major; /* chardev major */ | |
667 | uint32_t dev_minor; /* chardev minor */ | |
668 | uint32_t spare[10]; | |
151060ac TH |
669 | }; |
670 | ||
a4d27e75 | 671 | struct fuse_interrupt_in { |
4c82456e | 672 | uint64_t unique; |
a4d27e75 MS |
673 | }; |
674 | ||
b2d2272f | 675 | struct fuse_bmap_in { |
4c82456e MS |
676 | uint64_t block; |
677 | uint32_t blocksize; | |
678 | uint32_t padding; | |
b2d2272f MS |
679 | }; |
680 | ||
681 | struct fuse_bmap_out { | |
4c82456e | 682 | uint64_t block; |
b2d2272f MS |
683 | }; |
684 | ||
59efec7b | 685 | struct fuse_ioctl_in { |
4c82456e MS |
686 | uint64_t fh; |
687 | uint32_t flags; | |
688 | uint32_t cmd; | |
689 | uint64_t arg; | |
690 | uint32_t in_size; | |
691 | uint32_t out_size; | |
59efec7b TH |
692 | }; |
693 | ||
1baa26b2 | 694 | struct fuse_ioctl_iovec { |
4c82456e MS |
695 | uint64_t base; |
696 | uint64_t len; | |
1baa26b2 MS |
697 | }; |
698 | ||
59efec7b | 699 | struct fuse_ioctl_out { |
4c82456e MS |
700 | int32_t result; |
701 | uint32_t flags; | |
702 | uint32_t in_iovs; | |
703 | uint32_t out_iovs; | |
59efec7b TH |
704 | }; |
705 | ||
95668a69 | 706 | struct fuse_poll_in { |
4c82456e MS |
707 | uint64_t fh; |
708 | uint64_t kh; | |
709 | uint32_t flags; | |
710 | uint32_t events; | |
95668a69 TH |
711 | }; |
712 | ||
713 | struct fuse_poll_out { | |
4c82456e MS |
714 | uint32_t revents; |
715 | uint32_t padding; | |
95668a69 TH |
716 | }; |
717 | ||
718 | struct fuse_notify_poll_wakeup_out { | |
4c82456e | 719 | uint64_t kh; |
95668a69 TH |
720 | }; |
721 | ||
05ba1f08 | 722 | struct fuse_fallocate_in { |
4c82456e MS |
723 | uint64_t fh; |
724 | uint64_t offset; | |
725 | uint64_t length; | |
726 | uint32_t mode; | |
727 | uint32_t padding; | |
05ba1f08 AP |
728 | }; |
729 | ||
334f485d | 730 | struct fuse_in_header { |
4c82456e MS |
731 | uint32_t len; |
732 | uint32_t opcode; | |
733 | uint64_t unique; | |
734 | uint64_t nodeid; | |
735 | uint32_t uid; | |
736 | uint32_t gid; | |
737 | uint32_t pid; | |
738 | uint32_t padding; | |
334f485d MS |
739 | }; |
740 | ||
741 | struct fuse_out_header { | |
4c82456e MS |
742 | uint32_t len; |
743 | int32_t error; | |
744 | uint64_t unique; | |
334f485d MS |
745 | }; |
746 | ||
e5e5558e | 747 | struct fuse_dirent { |
4c82456e MS |
748 | uint64_t ino; |
749 | uint64_t off; | |
750 | uint32_t namelen; | |
751 | uint32_t type; | |
c628ee67 | 752 | char name[]; |
e5e5558e MS |
753 | }; |
754 | ||
21f3da95 | 755 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) |
4c82456e MS |
756 | #define FUSE_DIRENT_ALIGN(x) \ |
757 | (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) | |
e5e5558e MS |
758 | #define FUSE_DIRENT_SIZE(d) \ |
759 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) | |
29d434b3 | 760 | |
0b05b183 AA |
761 | struct fuse_direntplus { |
762 | struct fuse_entry_out entry_out; | |
763 | struct fuse_dirent dirent; | |
764 | }; | |
765 | ||
766 | #define FUSE_NAME_OFFSET_DIRENTPLUS \ | |
767 | offsetof(struct fuse_direntplus, dirent.name) | |
768 | #define FUSE_DIRENTPLUS_SIZE(d) \ | |
769 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) | |
770 | ||
3b463ae0 | 771 | struct fuse_notify_inval_inode_out { |
4c82456e MS |
772 | uint64_t ino; |
773 | int64_t off; | |
774 | int64_t len; | |
3b463ae0 JM |
775 | }; |
776 | ||
777 | struct fuse_notify_inval_entry_out { | |
4c82456e MS |
778 | uint64_t parent; |
779 | uint32_t namelen; | |
780 | uint32_t padding; | |
3b463ae0 JM |
781 | }; |
782 | ||
451d0f59 | 783 | struct fuse_notify_delete_out { |
4c82456e MS |
784 | uint64_t parent; |
785 | uint64_t child; | |
786 | uint32_t namelen; | |
787 | uint32_t padding; | |
451d0f59 JM |
788 | }; |
789 | ||
a1d75f25 | 790 | struct fuse_notify_store_out { |
4c82456e MS |
791 | uint64_t nodeid; |
792 | uint64_t offset; | |
793 | uint32_t size; | |
794 | uint32_t padding; | |
a1d75f25 MS |
795 | }; |
796 | ||
2d45ba38 | 797 | struct fuse_notify_retrieve_out { |
4c82456e MS |
798 | uint64_t notify_unique; |
799 | uint64_t nodeid; | |
800 | uint64_t offset; | |
801 | uint32_t size; | |
802 | uint32_t padding; | |
2d45ba38 MS |
803 | }; |
804 | ||
805 | /* Matches the size of fuse_write_in */ | |
806 | struct fuse_notify_retrieve_in { | |
4c82456e MS |
807 | uint64_t dummy1; |
808 | uint64_t offset; | |
809 | uint32_t size; | |
810 | uint32_t dummy2; | |
811 | uint64_t dummy3; | |
812 | uint64_t dummy4; | |
2d45ba38 MS |
813 | }; |
814 | ||
00c570f4 MS |
815 | /* Device ioctls: */ |
816 | #define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) | |
817 | ||
0b5da8db R |
818 | struct fuse_lseek_in { |
819 | uint64_t fh; | |
820 | uint64_t offset; | |
821 | uint32_t whence; | |
822 | uint32_t padding; | |
823 | }; | |
824 | ||
825 | struct fuse_lseek_out { | |
826 | uint64_t offset; | |
827 | }; | |
828 | ||
88bc7d50 NV |
829 | struct fuse_copy_file_range_in { |
830 | uint64_t fh_in; | |
831 | uint64_t off_in; | |
832 | uint64_t nodeid_out; | |
833 | uint64_t fh_out; | |
834 | uint64_t off_out; | |
835 | uint64_t len; | |
836 | uint64_t flags; | |
837 | }; | |
838 | ||
29d434b3 | 839 | #endif /* _LINUX_FUSE_H */ |