polyfuse_sys/
kernel.rs

1//! FUSE application binary interface.
2//!
3//! The bindings is compatible with ABI 7.29 (in libfuse 3.6.2).
4
5#![allow(clippy::identity_op)]
6
7use std::convert::TryFrom;
8use std::error;
9use std::fmt;
10
11/// The major version number of FUSE protocol.
12pub const FUSE_KERNEL_VERSION: u32 = 7;
13
14/// The minor version number of FUSE protocol.
15pub const FUSE_KERNEL_MINOR_VERSION: u32 = 29;
16
17/// The minimum length of read buffer.
18pub const FUSE_MIN_READ_BUFFER: u32 = 8192;
19
20/// Maximum of in_iovecs + out_iovecs
21pub const FUSE_IOCTL_MAX_IOV: u32 = 256;
22
23// Bitmasks for fuse_setattr_in.valid
24pub const FATTR_MODE: u32 = 1 << 0;
25pub const FATTR_UID: u32 = 1 << 1;
26pub const FATTR_GID: u32 = 1 << 2;
27pub const FATTR_SIZE: u32 = 1 << 3;
28pub const FATTR_ATIME: u32 = 1 << 4;
29pub const FATTR_MTIME: u32 = 1 << 5;
30pub const FATTR_FH: u32 = 1 << 6;
31pub const FATTR_ATIME_NOW: u32 = 1 << 7;
32pub const FATTR_MTIME_NOW: u32 = 1 << 8;
33pub const FATTR_LOCKOWNER: u32 = 1 << 9;
34pub const FATTR_CTIME: u32 = 1 << 10;
35
36// Flags returned by the OPEN request.
37pub const FOPEN_DIRECT_IO: u32 = 1 << 0;
38pub const FOPEN_KEEP_CACHE: u32 = 1 << 1;
39pub const FOPEN_NONSEEKABLE: u32 = 1 << 2;
40pub const FOPEN_CACHE_DIR: u32 = 1 << 3;
41
42// INIT request/reply flags.
43pub const FUSE_ASYNC_READ: u32 = 1;
44pub const FUSE_POSIX_LOCKS: u32 = 1 << 1;
45pub const FUSE_FILE_OPS: u32 = 1 << 2;
46pub const FUSE_ATOMIC_O_TRUNC: u32 = 1 << 3;
47pub const FUSE_EXPORT_SUPPORT: u32 = 1 << 4;
48pub const FUSE_BIG_WRITES: u32 = 1 << 5;
49pub const FUSE_DONT_MASK: u32 = 1 << 6;
50pub const FUSE_SPLICE_WRITE: u32 = 1 << 7;
51pub const FUSE_SPLICE_MOVE: u32 = 1 << 8;
52pub const FUSE_SPLICE_READ: u32 = 1 << 9;
53pub const FUSE_FLOCK_LOCKS: u32 = 1 << 10;
54pub const FUSE_HAS_IOCTL_DIR: u32 = 1 << 11;
55pub const FUSE_AUTO_INVAL_DATA: u32 = 1 << 12;
56pub const FUSE_DO_READDIRPLUS: u32 = 1 << 13;
57pub const FUSE_READDIRPLUS_AUTO: u32 = 1 << 14;
58pub const FUSE_ASYNC_DIO: u32 = 1 << 15;
59pub const FUSE_WRITEBACK_CACHE: u32 = 1 << 16;
60pub const FUSE_NO_OPEN_SUPPORT: u32 = 1 << 17;
61pub const FUSE_PARALLEL_DIROPS: u32 = 1 << 18;
62pub const FUSE_HANDLE_KILLPRIV: u32 = 1 << 19;
63pub const FUSE_POSIX_ACL: u32 = 1 << 20;
64pub const FUSE_ABORT_ERROR: u32 = 1 << 21;
65pub const FUSE_MAX_PAGES: u32 = 1 << 22;
66pub const FUSE_CACHE_SYMLINKS: u32 = 1 << 23;
67pub const FUSE_NO_OPENDIR_SUPPORT: u32 = 1 << 24;
68
69// CUSE INIT request/reply flags.
70pub const CUSE_UNRESTRICTED_IOCTL: u32 = 1 << 0;
71
72// Release flags.
73pub const FUSE_RELEASE_FLUSH: u32 = 1 << 0;
74pub const FUSE_RELEASE_FLOCK_UNLOCK: u32 = 1 << 1;
75
76// Getattr flags.
77pub const FUSE_GETATTR_FH: u32 = 1;
78
79// Lock flags.
80pub const FUSE_LK_FLOCK: u32 = 1 << 0;
81
82// WRITE flags.
83pub const FUSE_WRITE_CACHE: u32 = 1 << 0;
84pub const FUSE_WRITE_LOCKOWNER: u32 = 1 << 1;
85
86// Read flags.
87pub const FUSE_READ_LOCKOWNER: u32 = 1 << 1;
88
89// Ioctl flags.
90pub const FUSE_IOCTL_COMPAT: u32 = 1 << 0;
91pub const FUSE_IOCTL_UNRESTRICTED: u32 = 1 << 1;
92pub const FUSE_IOCTL_RETRY: u32 = 1 << 2;
93pub const FUSE_IOCTL_32BIT: u32 = 1 << 3;
94pub const FUSE_IOCTL_DIR: u32 = 1 << 4;
95
96// Poll flags.
97pub const FUSE_POLL_SCHEDULE_NOTIFY: u32 = 1 << 0;
98
99// Fsync flags.
100// Added in libfuse 3.7.0.
101const FUSE_FSYNC_FDATASYNC: u32 = 1 << 0;
102
103// misc
104pub const FUSE_COMPAT_ENTRY_OUT_SIZE: usize = 120;
105pub const FUSE_COMPAT_ATTR_OUT_SIZE: usize = 96;
106pub const FUSE_COMPAT_MKNOD_IN_SIZE: usize = 8;
107pub const FUSE_COMPAT_WRITE_IN_SIZE: usize = 24;
108pub const FUSE_COMPAT_STATFS_SIZE: usize = 48;
109pub const FUSE_COMPAT_INIT_OUT_SIZE: usize = 8;
110pub const FUSE_COMPAT_22_INIT_OUT_SIZE: usize = 24;
111pub const CUSE_INIT_INFO_MAX: u32 = 4096;
112
113// Device ioctls
114#[cfg(target_os = "linux")]
115pub const FUSE_DEV_IOC_CLONE: u32 = 0x_80_04_e5_00; // = _IOR(229, 0, uint32_t)
116
117#[cfg(target_os = "freebsd")]
118pub const FUSE_DEV_IOC_CLONE: u32 = 0x_40_04_e5_00; // = _IOR(229, 0, uint32_t)
119
120#[derive(Default, Debug, Copy, Clone)]
121#[repr(C)]
122pub struct fuse_attr {
123    pub ino: u64,
124    pub size: u64,
125    pub blocks: u64,
126    pub atime: u64,
127    pub mtime: u64,
128    pub ctime: u64,
129    pub atimensec: u32,
130    pub mtimensec: u32,
131    pub ctimensec: u32,
132    pub mode: u32,
133    pub nlink: u32,
134    pub uid: u32,
135    pub gid: u32,
136    pub rdev: u32,
137    pub blksize: u32,
138    pub padding: u32,
139}
140
141#[derive(Debug, Default)]
142#[repr(C)]
143pub struct fuse_dirent {
144    pub ino: u64,
145    pub off: u64,
146    pub namelen: u32,
147    pub typ: u32,
148    pub name: [u8; 0],
149}
150
151#[derive(Debug, Default)]
152#[repr(C)]
153pub struct fuse_direntplus {
154    pub entry_out: fuse_entry_out,
155    pub dirent: fuse_dirent,
156}
157
158#[derive(Debug, Default, Copy, Clone)]
159#[repr(C)]
160pub struct fuse_kstatfs {
161    pub blocks: u64,
162    pub bfree: u64,
163    pub bavail: u64,
164    pub files: u64,
165    pub ffree: u64,
166    pub bsize: u32,
167    pub namelen: u32,
168    pub frsize: u32,
169    pub padding: u32,
170    pub spare: [u32; 6usize],
171}
172
173#[derive(Debug, Default, Copy, Clone)]
174#[repr(C)]
175pub struct fuse_file_lock {
176    pub start: u64,
177    pub end: u64,
178    pub typ: u32,
179    pub pid: u32,
180}
181
182macro_rules! define_opcode {
183    ($(
184        $(#[$m:meta])*
185        $VARIANT:ident = $val:expr,
186    )*) => {
187        $(
188            #[doc(hidden)]
189            pub const $VARIANT: u32 = $val;
190        )*
191
192        #[derive(Debug, Copy, Clone, PartialEq, Hash)]
193        #[repr(u32)]
194        pub enum fuse_opcode {
195            $(
196                $(#[$m])*
197                $VARIANT = self::$VARIANT,
198            )*
199        }
200
201        impl TryFrom<u32> for fuse_opcode {
202            type Error = UnknownOpcode;
203
204            fn try_from(opcode: u32) -> Result<Self, Self::Error> {
205                match opcode {
206                    $(
207                        $val => Ok(Self::$VARIANT),
208                    )*
209                    opcode => Err(UnknownOpcode(opcode)),
210                }
211            }
212        }
213    };
214}
215
216define_opcode! {
217    FUSE_LOOKUP = 1,
218    FUSE_FORGET = 2,
219    FUSE_GETATTR = 3,
220    FUSE_SETATTR = 4,
221    FUSE_READLINK = 5,
222    FUSE_SYMLINK = 6,
223    // _ = 7,
224    FUSE_MKNOD = 8,
225    FUSE_MKDIR = 9,
226    FUSE_UNLINK = 10,
227    FUSE_RMDIR = 11,
228    FUSE_RENAME = 12,
229    FUSE_LINK = 13,
230    FUSE_OPEN = 14,
231    FUSE_READ = 15,
232    FUSE_WRITE = 16,
233    FUSE_STATFS = 17,
234    FUSE_RELEASE = 18,
235    // _ = 19,
236    FUSE_FSYNC = 20,
237    FUSE_SETXATTR = 21,
238    FUSE_GETXATTR = 22,
239    FUSE_LISTXATTR = 23,
240    FUSE_REMOVEXATTR = 24,
241    FUSE_FLUSH = 25,
242    FUSE_INIT = 26,
243    FUSE_OPENDIR = 27,
244    FUSE_READDIR = 28,
245    FUSE_RELEASEDIR = 29,
246    FUSE_FSYNCDIR = 30,
247    FUSE_GETLK = 31,
248    FUSE_SETLK = 32,
249    FUSE_SETLKW = 33,
250    FUSE_ACCESS = 34,
251    FUSE_CREATE = 35,
252    FUSE_INTERRUPT = 36,
253    FUSE_BMAP = 37,
254    FUSE_DESTROY = 38,
255    FUSE_IOCTL = 39,
256    FUSE_POLL = 40,
257    FUSE_NOTIFY_REPLY = 41,
258    FUSE_BATCH_FORGET = 42,
259    FUSE_FALLOCATE = 43,
260    FUSE_READDIRPLUS = 44,
261    FUSE_RENAME2 = 45,
262    FUSE_LSEEK = 46,
263    FUSE_COPY_FILE_RANGE = 47,
264
265    CUSE_INIT = 4096,
266}
267
268#[doc(hidden)]
269#[derive(Debug)]
270pub struct UnknownOpcode(u32);
271
272impl fmt::Display for UnknownOpcode {
273    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
274        write!(f, "unknown opcode: {}", self.0)
275    }
276}
277
278impl error::Error for UnknownOpcode {}
279
280#[derive(Debug)]
281#[repr(C)]
282pub struct fuse_in_header {
283    pub len: u32,
284    pub opcode: u32,
285    pub unique: u64,
286    pub nodeid: u64,
287    pub uid: u32,
288    pub gid: u32,
289    pub pid: u32,
290    pub padding: u32,
291}
292
293#[derive(Debug)]
294#[repr(C)]
295pub struct fuse_init_in {
296    pub major: u32,
297    pub minor: u32,
298    pub max_readahead: u32,
299    pub flags: u32,
300}
301
302#[derive(Debug)]
303#[repr(C)]
304pub struct fuse_forget_in {
305    pub nlookup: u64,
306}
307
308#[derive(Debug)]
309#[repr(C)]
310pub struct fuse_getattr_in {
311    pub getattr_flags: u32,
312    pub dummy: u32,
313    pub fh: u64,
314}
315
316impl fuse_getattr_in {
317    pub fn fh(&self) -> Option<u64> {
318        if self.getattr_flags & FUSE_GETATTR_FH != 0 {
319            Some(self.fh)
320        } else {
321            None
322        }
323    }
324}
325
326#[derive(Debug)]
327#[repr(C)]
328pub struct fuse_setattr_in {
329    pub valid: u32,
330    pub padding: u32,
331    pub fh: u64,
332    pub size: u64,
333    pub lock_owner: u64,
334    pub atime: u64,
335    pub mtime: u64,
336    pub ctime: u64,
337    pub atimensec: u32,
338    pub mtimensec: u32,
339    pub ctimensec: u32,
340    pub mode: u32,
341    pub unused4: u32,
342    pub uid: u32,
343    pub gid: u32,
344    pub unused5: u32,
345}
346
347impl fuse_setattr_in {
348    #[inline]
349    fn get<R>(&self, flag: u32, f: impl FnOnce(&Self) -> R) -> Option<R> {
350        if self.valid & flag != 0 {
351            Some(f(self))
352        } else {
353            None
354        }
355    }
356
357    pub fn fh(&self) -> Option<u64> {
358        self.get(FATTR_FH, |this| this.fh)
359    }
360
361    pub fn size(&self) -> Option<u64> {
362        self.get(FATTR_SIZE, |this| this.size)
363    }
364
365    pub fn lock_owner(&self) -> Option<u64> {
366        self.get(FATTR_LOCKOWNER, |this| this.lock_owner)
367    }
368
369    pub fn atime(&self) -> Option<(u64, u32, bool)> {
370        self.get(FATTR_ATIME, |this| {
371            (
372                this.atime,
373                this.atimensec,
374                this.valid & FATTR_ATIME_NOW != 0,
375            )
376        })
377    }
378
379    pub fn mtime(&self) -> Option<(u64, u32, bool)> {
380        self.get(FATTR_CTIME, |this| {
381            (
382                this.mtime,
383                this.mtimensec,
384                this.valid & FATTR_MTIME_NOW != 0,
385            )
386        })
387    }
388
389    pub fn ctime(&self) -> Option<(u64, u32)> {
390        self.get(FATTR_CTIME, |this| (this.ctime, this.ctimensec))
391    }
392
393    /// Returns the new file if specified.
394    pub fn mode(&self) -> Option<u32> {
395        self.get(FATTR_MODE, |this| this.mode)
396    }
397
398    /// Returns the new UID if specified.
399    pub fn uid(&self) -> Option<u32> {
400        self.get(FATTR_UID, |this| this.uid)
401    }
402
403    /// Returns the new GID if specified.
404    pub fn gid(&self) -> Option<u32> {
405        self.get(FATTR_GID, |this| this.gid)
406    }
407}
408
409#[derive(Debug)]
410#[repr(C)]
411pub struct fuse_mknod_in {
412    pub mode: u32,
413    pub rdev: u32,
414    pub umask: u32,
415    pub padding: u32,
416}
417
418#[derive(Debug)]
419#[repr(C)]
420pub struct fuse_mkdir_in {
421    pub mode: u32,
422    pub umask: u32,
423}
424
425#[derive(Debug)]
426#[repr(C)]
427pub struct fuse_rename_in {
428    pub newdir: u64,
429}
430
431#[derive(Debug)]
432#[repr(C)]
433pub struct fuse_link_in {
434    pub oldnodeid: u64,
435}
436
437#[derive(Debug)]
438#[repr(C)]
439pub struct fuse_open_in {
440    pub flags: u32,
441    pub unused: u32,
442}
443
444#[derive(Debug)]
445#[repr(C)]
446pub struct fuse_read_in {
447    pub fh: u64,
448    pub offset: u64,
449    pub size: u32,
450    pub read_flags: u32,
451    pub lock_owner: u64,
452    pub flags: u32,
453    pub padding: u32,
454}
455
456impl fuse_read_in {
457    pub fn lock_owner(&self) -> Option<u64> {
458        if self.read_flags & FUSE_READ_LOCKOWNER != 0 {
459            Some(self.lock_owner)
460        } else {
461            None
462        }
463    }
464}
465
466#[derive(Debug)]
467#[repr(C)]
468pub struct fuse_write_in {
469    pub fh: u64,
470    pub offset: u64,
471    pub size: u32,
472    pub write_flags: u32,
473    pub lock_owner: u64,
474    pub flags: u32,
475    pub padding: u32,
476}
477
478impl fuse_write_in {
479    pub fn lock_owner(&self) -> Option<u64> {
480        if self.write_flags & FUSE_WRITE_LOCKOWNER != 0 {
481            Some(self.lock_owner)
482        } else {
483            None
484        }
485    }
486}
487
488#[derive(Debug)]
489#[repr(C)]
490pub struct fuse_flush_in {
491    pub fh: u64,
492    pub unused: u32,
493    pub padding: u32,
494    pub lock_owner: u64,
495}
496
497#[derive(Debug)]
498#[repr(C)]
499pub struct fuse_release_in {
500    pub fh: u64,
501    pub flags: u32,
502    pub release_flags: u32,
503    pub lock_owner: u64,
504}
505
506impl fuse_release_in {
507    pub fn flush(&self) -> bool {
508        self.release_flags & FUSE_RELEASE_FLUSH != 0
509    }
510}
511
512#[derive(Debug)]
513#[repr(C)]
514pub struct fuse_fsync_in {
515    pub fh: u64,
516    pub fsync_flags: u32,
517    pub padding: u32,
518}
519
520impl fuse_fsync_in {
521    pub fn datasync(&self) -> bool {
522        self.fsync_flags & FUSE_FSYNC_FDATASYNC != 0
523    }
524}
525
526#[derive(Debug)]
527#[repr(C)]
528pub struct fuse_getxattr_in {
529    pub size: u32,
530    pub padding: u32,
531}
532
533#[derive(Debug)]
534#[repr(C)]
535pub struct fuse_setxattr_in {
536    pub size: u32,
537    pub flags: u32,
538}
539
540#[derive(Debug)]
541#[repr(C)]
542pub struct fuse_lk_in {
543    pub fh: u64,
544    pub owner: u64,
545    pub lk: fuse_file_lock,
546    pub lk_flags: u32,
547    pub padding: u32,
548}
549
550#[derive(Debug)]
551#[repr(C)]
552pub struct fuse_access_in {
553    pub mask: u32,
554    #[doc(hidden)]
555    pub padding: u32,
556}
557
558#[derive(Debug)]
559#[repr(C)]
560pub struct fuse_create_in {
561    pub flags: u32,
562    pub mode: u32,
563    pub umask: u32,
564    pub padding: u32,
565}
566
567#[derive(Debug)]
568#[repr(C)]
569pub struct fuse_bmap_in {
570    pub block: u64,
571    pub blocksize: u32,
572    pub padding: u32,
573}
574
575#[derive(Debug, Default)]
576#[repr(C)]
577pub struct fuse_out_header {
578    pub len: u32,
579    pub error: i32,
580    pub unique: u64,
581}
582
583#[derive(Debug, Default)]
584#[repr(C)]
585pub struct fuse_attr_out {
586    pub attr_valid: u64,
587    pub attr_valid_nsec: u32,
588    pub dummy: u32,
589    pub attr: fuse_attr,
590}
591
592#[derive(Debug, Default)]
593#[repr(C)]
594pub struct fuse_entry_out {
595    pub nodeid: u64,
596    pub generation: u64,
597    pub entry_valid: u64,
598    pub attr_valid: u64,
599    pub entry_valid_nsec: u32,
600    pub attr_valid_nsec: u32,
601    pub attr: fuse_attr,
602}
603
604#[derive(Debug)]
605#[repr(C)]
606pub struct fuse_init_out {
607    pub major: u32,
608    pub minor: u32,
609    pub max_readahead: u32,
610    pub flags: u32,
611    pub max_background: u16,
612    pub congestion_threshold: u16,
613    pub max_write: u32,
614    pub time_gran: u32,
615    pub max_pages: u16,
616    pub padding: u16,
617    pub unused: [u32; 8],
618}
619
620impl Default for fuse_init_out {
621    fn default() -> Self {
622        Self {
623            major: FUSE_KERNEL_VERSION,
624            minor: FUSE_KERNEL_MINOR_VERSION,
625            max_readahead: 0,
626            flags: 0,
627            max_background: 0,
628            congestion_threshold: 0,
629            max_write: 0,
630            time_gran: 0,
631            max_pages: 0,
632            padding: 0,
633            unused: [0; 8],
634        }
635    }
636}
637
638#[derive(Debug, Default)]
639#[repr(C)]
640pub struct fuse_getxattr_out {
641    pub size: u32,
642    pub padding: u32,
643}
644
645#[derive(Debug, Default)]
646#[repr(C)]
647pub struct fuse_open_out {
648    pub fh: u64,
649    pub open_flags: u32,
650    pub padding: u32,
651}
652
653#[derive(Debug, Default)]
654#[repr(C)]
655pub struct fuse_write_out {
656    pub size: u32,
657    pub padding: u32,
658}
659
660#[derive(Debug, Default)]
661#[repr(C)]
662pub struct fuse_statfs_out {
663    pub st: fuse_kstatfs,
664}
665
666#[derive(Debug, Default)]
667#[repr(C)]
668pub struct fuse_lk_out {
669    pub lk: fuse_file_lock,
670}
671
672#[derive(Debug, Default)]
673#[repr(C)]
674pub struct fuse_bmap_out {
675    pub block: u64,
676}
677
678#[derive(Debug)]
679#[repr(C)]
680pub struct fuse_ioctl_in {
681    pub fh: u64,
682    pub flags: u32,
683    pub cmd: u32,
684    pub arg: u64,
685    pub in_size: u32,
686    pub out_size: u32,
687}
688
689#[derive(Debug, Default)]
690#[repr(C)]
691pub struct fuse_ioctl_out {
692    pub result: i32,
693    pub flags: u32,
694    pub in_iovs: u32,
695    pub out_iovs: u32,
696}
697
698#[derive(Debug, Default)]
699#[repr(C)]
700pub struct fuse_ioctl_iovec {
701    pub base: u64,
702    pub len: u64,
703}
704
705#[derive(Debug)]
706#[repr(C)]
707pub struct fuse_poll_in {
708    pub fh: u64,
709    pub kh: u64,
710    pub flags: u32,
711    pub events: u32,
712}
713
714#[derive(Debug, Default)]
715#[repr(C)]
716pub struct fuse_poll_out {
717    pub revents: u32,
718    #[doc(hidden)]
719    pub padding: u32,
720}
721
722#[derive(Debug)]
723#[repr(C)]
724pub struct fuse_interrupt_in {
725    pub unique: u64,
726}
727
728#[derive(Debug)]
729#[repr(C)]
730pub struct fuse_fallocate_in {
731    pub fh: u64,
732    pub offset: u64,
733    pub length: u64,
734    pub mode: u32,
735    pub padding: u32,
736}
737
738#[derive(Debug)]
739#[repr(C)]
740pub struct fuse_batch_forget_in {
741    pub count: u32,
742    pub dummy: u32,
743}
744
745#[derive(Debug)]
746#[repr(C)]
747pub struct fuse_forget_one {
748    pub nodeid: u64,
749    pub nlookup: u64,
750}
751
752#[derive(Debug)]
753#[repr(C)]
754pub struct fuse_rename2_in {
755    pub newdir: u64,
756    pub flags: u32,
757    pub padding: u32,
758}
759
760#[derive(Debug)]
761#[repr(C)]
762pub struct fuse_lseek_in {
763    pub fh: u64,
764    pub offset: u64,
765    pub whence: u32,
766    pub padding: u32,
767}
768
769#[derive(Debug, Default)]
770#[repr(C)]
771pub struct fuse_lseek_out {
772    pub offset: u64,
773}
774
775#[derive(Debug)]
776#[repr(C)]
777pub struct fuse_copy_file_range_in {
778    pub fh_in: u64,
779    pub off_in: u64,
780    pub nodeid_out: u64,
781    pub fh_out: u64,
782    pub off_out: u64,
783    pub len: u64,
784    pub flags: u64,
785}
786
787macro_rules! define_notify_code {
788    ($(
789        $(#[$m:meta])*
790        $VARIANT:ident = $val:expr,
791    )*) => {
792        $(
793            #[doc(hidden)]
794            pub const $VARIANT: u32 = $val;
795        )*
796
797        #[derive(Debug, Copy, Clone, PartialEq, Hash)]
798        #[repr(u32)]
799        pub enum fuse_notify_code {
800            $(
801                $(#[$m])*
802                $VARIANT = self::$VARIANT,
803            )*
804        }
805    };
806}
807
808define_notify_code! {
809    FUSE_NOTIFY_POLL = 1,
810    FUSE_NOTIFY_INVAL_INODE = 2,
811    FUSE_NOTIFY_INVAL_ENTRY = 3,
812    FUSE_NOTIFY_STORE = 4,
813    FUSE_NOTIFY_RETRIEVE = 5,
814    FUSE_NOTIFY_DELETE = 6,
815    FUSE_NOTIFY_CODE_MAX = 7,
816}
817
818#[derive(Debug, Default)]
819#[repr(C)]
820pub struct fuse_notify_poll_wakeup_out {
821    pub kh: u64,
822}
823
824#[derive(Debug, Default)]
825#[repr(C)]
826pub struct fuse_notify_inval_inode_out {
827    pub ino: u64,
828    pub off: i64,
829    pub len: i64,
830}
831
832#[derive(Debug, Default)]
833#[repr(C)]
834pub struct fuse_notify_inval_entry_out {
835    pub parent: u64,
836    pub namelen: u32,
837    pub padding: u32,
838}
839
840#[derive(Debug, Default)]
841#[repr(C)]
842pub struct fuse_notify_delete_out {
843    pub parent: u64,
844    pub child: u64,
845    pub namelen: u32,
846    pub padding: u32,
847}
848
849#[derive(Debug, Default)]
850#[repr(C)]
851pub struct fuse_notify_store_out {
852    pub nodeid: u64,
853    pub offset: u64,
854    pub size: u32,
855    pub padding: u32,
856}
857
858#[derive(Debug, Default)]
859#[repr(C)]
860pub struct fuse_notify_retrieve_out {
861    pub notify_unique: u64,
862    pub nodeid: u64,
863    pub offset: u64,
864    pub size: u32,
865    pub padding: u32,
866}
867
868#[derive(Debug)]
869#[repr(C)]
870pub struct fuse_notify_retrieve_in {
871    pub dummy1: u64,
872    pub offset: u64,
873    pub size: u32,
874    pub dummy2: u32,
875    pub dummy3: u64,
876    pub dummy4: u64,
877}
878
879#[derive(Debug)]
880#[repr(C)]
881pub struct cuse_init_in {
882    pub major: u32,
883    pub minor: u32,
884    pub unused: u32,
885    pub flags: u32,
886}
887
888#[derive(Debug)]
889#[repr(C)]
890pub struct cuse_init_out {
891    pub major: u32,
892    pub minor: u32,
893    pub unused: u32,
894    pub flags: u32,
895    pub max_read: u32,
896    pub max_write: u32,
897    pub dev_major: u32,
898    pub dev_minor: u32,
899    pub spare: [u32; 10],
900}