hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/include/uapi/linux/fuse.h
....@@ -38,12 +38,50 @@
3838 *
3939 * Protocol changelog:
4040 *
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
+ *
4178 * 7.9:
4279 * - new fuse_getattr_in input argument of GETATTR
4380 * - add lk_flags in fuse_lk_in
4481 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
4582 * - add blksize field to fuse_attr
4683 * - add file flags field to fuse_read_in and fuse_write_in
84
+ * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
4785 *
4886 * 7.10
4987 * - add nonseekable open flag
....@@ -54,7 +92,7 @@
5492 * - add POLL message and NOTIFY_POLL notification
5593 *
5694 * 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
5896 * - add notification messages for invalidation of inodes and
5997 * directory entries
6098 *
....@@ -116,6 +154,27 @@
116154 *
117155 * 7.27
118156 * - 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
119178 */
120179
121180 #ifndef _LINUX_FUSE_H
....@@ -151,7 +210,7 @@
151210 #define FUSE_KERNEL_VERSION 7
152211
153212 /** Minor version number of this interface */
154
-#define FUSE_KERNEL_MINOR_VERSION 27
213
+#define FUSE_KERNEL_MINOR_VERSION 32
155214
156215 /** The node ID of the root inode */
157216 #define FUSE_ROOT_ID 1
....@@ -175,7 +234,7 @@
175234 uint32_t gid;
176235 uint32_t rdev;
177236 uint32_t blksize;
178
- uint32_t padding;
237
+ uint32_t flags;
179238 };
180239
181240 struct fuse_kstatfs {
....@@ -219,11 +278,13 @@
219278 * FOPEN_DIRECT_IO: bypass page cache for this open file
220279 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
221280 * FOPEN_NONSEEKABLE: the file is not seekable
281
+ * FOPEN_CACHE_DIR: allow caching this directory
222282 * FOPEN_STREAM: the file is stream-like (no file position at all)
223283 */
224284 #define FOPEN_DIRECT_IO (1 << 0)
225285 #define FOPEN_KEEP_CACHE (1 << 1)
226286 #define FOPEN_NONSEEKABLE (1 << 2)
287
+#define FOPEN_CACHE_DIR (1 << 3)
227288 #define FOPEN_STREAM (1 << 4)
228289
229290 /**
....@@ -251,6 +312,14 @@
251312 * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
252313 * FUSE_POSIX_ACL: filesystem supports posix acls
253314 * 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
254323 */
255324 #define FUSE_ASYNC_READ (1 << 0)
256325 #define FUSE_POSIX_LOCKS (1 << 1)
....@@ -274,6 +343,13 @@
274343 #define FUSE_HANDLE_KILLPRIV (1 << 19)
275344 #define FUSE_POSIX_ACL (1 << 20)
276345 #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)
277353
278354 /**
279355 * CUSE INIT request/reply flags
....@@ -303,9 +379,11 @@
303379 *
304380 * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
305381 * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
382
+ * FUSE_WRITE_KILL_PRIV: kill suid and sgid bits
306383 */
307384 #define FUSE_WRITE_CACHE (1 << 0)
308385 #define FUSE_WRITE_LOCKOWNER (1 << 1)
386
+#define FUSE_WRITE_KILL_PRIV (1 << 2)
309387
310388 /**
311389 * Read flags
....@@ -320,6 +398,7 @@
320398 * FUSE_IOCTL_RETRY: retry with new iovecs
321399 * FUSE_IOCTL_32BIT: 32bit ioctl
322400 * FUSE_IOCTL_DIR: is a directory
401
+ * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t)
323402 *
324403 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
325404 */
....@@ -328,6 +407,7 @@
328407 #define FUSE_IOCTL_RETRY (1 << 2)
329408 #define FUSE_IOCTL_32BIT (1 << 3)
330409 #define FUSE_IOCTL_DIR (1 << 4)
410
+#define FUSE_IOCTL_COMPAT_X32 (1 << 5)
331411
332412 #define FUSE_IOCTL_MAX_IOV 256
333413
....@@ -338,55 +418,76 @@
338418 */
339419 #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
340420
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
+
341435 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,
387484
388485 /* 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 */
390491 };
391492
392493 enum fuse_notify_code {
....@@ -506,7 +607,7 @@
506607 struct fuse_open_out {
507608 uint64_t fh;
508609 uint32_t open_flags;
509
- uint32_t padding;
610
+ uint32_t passthrough_fh;
510611 };
511612
512613 struct fuse_release_in {
....@@ -613,7 +714,9 @@
613714 uint16_t congestion_threshold;
614715 uint32_t max_write;
615716 uint32_t time_gran;
616
- uint32_t unused[9];
717
+ uint16_t max_pages;
718
+ uint16_t map_alignment;
719
+ uint32_t unused[8];
617720 };
618721
619722 #define CUSE_INIT_INFO_MAX 4096
....@@ -782,7 +885,11 @@
782885 };
783886
784887 /* 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)
786893
787894 struct fuse_lseek_in {
788895 uint64_t fh;
....@@ -795,4 +902,44 @@
795902 uint64_t offset;
796903 };
797904
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
+
798945 #endif /* _LINUX_FUSE_H */