1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _LINUX_FUSE_H
20 #define _LINUX_FUSE_H
21 #include <stdint.h>
22 #define FUSE_KERNEL_VERSION 7
23 #define FUSE_KERNEL_MINOR_VERSION 33
24 #define FUSE_ROOT_ID 1
25 struct fuse_attr {
26   uint64_t ino;
27   uint64_t size;
28   uint64_t blocks;
29   uint64_t atime;
30   uint64_t mtime;
31   uint64_t ctime;
32   uint32_t atimensec;
33   uint32_t mtimensec;
34   uint32_t ctimensec;
35   uint32_t mode;
36   uint32_t nlink;
37   uint32_t uid;
38   uint32_t gid;
39   uint32_t rdev;
40   uint32_t blksize;
41   uint32_t flags;
42 };
43 struct fuse_kstatfs {
44   uint64_t blocks;
45   uint64_t bfree;
46   uint64_t bavail;
47   uint64_t files;
48   uint64_t ffree;
49   uint32_t bsize;
50   uint32_t namelen;
51   uint32_t frsize;
52   uint32_t padding;
53   uint32_t spare[6];
54 };
55 struct fuse_file_lock {
56   uint64_t start;
57   uint64_t end;
58   uint32_t type;
59   uint32_t pid;
60 };
61 #define FATTR_MODE (1 << 0)
62 #define FATTR_UID (1 << 1)
63 #define FATTR_GID (1 << 2)
64 #define FATTR_SIZE (1 << 3)
65 #define FATTR_ATIME (1 << 4)
66 #define FATTR_MTIME (1 << 5)
67 #define FATTR_FH (1 << 6)
68 #define FATTR_ATIME_NOW (1 << 7)
69 #define FATTR_MTIME_NOW (1 << 8)
70 #define FATTR_LOCKOWNER (1 << 9)
71 #define FATTR_CTIME (1 << 10)
72 #define FATTR_KILL_SUIDGID (1 << 11)
73 #define FOPEN_DIRECT_IO (1 << 0)
74 #define FOPEN_KEEP_CACHE (1 << 1)
75 #define FOPEN_NONSEEKABLE (1 << 2)
76 #define FOPEN_CACHE_DIR (1 << 3)
77 #define FOPEN_STREAM (1 << 4)
78 #define FUSE_ASYNC_READ (1 << 0)
79 #define FUSE_POSIX_LOCKS (1 << 1)
80 #define FUSE_FILE_OPS (1 << 2)
81 #define FUSE_ATOMIC_O_TRUNC (1 << 3)
82 #define FUSE_EXPORT_SUPPORT (1 << 4)
83 #define FUSE_BIG_WRITES (1 << 5)
84 #define FUSE_DONT_MASK (1 << 6)
85 #define FUSE_SPLICE_WRITE (1 << 7)
86 #define FUSE_SPLICE_MOVE (1 << 8)
87 #define FUSE_SPLICE_READ (1 << 9)
88 #define FUSE_FLOCK_LOCKS (1 << 10)
89 #define FUSE_HAS_IOCTL_DIR (1 << 11)
90 #define FUSE_AUTO_INVAL_DATA (1 << 12)
91 #define FUSE_DO_READDIRPLUS (1 << 13)
92 #define FUSE_READDIRPLUS_AUTO (1 << 14)
93 #define FUSE_ASYNC_DIO (1 << 15)
94 #define FUSE_WRITEBACK_CACHE (1 << 16)
95 #define FUSE_NO_OPEN_SUPPORT (1 << 17)
96 #define FUSE_PARALLEL_DIROPS (1 << 18)
97 #define FUSE_HANDLE_KILLPRIV (1 << 19)
98 #define FUSE_POSIX_ACL (1 << 20)
99 #define FUSE_ABORT_ERROR (1 << 21)
100 #define FUSE_MAX_PAGES (1 << 22)
101 #define FUSE_CACHE_SYMLINKS (1 << 23)
102 #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
103 #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
104 #define FUSE_MAP_ALIGNMENT (1 << 26)
105 #define FUSE_SUBMOUNTS (1 << 27)
106 #define FUSE_HANDLE_KILLPRIV_V2 (1 << 28)
107 #define FUSE_PASSTHROUGH (1 << 31)
108 #define CUSE_UNRESTRICTED_IOCTL (1 << 0)
109 #define FUSE_RELEASE_FLUSH (1 << 0)
110 #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
111 #define FUSE_GETATTR_FH (1 << 0)
112 #define FUSE_LK_FLOCK (1 << 0)
113 #define FUSE_WRITE_CACHE (1 << 0)
114 #define FUSE_WRITE_LOCKOWNER (1 << 1)
115 #define FUSE_WRITE_KILL_SUIDGID (1 << 2)
116 #define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID
117 #define FUSE_READ_LOCKOWNER (1 << 1)
118 #define FUSE_IOCTL_COMPAT (1 << 0)
119 #define FUSE_IOCTL_UNRESTRICTED (1 << 1)
120 #define FUSE_IOCTL_RETRY (1 << 2)
121 #define FUSE_IOCTL_32BIT (1 << 3)
122 #define FUSE_IOCTL_DIR (1 << 4)
123 #define FUSE_IOCTL_COMPAT_X32 (1 << 5)
124 #define FUSE_IOCTL_MAX_IOV 256
125 #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
126 #define FUSE_FSYNC_FDATASYNC (1 << 0)
127 #define FUSE_ATTR_SUBMOUNT (1 << 0)
128 #define FUSE_OPEN_KILL_SUIDGID (1 << 0)
129 enum fuse_opcode {
130   FUSE_LOOKUP = 1,
131   FUSE_FORGET = 2,
132   FUSE_GETATTR = 3,
133   FUSE_SETATTR = 4,
134   FUSE_READLINK = 5,
135   FUSE_SYMLINK = 6,
136   FUSE_MKNOD = 8,
137   FUSE_MKDIR = 9,
138   FUSE_UNLINK = 10,
139   FUSE_RMDIR = 11,
140   FUSE_RENAME = 12,
141   FUSE_LINK = 13,
142   FUSE_OPEN = 14,
143   FUSE_READ = 15,
144   FUSE_WRITE = 16,
145   FUSE_STATFS = 17,
146   FUSE_RELEASE = 18,
147   FUSE_FSYNC = 20,
148   FUSE_SETXATTR = 21,
149   FUSE_GETXATTR = 22,
150   FUSE_LISTXATTR = 23,
151   FUSE_REMOVEXATTR = 24,
152   FUSE_FLUSH = 25,
153   FUSE_INIT = 26,
154   FUSE_OPENDIR = 27,
155   FUSE_READDIR = 28,
156   FUSE_RELEASEDIR = 29,
157   FUSE_FSYNCDIR = 30,
158   FUSE_GETLK = 31,
159   FUSE_SETLK = 32,
160   FUSE_SETLKW = 33,
161   FUSE_ACCESS = 34,
162   FUSE_CREATE = 35,
163   FUSE_INTERRUPT = 36,
164   FUSE_BMAP = 37,
165   FUSE_DESTROY = 38,
166   FUSE_IOCTL = 39,
167   FUSE_POLL = 40,
168   FUSE_NOTIFY_REPLY = 41,
169   FUSE_BATCH_FORGET = 42,
170   FUSE_FALLOCATE = 43,
171   FUSE_READDIRPLUS = 44,
172   FUSE_RENAME2 = 45,
173   FUSE_LSEEK = 46,
174   FUSE_COPY_FILE_RANGE = 47,
175   FUSE_SETUPMAPPING = 48,
176   FUSE_REMOVEMAPPING = 49,
177   FUSE_CANONICAL_PATH = 2016,
178   CUSE_INIT = 4096,
179   CUSE_INIT_BSWAP_RESERVED = 1048576,
180   FUSE_INIT_BSWAP_RESERVED = 436207616,
181 };
182 enum fuse_notify_code {
183   FUSE_NOTIFY_POLL = 1,
184   FUSE_NOTIFY_INVAL_INODE = 2,
185   FUSE_NOTIFY_INVAL_ENTRY = 3,
186   FUSE_NOTIFY_STORE = 4,
187   FUSE_NOTIFY_RETRIEVE = 5,
188   FUSE_NOTIFY_DELETE = 6,
189   FUSE_NOTIFY_CODE_MAX,
190 };
191 #define FUSE_MIN_READ_BUFFER 8192
192 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
193 struct fuse_entry_out {
194   uint64_t nodeid;
195   uint64_t generation;
196   uint64_t entry_valid;
197   uint64_t attr_valid;
198   uint32_t entry_valid_nsec;
199   uint32_t attr_valid_nsec;
200   struct fuse_attr attr;
201 };
202 struct fuse_forget_in {
203   uint64_t nlookup;
204 };
205 struct fuse_forget_one {
206   uint64_t nodeid;
207   uint64_t nlookup;
208 };
209 struct fuse_batch_forget_in {
210   uint32_t count;
211   uint32_t dummy;
212 };
213 struct fuse_getattr_in {
214   uint32_t getattr_flags;
215   uint32_t dummy;
216   uint64_t fh;
217 };
218 #define FUSE_COMPAT_ATTR_OUT_SIZE 96
219 struct fuse_attr_out {
220   uint64_t attr_valid;
221   uint32_t attr_valid_nsec;
222   uint32_t dummy;
223   struct fuse_attr attr;
224 };
225 #define FUSE_COMPAT_MKNOD_IN_SIZE 8
226 struct fuse_mknod_in {
227   uint32_t mode;
228   uint32_t rdev;
229   uint32_t umask;
230   uint32_t padding;
231 };
232 struct fuse_mkdir_in {
233   uint32_t mode;
234   uint32_t umask;
235 };
236 struct fuse_rename_in {
237   uint64_t newdir;
238 };
239 struct fuse_rename2_in {
240   uint64_t newdir;
241   uint32_t flags;
242   uint32_t padding;
243 };
244 struct fuse_link_in {
245   uint64_t oldnodeid;
246 };
247 struct fuse_setattr_in {
248   uint32_t valid;
249   uint32_t padding;
250   uint64_t fh;
251   uint64_t size;
252   uint64_t lock_owner;
253   uint64_t atime;
254   uint64_t mtime;
255   uint64_t ctime;
256   uint32_t atimensec;
257   uint32_t mtimensec;
258   uint32_t ctimensec;
259   uint32_t mode;
260   uint32_t unused4;
261   uint32_t uid;
262   uint32_t gid;
263   uint32_t unused5;
264 };
265 struct fuse_open_in {
266   uint32_t flags;
267   uint32_t open_flags;
268 };
269 struct fuse_create_in {
270   uint32_t flags;
271   uint32_t mode;
272   uint32_t umask;
273   uint32_t open_flags;
274 };
275 struct fuse_open_out {
276   uint64_t fh;
277   uint32_t open_flags;
278   uint32_t passthrough_fh;
279 };
280 struct fuse_release_in {
281   uint64_t fh;
282   uint32_t flags;
283   uint32_t release_flags;
284   uint64_t lock_owner;
285 };
286 struct fuse_flush_in {
287   uint64_t fh;
288   uint32_t unused;
289   uint32_t padding;
290   uint64_t lock_owner;
291 };
292 struct fuse_read_in {
293   uint64_t fh;
294   uint64_t offset;
295   uint32_t size;
296   uint32_t read_flags;
297   uint64_t lock_owner;
298   uint32_t flags;
299   uint32_t padding;
300 };
301 #define FUSE_COMPAT_WRITE_IN_SIZE 24
302 struct fuse_write_in {
303   uint64_t fh;
304   uint64_t offset;
305   uint32_t size;
306   uint32_t write_flags;
307   uint64_t lock_owner;
308   uint32_t flags;
309   uint32_t padding;
310 };
311 struct fuse_write_out {
312   uint32_t size;
313   uint32_t padding;
314 };
315 #define FUSE_COMPAT_STATFS_SIZE 48
316 struct fuse_statfs_out {
317   struct fuse_kstatfs st;
318 };
319 struct fuse_fsync_in {
320   uint64_t fh;
321   uint32_t fsync_flags;
322   uint32_t padding;
323 };
324 struct fuse_setxattr_in {
325   uint32_t size;
326   uint32_t flags;
327 };
328 struct fuse_getxattr_in {
329   uint32_t size;
330   uint32_t padding;
331 };
332 struct fuse_getxattr_out {
333   uint32_t size;
334   uint32_t padding;
335 };
336 struct fuse_lk_in {
337   uint64_t fh;
338   uint64_t owner;
339   struct fuse_file_lock lk;
340   uint32_t lk_flags;
341   uint32_t padding;
342 };
343 struct fuse_lk_out {
344   struct fuse_file_lock lk;
345 };
346 struct fuse_access_in {
347   uint32_t mask;
348   uint32_t padding;
349 };
350 struct fuse_init_in {
351   uint32_t major;
352   uint32_t minor;
353   uint32_t max_readahead;
354   uint32_t flags;
355 };
356 #define FUSE_COMPAT_INIT_OUT_SIZE 8
357 #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
358 struct fuse_init_out {
359   uint32_t major;
360   uint32_t minor;
361   uint32_t max_readahead;
362   uint32_t flags;
363   uint16_t max_background;
364   uint16_t congestion_threshold;
365   uint32_t max_write;
366   uint32_t time_gran;
367   uint16_t max_pages;
368   uint16_t map_alignment;
369   uint32_t unused[8];
370 };
371 #define CUSE_INIT_INFO_MAX 4096
372 struct cuse_init_in {
373   uint32_t major;
374   uint32_t minor;
375   uint32_t unused;
376   uint32_t flags;
377 };
378 struct cuse_init_out {
379   uint32_t major;
380   uint32_t minor;
381   uint32_t unused;
382   uint32_t flags;
383   uint32_t max_read;
384   uint32_t max_write;
385   uint32_t dev_major;
386   uint32_t dev_minor;
387   uint32_t spare[10];
388 };
389 struct fuse_interrupt_in {
390   uint64_t unique;
391 };
392 struct fuse_bmap_in {
393   uint64_t block;
394   uint32_t blocksize;
395   uint32_t padding;
396 };
397 struct fuse_bmap_out {
398   uint64_t block;
399 };
400 struct fuse_ioctl_in {
401   uint64_t fh;
402   uint32_t flags;
403   uint32_t cmd;
404   uint64_t arg;
405   uint32_t in_size;
406   uint32_t out_size;
407 };
408 struct fuse_ioctl_iovec {
409   uint64_t base;
410   uint64_t len;
411 };
412 struct fuse_ioctl_out {
413   int32_t result;
414   uint32_t flags;
415   uint32_t in_iovs;
416   uint32_t out_iovs;
417 };
418 struct fuse_poll_in {
419   uint64_t fh;
420   uint64_t kh;
421   uint32_t flags;
422   uint32_t events;
423 };
424 struct fuse_poll_out {
425   uint32_t revents;
426   uint32_t padding;
427 };
428 struct fuse_notify_poll_wakeup_out {
429   uint64_t kh;
430 };
431 struct fuse_fallocate_in {
432   uint64_t fh;
433   uint64_t offset;
434   uint64_t length;
435   uint32_t mode;
436   uint32_t padding;
437 };
438 struct fuse_in_header {
439   uint32_t len;
440   uint32_t opcode;
441   uint64_t unique;
442   uint64_t nodeid;
443   uint32_t uid;
444   uint32_t gid;
445   uint32_t pid;
446   uint32_t padding;
447 };
448 struct fuse_passthrough_out {
449   uint32_t fd;
450   uint32_t len;
451   void * vec;
452 };
453 struct fuse_out_header {
454   uint32_t len;
455   int32_t error;
456   uint64_t unique;
457 };
458 struct fuse_dirent {
459   uint64_t ino;
460   uint64_t off;
461   uint32_t namelen;
462   uint32_t type;
463   char name[];
464 };
465 #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
466 #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
467 #define FUSE_DIRENT_SIZE(d) FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
468 struct fuse_direntplus {
469   struct fuse_entry_out entry_out;
470   struct fuse_dirent dirent;
471 };
472 #define FUSE_NAME_OFFSET_DIRENTPLUS offsetof(struct fuse_direntplus, dirent.name)
473 #define FUSE_DIRENTPLUS_SIZE(d) FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
474 struct fuse_notify_inval_inode_out {
475   uint64_t ino;
476   int64_t off;
477   int64_t len;
478 };
479 struct fuse_notify_inval_entry_out {
480   uint64_t parent;
481   uint32_t namelen;
482   uint32_t padding;
483 };
484 struct fuse_notify_delete_out {
485   uint64_t parent;
486   uint64_t child;
487   uint32_t namelen;
488   uint32_t padding;
489 };
490 struct fuse_notify_store_out {
491   uint64_t nodeid;
492   uint64_t offset;
493   uint32_t size;
494   uint32_t padding;
495 };
496 struct fuse_notify_retrieve_out {
497   uint64_t notify_unique;
498   uint64_t nodeid;
499   uint64_t offset;
500   uint32_t size;
501   uint32_t padding;
502 };
503 struct fuse_notify_retrieve_in {
504   uint64_t dummy1;
505   uint64_t offset;
506   uint32_t size;
507   uint32_t dummy2;
508   uint64_t dummy3;
509   uint64_t dummy4;
510 };
511 #define FUSE_DEV_IOC_MAGIC 229
512 #define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
513 #define FUSE_DEV_IOC_PASSTHROUGH_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 127, struct fuse_passthrough_out)
514 struct fuse_lseek_in {
515   uint64_t fh;
516   uint64_t offset;
517   uint32_t whence;
518   uint32_t padding;
519 };
520 struct fuse_lseek_out {
521   uint64_t offset;
522 };
523 struct fuse_copy_file_range_in {
524   uint64_t fh_in;
525   uint64_t off_in;
526   uint64_t nodeid_out;
527   uint64_t fh_out;
528   uint64_t off_out;
529   uint64_t len;
530   uint64_t flags;
531 };
532 #define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
533 #define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
534 struct fuse_setupmapping_in {
535   uint64_t fh;
536   uint64_t foffset;
537   uint64_t len;
538   uint64_t flags;
539   uint64_t moffset;
540 };
541 struct fuse_removemapping_in {
542   uint32_t count;
543 };
544 struct fuse_removemapping_one {
545   uint64_t moffset;
546   uint64_t len;
547 };
548 #define FUSE_REMOVEMAPPING_MAX_ENTRY (PAGE_SIZE / sizeof(struct fuse_removemapping_one))
549 #endif
550