1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118#ifndef _LINUX_FUSE_H
119#define _LINUX_FUSE_H
120
121#ifdef __KERNEL__
122#include <linux/types.h>
123#else
124#include <stdint.h>
125#endif
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148#define FUSE_KERNEL_VERSION 7
149
150
151#define FUSE_KERNEL_MINOR_VERSION 26
152
153
154#define FUSE_ROOT_ID 1
155
156
157
158
159struct fuse_attr {
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;
176};
177
178struct fuse_kstatfs {
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];
189};
190
191struct fuse_file_lock {
192 uint64_t start;
193 uint64_t end;
194 uint32_t type;
195 uint32_t pid;
196};
197
198
199
200
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)
207#define FATTR_FH (1 << 6)
208#define FATTR_ATIME_NOW (1 << 7)
209#define FATTR_MTIME_NOW (1 << 8)
210#define FATTR_LOCKOWNER (1 << 9)
211#define FATTR_CTIME (1 << 10)
212
213
214
215
216
217
218
219
220#define FOPEN_DIRECT_IO (1 << 0)
221#define FOPEN_KEEP_CACHE (1 << 1)
222#define FOPEN_NONSEEKABLE (1 << 2)
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249#define FUSE_ASYNC_READ (1 << 0)
250#define FUSE_POSIX_LOCKS (1 << 1)
251#define FUSE_FILE_OPS (1 << 2)
252#define FUSE_ATOMIC_O_TRUNC (1 << 3)
253#define FUSE_EXPORT_SUPPORT (1 << 4)
254#define FUSE_BIG_WRITES (1 << 5)
255#define FUSE_DONT_MASK (1 << 6)
256#define FUSE_SPLICE_WRITE (1 << 7)
257#define FUSE_SPLICE_MOVE (1 << 8)
258#define FUSE_SPLICE_READ (1 << 9)
259#define FUSE_FLOCK_LOCKS (1 << 10)
260#define FUSE_HAS_IOCTL_DIR (1 << 11)
261#define FUSE_AUTO_INVAL_DATA (1 << 12)
262#define FUSE_DO_READDIRPLUS (1 << 13)
263#define FUSE_READDIRPLUS_AUTO (1 << 14)
264#define FUSE_ASYNC_DIO (1 << 15)
265#define FUSE_WRITEBACK_CACHE (1 << 16)
266#define FUSE_NO_OPEN_SUPPORT (1 << 17)
267#define FUSE_PARALLEL_DIROPS (1 << 18)
268#define FUSE_HANDLE_KILLPRIV (1 << 19)
269#define FUSE_POSIX_ACL (1 << 20)
270
271
272
273
274
275
276#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
277
278
279
280
281#define FUSE_RELEASE_FLUSH (1 << 0)
282#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
283
284
285
286
287#define FUSE_GETATTR_FH (1 << 0)
288
289
290
291
292#define FUSE_LK_FLOCK (1 << 0)
293
294
295
296
297
298
299
300#define FUSE_WRITE_CACHE (1 << 0)
301#define FUSE_WRITE_LOCKOWNER (1 << 1)
302
303
304
305
306#define FUSE_READ_LOCKOWNER (1 << 1)
307
308
309
310
311
312
313
314
315
316
317
318
319#define FUSE_IOCTL_COMPAT (1 << 0)
320#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
321#define FUSE_IOCTL_RETRY (1 << 2)
322#define FUSE_IOCTL_32BIT (1 << 3)
323#define FUSE_IOCTL_DIR (1 << 4)
324
325#define FUSE_IOCTL_MAX_IOV 256
326
327
328
329
330
331
332#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
333
334enum fuse_opcode {
335 FUSE_LOOKUP = 1,
336 FUSE_FORGET = 2,
337 FUSE_GETATTR = 3,
338 FUSE_SETATTR = 4,
339 FUSE_READLINK = 5,
340 FUSE_SYMLINK = 6,
341 FUSE_MKNOD = 8,
342 FUSE_MKDIR = 9,
343 FUSE_UNLINK = 10,
344 FUSE_RMDIR = 11,
345 FUSE_RENAME = 12,
346 FUSE_LINK = 13,
347 FUSE_OPEN = 14,
348 FUSE_READ = 15,
349 FUSE_WRITE = 16,
350 FUSE_STATFS = 17,
351 FUSE_RELEASE = 18,
352 FUSE_FSYNC = 20,
353 FUSE_SETXATTR = 21,
354 FUSE_GETXATTR = 22,
355 FUSE_LISTXATTR = 23,
356 FUSE_REMOVEXATTR = 24,
357 FUSE_FLUSH = 25,
358 FUSE_INIT = 26,
359 FUSE_OPENDIR = 27,
360 FUSE_READDIR = 28,
361 FUSE_RELEASEDIR = 29,
362 FUSE_FSYNCDIR = 30,
363 FUSE_GETLK = 31,
364 FUSE_SETLK = 32,
365 FUSE_SETLKW = 33,
366 FUSE_ACCESS = 34,
367 FUSE_CREATE = 35,
368 FUSE_INTERRUPT = 36,
369 FUSE_BMAP = 37,
370 FUSE_DESTROY = 38,
371 FUSE_IOCTL = 39,
372 FUSE_POLL = 40,
373 FUSE_NOTIFY_REPLY = 41,
374 FUSE_BATCH_FORGET = 42,
375 FUSE_FALLOCATE = 43,
376 FUSE_READDIRPLUS = 44,
377 FUSE_RENAME2 = 45,
378 FUSE_LSEEK = 46,
379
380
381 CUSE_INIT = 4096,
382};
383
384enum fuse_notify_code {
385 FUSE_NOTIFY_POLL = 1,
386 FUSE_NOTIFY_INVAL_INODE = 2,
387 FUSE_NOTIFY_INVAL_ENTRY = 3,
388 FUSE_NOTIFY_STORE = 4,
389 FUSE_NOTIFY_RETRIEVE = 5,
390 FUSE_NOTIFY_DELETE = 6,
391 FUSE_NOTIFY_CODE_MAX,
392};
393
394
395#define FUSE_MIN_READ_BUFFER 8192
396
397#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
398
399struct fuse_entry_out {
400 uint64_t nodeid;
401 uint64_t generation;
402
403 uint64_t entry_valid;
404 uint64_t attr_valid;
405 uint32_t entry_valid_nsec;
406 uint32_t attr_valid_nsec;
407 struct fuse_attr attr;
408};
409
410struct fuse_forget_in {
411 uint64_t nlookup;
412};
413
414struct fuse_forget_one {
415 uint64_t nodeid;
416 uint64_t nlookup;
417};
418
419struct fuse_batch_forget_in {
420 uint32_t count;
421 uint32_t dummy;
422};
423
424struct fuse_getattr_in {
425 uint32_t getattr_flags;
426 uint32_t dummy;
427 uint64_t fh;
428};
429
430#define FUSE_COMPAT_ATTR_OUT_SIZE 96
431
432struct fuse_attr_out {
433 uint64_t attr_valid;
434 uint32_t attr_valid_nsec;
435 uint32_t dummy;
436 struct fuse_attr attr;
437};
438
439#define FUSE_COMPAT_MKNOD_IN_SIZE 8
440
441struct fuse_mknod_in {
442 uint32_t mode;
443 uint32_t rdev;
444 uint32_t umask;
445 uint32_t padding;
446};
447
448struct fuse_mkdir_in {
449 uint32_t mode;
450 uint32_t umask;
451};
452
453struct fuse_rename_in {
454 uint64_t newdir;
455};
456
457struct fuse_rename2_in {
458 uint64_t newdir;
459 uint32_t flags;
460 uint32_t padding;
461};
462
463struct fuse_link_in {
464 uint64_t oldnodeid;
465};
466
467struct fuse_setattr_in {
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;
475 uint64_t ctime;
476 uint32_t atimensec;
477 uint32_t mtimensec;
478 uint32_t ctimensec;
479 uint32_t mode;
480 uint32_t unused4;
481 uint32_t uid;
482 uint32_t gid;
483 uint32_t unused5;
484};
485
486struct fuse_open_in {
487 uint32_t flags;
488 uint32_t unused;
489};
490
491struct fuse_create_in {
492 uint32_t flags;
493 uint32_t mode;
494 uint32_t umask;
495 uint32_t padding;
496};
497
498struct fuse_open_out {
499 uint64_t fh;
500 uint32_t open_flags;
501 uint32_t padding;
502};
503
504struct fuse_release_in {
505 uint64_t fh;
506 uint32_t flags;
507 uint32_t release_flags;
508 uint64_t lock_owner;
509};
510
511struct fuse_flush_in {
512 uint64_t fh;
513 uint32_t unused;
514 uint32_t padding;
515 uint64_t lock_owner;
516};
517
518struct fuse_read_in {
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;
526};
527
528#define FUSE_COMPAT_WRITE_IN_SIZE 24
529
530struct fuse_write_in {
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;
538};
539
540struct fuse_write_out {
541 uint32_t size;
542 uint32_t padding;
543};
544
545#define FUSE_COMPAT_STATFS_SIZE 48
546
547struct fuse_statfs_out {
548 struct fuse_kstatfs st;
549};
550
551struct fuse_fsync_in {
552 uint64_t fh;
553 uint32_t fsync_flags;
554 uint32_t padding;
555};
556
557struct fuse_setxattr_in {
558 uint32_t size;
559 uint32_t flags;
560};
561
562struct fuse_getxattr_in {
563 uint32_t size;
564 uint32_t padding;
565};
566
567struct fuse_getxattr_out {
568 uint32_t size;
569 uint32_t padding;
570};
571
572struct fuse_lk_in {
573 uint64_t fh;
574 uint64_t owner;
575 struct fuse_file_lock lk;
576 uint32_t lk_flags;
577 uint32_t padding;
578};
579
580struct fuse_lk_out {
581 struct fuse_file_lock lk;
582};
583
584struct fuse_access_in {
585 uint32_t mask;
586 uint32_t padding;
587};
588
589struct fuse_init_in {
590 uint32_t major;
591 uint32_t minor;
592 uint32_t max_readahead;
593 uint32_t flags;
594};
595
596#define FUSE_COMPAT_INIT_OUT_SIZE 8
597#define FUSE_COMPAT_22_INIT_OUT_SIZE 24
598
599struct fuse_init_out {
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;
607 uint32_t time_gran;
608 uint32_t unused[9];
609};
610
611#define CUSE_INIT_INFO_MAX 4096
612
613struct cuse_init_in {
614 uint32_t major;
615 uint32_t minor;
616 uint32_t unused;
617 uint32_t flags;
618};
619
620struct cuse_init_out {
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;
628 uint32_t dev_minor;
629 uint32_t spare[10];
630};
631
632struct fuse_interrupt_in {
633 uint64_t unique;
634};
635
636struct fuse_bmap_in {
637 uint64_t block;
638 uint32_t blocksize;
639 uint32_t padding;
640};
641
642struct fuse_bmap_out {
643 uint64_t block;
644};
645
646struct fuse_ioctl_in {
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;
653};
654
655struct fuse_ioctl_iovec {
656 uint64_t base;
657 uint64_t len;
658};
659
660struct fuse_ioctl_out {
661 int32_t result;
662 uint32_t flags;
663 uint32_t in_iovs;
664 uint32_t out_iovs;
665};
666
667struct fuse_poll_in {
668 uint64_t fh;
669 uint64_t kh;
670 uint32_t flags;
671 uint32_t events;
672};
673
674struct fuse_poll_out {
675 uint32_t revents;
676 uint32_t padding;
677};
678
679struct fuse_notify_poll_wakeup_out {
680 uint64_t kh;
681};
682
683struct fuse_fallocate_in {
684 uint64_t fh;
685 uint64_t offset;
686 uint64_t length;
687 uint32_t mode;
688 uint32_t padding;
689};
690
691struct fuse_in_header {
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;
700};
701
702struct fuse_out_header {
703 uint32_t len;
704 int32_t error;
705 uint64_t unique;
706};
707
708struct fuse_dirent {
709 uint64_t ino;
710 uint64_t off;
711 uint32_t namelen;
712 uint32_t type;
713 char name[];
714};
715
716#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
717#define FUSE_DIRENT_ALIGN(x) \
718 (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
719#define FUSE_DIRENT_SIZE(d) \
720 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
721
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
732struct fuse_notify_inval_inode_out {
733 uint64_t ino;
734 int64_t off;
735 int64_t len;
736};
737
738struct fuse_notify_inval_entry_out {
739 uint64_t parent;
740 uint32_t namelen;
741 uint32_t padding;
742};
743
744struct fuse_notify_delete_out {
745 uint64_t parent;
746 uint64_t child;
747 uint32_t namelen;
748 uint32_t padding;
749};
750
751struct fuse_notify_store_out {
752 uint64_t nodeid;
753 uint64_t offset;
754 uint32_t size;
755 uint32_t padding;
756};
757
758struct fuse_notify_retrieve_out {
759 uint64_t notify_unique;
760 uint64_t nodeid;
761 uint64_t offset;
762 uint32_t size;
763 uint32_t padding;
764};
765
766
767struct fuse_notify_retrieve_in {
768 uint64_t dummy1;
769 uint64_t offset;
770 uint32_t size;
771 uint32_t dummy2;
772 uint64_t dummy3;
773 uint64_t dummy4;
774};
775
776
777#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
778
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
790#endif
791