starnix_uapi/
inotify_mask.rs1use crate::uapi;
6use bitflags::bitflags;
7
8bitflags! {
9 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10 pub struct InotifyMask: u32 {
11 const ACCESS = uapi::IN_ACCESS;
13 const MODIFY = uapi::IN_MODIFY;
14 const ATTRIB = uapi::IN_ATTRIB;
15 const CLOSE_WRITE = uapi::IN_CLOSE_WRITE;
16 const CLOSE_NOWRITE = uapi::IN_CLOSE_NOWRITE;
17 const OPEN = uapi::IN_OPEN;
18 const MOVE_FROM = uapi::IN_MOVED_FROM;
19 const MOVE_TO = uapi::IN_MOVED_TO;
20 const CREATE = uapi::IN_CREATE;
21 const DELETE = uapi::IN_DELETE;
22 const DELETE_SELF = uapi::IN_DELETE_SELF;
23 const MOVE_SELF = uapi::IN_MOVE_SELF;
24
25 const UNMOUNT = uapi::IN_UNMOUNT;
27 const Q_OVERFLOW = uapi::IN_Q_OVERFLOW;
28 const IGNORED = uapi::IN_IGNORED;
29
30 const CLOSE = uapi::IN_CLOSE;
32 const MOVE = uapi::IN_MOVE;
33 const ALL_EVENTS = uapi::IN_ALL_EVENTS;
34
35 const ONLYDIR = uapi::IN_ONLYDIR;
36 const DONT_FOLLOW = uapi::IN_DONT_FOLLOW;
37 const EXCL_UNLINK = uapi::IN_EXCL_UNLINK;
38 const MASK_CREATE = uapi::IN_MASK_CREATE;
39 const MASK_ADD = uapi::IN_MASK_ADD;
40 const ISDIR = uapi::IN_ISDIR;
41 const ONESHOT = uapi::IN_ONESHOT;
42 const CLOEXEC = uapi::IN_CLOEXEC;
43 const NONBLOCK = uapi::IN_NONBLOCK;
44 }
45}
46
47#[cfg(test)]
48mod tests {
49 use super::*;
50
51 #[::fuchsia::test]
52 fn multi_bit_flags() {
53 assert_eq!(InotifyMask::CLOSE, InotifyMask::CLOSE_WRITE | InotifyMask::CLOSE_NOWRITE);
54 assert_eq!(InotifyMask::MOVE, InotifyMask::MOVE_FROM | InotifyMask::MOVE_TO);
55 assert_eq!(
56 InotifyMask::ALL_EVENTS,
57 InotifyMask::ACCESS
58 | InotifyMask::MODIFY
59 | InotifyMask::ATTRIB
60 | InotifyMask::CLOSE_WRITE
61 | InotifyMask::CLOSE_NOWRITE
62 | InotifyMask::OPEN
63 | InotifyMask::MOVE_FROM
64 | InotifyMask::MOVE_TO
65 | InotifyMask::CREATE
66 | InotifyMask::DELETE
67 | InotifyMask::DELETE_SELF
68 | InotifyMask::MOVE_SELF
69 );
70 }
71}