.. | .. |
---|
38 | 38 | * |
---|
39 | 39 | * Protocol changelog: |
---|
40 | 40 | * |
---|
| 41 | + * 7.1: |
---|
| 42 | + * - add the following messages: |
---|
| 43 | + * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK, |
---|
| 44 | + * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE, |
---|
| 45 | + * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR, |
---|
| 46 | + * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR, |
---|
| 47 | + * FUSE_RELEASEDIR |
---|
| 48 | + * - add padding to messages to accommodate 32-bit servers on 64-bit kernels |
---|
| 49 | + * |
---|
| 50 | + * 7.2: |
---|
| 51 | + * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags |
---|
| 52 | + * - add FUSE_FSYNCDIR message |
---|
| 53 | + * |
---|
| 54 | + * 7.3: |
---|
| 55 | + * - add FUSE_ACCESS message |
---|
| 56 | + * - add FUSE_CREATE message |
---|
| 57 | + * - add filehandle to fuse_setattr_in |
---|
| 58 | + * |
---|
| 59 | + * 7.4: |
---|
| 60 | + * - add frsize to fuse_kstatfs |
---|
| 61 | + * - clean up request size limit checking |
---|
| 62 | + * |
---|
| 63 | + * 7.5: |
---|
| 64 | + * - add flags and max_write to fuse_init_out |
---|
| 65 | + * |
---|
| 66 | + * 7.6: |
---|
| 67 | + * - add max_readahead to fuse_init_in and fuse_init_out |
---|
| 68 | + * |
---|
| 69 | + * 7.7: |
---|
| 70 | + * - add FUSE_INTERRUPT message |
---|
| 71 | + * - add POSIX file lock support |
---|
| 72 | + * |
---|
| 73 | + * 7.8: |
---|
| 74 | + * - add lock_owner and flags fields to fuse_release_in |
---|
| 75 | + * - add FUSE_BMAP message |
---|
| 76 | + * - add FUSE_DESTROY message |
---|
| 77 | + * |
---|
41 | 78 | * 7.9: |
---|
42 | 79 | * - new fuse_getattr_in input argument of GETATTR |
---|
43 | 80 | * - add lk_flags in fuse_lk_in |
---|
44 | 81 | * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in |
---|
45 | 82 | * - add blksize field to fuse_attr |
---|
46 | 83 | * - add file flags field to fuse_read_in and fuse_write_in |
---|
| 84 | + * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in |
---|
47 | 85 | * |
---|
48 | 86 | * 7.10 |
---|
49 | 87 | * - add nonseekable open flag |
---|
.. | .. |
---|
54 | 92 | * - add POLL message and NOTIFY_POLL notification |
---|
55 | 93 | * |
---|
56 | 94 | * 7.12 |
---|
57 | | - * - add umask flag to input argument of open, mknod and mkdir |
---|
| 95 | + * - add umask flag to input argument of create, mknod and mkdir |
---|
58 | 96 | * - add notification messages for invalidation of inodes and |
---|
59 | 97 | * directory entries |
---|
60 | 98 | * |
---|
.. | .. |
---|
116 | 154 | * |
---|
117 | 155 | * 7.27 |
---|
118 | 156 | * - add FUSE_ABORT_ERROR |
---|
| 157 | + * |
---|
| 158 | + * 7.28 |
---|
| 159 | + * - add FUSE_COPY_FILE_RANGE |
---|
| 160 | + * - add FOPEN_CACHE_DIR |
---|
| 161 | + * - add FUSE_MAX_PAGES, add max_pages to init_out |
---|
| 162 | + * - add FUSE_CACHE_SYMLINKS |
---|
| 163 | + * |
---|
| 164 | + * 7.29 |
---|
| 165 | + * - add FUSE_NO_OPENDIR_SUPPORT flag |
---|
| 166 | + * |
---|
| 167 | + * 7.30 |
---|
| 168 | + * - add FUSE_EXPLICIT_INVAL_DATA |
---|
| 169 | + * - add FUSE_IOCTL_COMPAT_X32 |
---|
| 170 | + * |
---|
| 171 | + * 7.31 |
---|
| 172 | + * - add FUSE_WRITE_KILL_PRIV flag |
---|
| 173 | + * - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING |
---|
| 174 | + * - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag |
---|
| 175 | + * |
---|
| 176 | + * 7.32 |
---|
| 177 | + * - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS |
---|
119 | 178 | */ |
---|
120 | 179 | |
---|
121 | 180 | #ifndef _LINUX_FUSE_H |
---|
.. | .. |
---|
151 | 210 | #define FUSE_KERNEL_VERSION 7 |
---|
152 | 211 | |
---|
153 | 212 | /** Minor version number of this interface */ |
---|
154 | | -#define FUSE_KERNEL_MINOR_VERSION 27 |
---|
| 213 | +#define FUSE_KERNEL_MINOR_VERSION 32 |
---|
155 | 214 | |
---|
156 | 215 | /** The node ID of the root inode */ |
---|
157 | 216 | #define FUSE_ROOT_ID 1 |
---|
.. | .. |
---|
175 | 234 | uint32_t gid; |
---|
176 | 235 | uint32_t rdev; |
---|
177 | 236 | uint32_t blksize; |
---|
178 | | - uint32_t padding; |
---|
| 237 | + uint32_t flags; |
---|
179 | 238 | }; |
---|
180 | 239 | |
---|
181 | 240 | struct fuse_kstatfs { |
---|
.. | .. |
---|
219 | 278 | * FOPEN_DIRECT_IO: bypass page cache for this open file |
---|
220 | 279 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open |
---|
221 | 280 | * FOPEN_NONSEEKABLE: the file is not seekable |
---|
| 281 | + * FOPEN_CACHE_DIR: allow caching this directory |
---|
222 | 282 | * FOPEN_STREAM: the file is stream-like (no file position at all) |
---|
223 | 283 | */ |
---|
224 | 284 | #define FOPEN_DIRECT_IO (1 << 0) |
---|
225 | 285 | #define FOPEN_KEEP_CACHE (1 << 1) |
---|
226 | 286 | #define FOPEN_NONSEEKABLE (1 << 2) |
---|
| 287 | +#define FOPEN_CACHE_DIR (1 << 3) |
---|
227 | 288 | #define FOPEN_STREAM (1 << 4) |
---|
228 | 289 | |
---|
229 | 290 | /** |
---|
.. | .. |
---|
251 | 312 | * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc |
---|
252 | 313 | * FUSE_POSIX_ACL: filesystem supports posix acls |
---|
253 | 314 | * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED |
---|
| 315 | + * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages |
---|
| 316 | + * FUSE_CACHE_SYMLINKS: cache READLINK responses |
---|
| 317 | + * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir |
---|
| 318 | + * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request |
---|
| 319 | + * FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for |
---|
| 320 | + * foffset and moffset fields in struct |
---|
| 321 | + * fuse_setupmapping_out and fuse_removemapping_one. |
---|
| 322 | + * FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts |
---|
254 | 323 | */ |
---|
255 | 324 | #define FUSE_ASYNC_READ (1 << 0) |
---|
256 | 325 | #define FUSE_POSIX_LOCKS (1 << 1) |
---|
.. | .. |
---|
274 | 343 | #define FUSE_HANDLE_KILLPRIV (1 << 19) |
---|
275 | 344 | #define FUSE_POSIX_ACL (1 << 20) |
---|
276 | 345 | #define FUSE_ABORT_ERROR (1 << 21) |
---|
| 346 | +#define FUSE_MAX_PAGES (1 << 22) |
---|
| 347 | +#define FUSE_CACHE_SYMLINKS (1 << 23) |
---|
| 348 | +#define FUSE_NO_OPENDIR_SUPPORT (1 << 24) |
---|
| 349 | +#define FUSE_EXPLICIT_INVAL_DATA (1 << 25) |
---|
| 350 | +#define FUSE_MAP_ALIGNMENT (1 << 26) |
---|
| 351 | +#define FUSE_SUBMOUNTS (1 << 27) |
---|
| 352 | +#define FUSE_PASSTHROUGH (1 << 31) |
---|
277 | 353 | |
---|
278 | 354 | /** |
---|
279 | 355 | * CUSE INIT request/reply flags |
---|
.. | .. |
---|
303 | 379 | * |
---|
304 | 380 | * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed |
---|
305 | 381 | * FUSE_WRITE_LOCKOWNER: lock_owner field is valid |
---|
| 382 | + * FUSE_WRITE_KILL_PRIV: kill suid and sgid bits |
---|
306 | 383 | */ |
---|
307 | 384 | #define FUSE_WRITE_CACHE (1 << 0) |
---|
308 | 385 | #define FUSE_WRITE_LOCKOWNER (1 << 1) |
---|
| 386 | +#define FUSE_WRITE_KILL_PRIV (1 << 2) |
---|
309 | 387 | |
---|
310 | 388 | /** |
---|
311 | 389 | * Read flags |
---|
.. | .. |
---|
320 | 398 | * FUSE_IOCTL_RETRY: retry with new iovecs |
---|
321 | 399 | * FUSE_IOCTL_32BIT: 32bit ioctl |
---|
322 | 400 | * FUSE_IOCTL_DIR: is a directory |
---|
| 401 | + * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t) |
---|
323 | 402 | * |
---|
324 | 403 | * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs |
---|
325 | 404 | */ |
---|
.. | .. |
---|
328 | 407 | #define FUSE_IOCTL_RETRY (1 << 2) |
---|
329 | 408 | #define FUSE_IOCTL_32BIT (1 << 3) |
---|
330 | 409 | #define FUSE_IOCTL_DIR (1 << 4) |
---|
| 410 | +#define FUSE_IOCTL_COMPAT_X32 (1 << 5) |
---|
331 | 411 | |
---|
332 | 412 | #define FUSE_IOCTL_MAX_IOV 256 |
---|
333 | 413 | |
---|
.. | .. |
---|
338 | 418 | */ |
---|
339 | 419 | #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) |
---|
340 | 420 | |
---|
| 421 | +/** |
---|
| 422 | + * Fsync flags |
---|
| 423 | + * |
---|
| 424 | + * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata |
---|
| 425 | + */ |
---|
| 426 | +#define FUSE_FSYNC_FDATASYNC (1 << 0) |
---|
| 427 | + |
---|
| 428 | +/** |
---|
| 429 | + * fuse_attr flags |
---|
| 430 | + * |
---|
| 431 | + * FUSE_ATTR_SUBMOUNT: Object is a submount root |
---|
| 432 | + */ |
---|
| 433 | +#define FUSE_ATTR_SUBMOUNT (1 << 0) |
---|
| 434 | + |
---|
341 | 435 | enum fuse_opcode { |
---|
342 | | - FUSE_LOOKUP = 1, |
---|
343 | | - FUSE_FORGET = 2, /* no reply */ |
---|
344 | | - FUSE_GETATTR = 3, |
---|
345 | | - FUSE_SETATTR = 4, |
---|
346 | | - FUSE_READLINK = 5, |
---|
347 | | - FUSE_SYMLINK = 6, |
---|
348 | | - FUSE_MKNOD = 8, |
---|
349 | | - FUSE_MKDIR = 9, |
---|
350 | | - FUSE_UNLINK = 10, |
---|
351 | | - FUSE_RMDIR = 11, |
---|
352 | | - FUSE_RENAME = 12, |
---|
353 | | - FUSE_LINK = 13, |
---|
354 | | - FUSE_OPEN = 14, |
---|
355 | | - FUSE_READ = 15, |
---|
356 | | - FUSE_WRITE = 16, |
---|
357 | | - FUSE_STATFS = 17, |
---|
358 | | - FUSE_RELEASE = 18, |
---|
359 | | - FUSE_FSYNC = 20, |
---|
360 | | - FUSE_SETXATTR = 21, |
---|
361 | | - FUSE_GETXATTR = 22, |
---|
362 | | - FUSE_LISTXATTR = 23, |
---|
363 | | - FUSE_REMOVEXATTR = 24, |
---|
364 | | - FUSE_FLUSH = 25, |
---|
365 | | - FUSE_INIT = 26, |
---|
366 | | - FUSE_OPENDIR = 27, |
---|
367 | | - FUSE_READDIR = 28, |
---|
368 | | - FUSE_RELEASEDIR = 29, |
---|
369 | | - FUSE_FSYNCDIR = 30, |
---|
370 | | - FUSE_GETLK = 31, |
---|
371 | | - FUSE_SETLK = 32, |
---|
372 | | - FUSE_SETLKW = 33, |
---|
373 | | - FUSE_ACCESS = 34, |
---|
374 | | - FUSE_CREATE = 35, |
---|
375 | | - FUSE_INTERRUPT = 36, |
---|
376 | | - FUSE_BMAP = 37, |
---|
377 | | - FUSE_DESTROY = 38, |
---|
378 | | - FUSE_IOCTL = 39, |
---|
379 | | - FUSE_POLL = 40, |
---|
380 | | - FUSE_NOTIFY_REPLY = 41, |
---|
381 | | - FUSE_BATCH_FORGET = 42, |
---|
382 | | - FUSE_FALLOCATE = 43, |
---|
383 | | - FUSE_READDIRPLUS = 44, |
---|
384 | | - FUSE_RENAME2 = 45, |
---|
385 | | - FUSE_LSEEK = 46, |
---|
386 | | - FUSE_CANONICAL_PATH= 2016, |
---|
| 436 | + FUSE_LOOKUP = 1, |
---|
| 437 | + FUSE_FORGET = 2, /* no reply */ |
---|
| 438 | + FUSE_GETATTR = 3, |
---|
| 439 | + FUSE_SETATTR = 4, |
---|
| 440 | + FUSE_READLINK = 5, |
---|
| 441 | + FUSE_SYMLINK = 6, |
---|
| 442 | + FUSE_MKNOD = 8, |
---|
| 443 | + FUSE_MKDIR = 9, |
---|
| 444 | + FUSE_UNLINK = 10, |
---|
| 445 | + FUSE_RMDIR = 11, |
---|
| 446 | + FUSE_RENAME = 12, |
---|
| 447 | + FUSE_LINK = 13, |
---|
| 448 | + FUSE_OPEN = 14, |
---|
| 449 | + FUSE_READ = 15, |
---|
| 450 | + FUSE_WRITE = 16, |
---|
| 451 | + FUSE_STATFS = 17, |
---|
| 452 | + FUSE_RELEASE = 18, |
---|
| 453 | + FUSE_FSYNC = 20, |
---|
| 454 | + FUSE_SETXATTR = 21, |
---|
| 455 | + FUSE_GETXATTR = 22, |
---|
| 456 | + FUSE_LISTXATTR = 23, |
---|
| 457 | + FUSE_REMOVEXATTR = 24, |
---|
| 458 | + FUSE_FLUSH = 25, |
---|
| 459 | + FUSE_INIT = 26, |
---|
| 460 | + FUSE_OPENDIR = 27, |
---|
| 461 | + FUSE_READDIR = 28, |
---|
| 462 | + FUSE_RELEASEDIR = 29, |
---|
| 463 | + FUSE_FSYNCDIR = 30, |
---|
| 464 | + FUSE_GETLK = 31, |
---|
| 465 | + FUSE_SETLK = 32, |
---|
| 466 | + FUSE_SETLKW = 33, |
---|
| 467 | + FUSE_ACCESS = 34, |
---|
| 468 | + FUSE_CREATE = 35, |
---|
| 469 | + FUSE_INTERRUPT = 36, |
---|
| 470 | + FUSE_BMAP = 37, |
---|
| 471 | + FUSE_DESTROY = 38, |
---|
| 472 | + FUSE_IOCTL = 39, |
---|
| 473 | + FUSE_POLL = 40, |
---|
| 474 | + FUSE_NOTIFY_REPLY = 41, |
---|
| 475 | + FUSE_BATCH_FORGET = 42, |
---|
| 476 | + FUSE_FALLOCATE = 43, |
---|
| 477 | + FUSE_READDIRPLUS = 44, |
---|
| 478 | + FUSE_RENAME2 = 45, |
---|
| 479 | + FUSE_LSEEK = 46, |
---|
| 480 | + FUSE_COPY_FILE_RANGE = 47, |
---|
| 481 | + FUSE_SETUPMAPPING = 48, |
---|
| 482 | + FUSE_REMOVEMAPPING = 49, |
---|
| 483 | + FUSE_CANONICAL_PATH = 2016, |
---|
387 | 484 | |
---|
388 | 485 | /* CUSE specific operations */ |
---|
389 | | - CUSE_INIT = 4096, |
---|
| 486 | + CUSE_INIT = 4096, |
---|
| 487 | + |
---|
| 488 | + /* Reserved opcodes: helpful to detect structure endian-ness */ |
---|
| 489 | + CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */ |
---|
| 490 | + FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */ |
---|
390 | 491 | }; |
---|
391 | 492 | |
---|
392 | 493 | enum fuse_notify_code { |
---|
.. | .. |
---|
506 | 607 | struct fuse_open_out { |
---|
507 | 608 | uint64_t fh; |
---|
508 | 609 | uint32_t open_flags; |
---|
509 | | - uint32_t padding; |
---|
| 610 | + uint32_t passthrough_fh; |
---|
510 | 611 | }; |
---|
511 | 612 | |
---|
512 | 613 | struct fuse_release_in { |
---|
.. | .. |
---|
613 | 714 | uint16_t congestion_threshold; |
---|
614 | 715 | uint32_t max_write; |
---|
615 | 716 | uint32_t time_gran; |
---|
616 | | - uint32_t unused[9]; |
---|
| 717 | + uint16_t max_pages; |
---|
| 718 | + uint16_t map_alignment; |
---|
| 719 | + uint32_t unused[8]; |
---|
617 | 720 | }; |
---|
618 | 721 | |
---|
619 | 722 | #define CUSE_INIT_INFO_MAX 4096 |
---|
.. | .. |
---|
782 | 885 | }; |
---|
783 | 886 | |
---|
784 | 887 | /* Device ioctls: */ |
---|
785 | | -#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) |
---|
| 888 | +#define FUSE_DEV_IOC_MAGIC 229 |
---|
| 889 | +#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t) |
---|
| 890 | +/* 127 is reserved for the V1 interface implementation in Android (deprecated) */ |
---|
| 891 | +/* 126 is reserved for the V2 interface implementation in Android */ |
---|
| 892 | +#define FUSE_DEV_IOC_PASSTHROUGH_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 126, __u32) |
---|
786 | 893 | |
---|
787 | 894 | struct fuse_lseek_in { |
---|
788 | 895 | uint64_t fh; |
---|
.. | .. |
---|
795 | 902 | uint64_t offset; |
---|
796 | 903 | }; |
---|
797 | 904 | |
---|
| 905 | +struct fuse_copy_file_range_in { |
---|
| 906 | + uint64_t fh_in; |
---|
| 907 | + uint64_t off_in; |
---|
| 908 | + uint64_t nodeid_out; |
---|
| 909 | + uint64_t fh_out; |
---|
| 910 | + uint64_t off_out; |
---|
| 911 | + uint64_t len; |
---|
| 912 | + uint64_t flags; |
---|
| 913 | +}; |
---|
| 914 | + |
---|
| 915 | +#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0) |
---|
| 916 | +#define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1) |
---|
| 917 | +struct fuse_setupmapping_in { |
---|
| 918 | + /* An already open handle */ |
---|
| 919 | + uint64_t fh; |
---|
| 920 | + /* Offset into the file to start the mapping */ |
---|
| 921 | + uint64_t foffset; |
---|
| 922 | + /* Length of mapping required */ |
---|
| 923 | + uint64_t len; |
---|
| 924 | + /* Flags, FUSE_SETUPMAPPING_FLAG_* */ |
---|
| 925 | + uint64_t flags; |
---|
| 926 | + /* Offset in Memory Window */ |
---|
| 927 | + uint64_t moffset; |
---|
| 928 | +}; |
---|
| 929 | + |
---|
| 930 | +struct fuse_removemapping_in { |
---|
| 931 | + /* number of fuse_removemapping_one follows */ |
---|
| 932 | + uint32_t count; |
---|
| 933 | +}; |
---|
| 934 | + |
---|
| 935 | +struct fuse_removemapping_one { |
---|
| 936 | + /* Offset into the dax window start the unmapping */ |
---|
| 937 | + uint64_t moffset; |
---|
| 938 | + /* Length of mapping required */ |
---|
| 939 | + uint64_t len; |
---|
| 940 | +}; |
---|
| 941 | + |
---|
| 942 | +#define FUSE_REMOVEMAPPING_MAX_ENTRY \ |
---|
| 943 | + (PAGE_SIZE / sizeof(struct fuse_removemapping_one)) |
---|
| 944 | + |
---|
798 | 945 | #endif /* _LINUX_FUSE_H */ |
---|