]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - include/linux/fanotify.h
bpf: Fix mask direction swap upon off reg sign change
[mirror_ubuntu-hirsute-kernel.git] / include / linux / fanotify.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_FANOTIFY_H
3 #define _LINUX_FANOTIFY_H
4
5 #include <uapi/linux/fanotify.h>
6
7 #define FAN_GROUP_FLAG(group, flag) \
8 ((group)->fanotify_data.flags & (flag))
9
10 /*
11 * Flags allowed to be passed from/to userspace.
12 *
13 * We intentionally do not add new bits to the old FAN_ALL_* constants, because
14 * they are uapi exposed constants. If there are programs out there using
15 * these constant, the programs may break if re-compiled with new uapi headers
16 * and then run on an old kernel.
17 */
18 #define FANOTIFY_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
19 FAN_CLASS_PRE_CONTENT)
20
21 #define FANOTIFY_FID_BITS (FAN_REPORT_FID | FAN_REPORT_DFID_NAME)
22
23 #define FANOTIFY_INIT_FLAGS (FANOTIFY_CLASS_BITS | FANOTIFY_FID_BITS | \
24 FAN_REPORT_TID | \
25 FAN_CLOEXEC | FAN_NONBLOCK | \
26 FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
27
28 #define FANOTIFY_MARK_TYPE_BITS (FAN_MARK_INODE | FAN_MARK_MOUNT | \
29 FAN_MARK_FILESYSTEM)
30
31 #define FANOTIFY_MARK_FLAGS (FANOTIFY_MARK_TYPE_BITS | \
32 FAN_MARK_ADD | \
33 FAN_MARK_REMOVE | \
34 FAN_MARK_DONT_FOLLOW | \
35 FAN_MARK_ONLYDIR | \
36 FAN_MARK_IGNORED_MASK | \
37 FAN_MARK_IGNORED_SURV_MODIFY | \
38 FAN_MARK_FLUSH)
39
40 /*
41 * Events that can be reported with data type FSNOTIFY_EVENT_PATH.
42 * Note that FAN_MODIFY can also be reported with data type
43 * FSNOTIFY_EVENT_INODE.
44 */
45 #define FANOTIFY_PATH_EVENTS (FAN_ACCESS | FAN_MODIFY | \
46 FAN_CLOSE | FAN_OPEN | FAN_OPEN_EXEC)
47
48 /*
49 * Directory entry modification events - reported only to directory
50 * where entry is modified and not to a watching parent.
51 */
52 #define FANOTIFY_DIRENT_EVENTS (FAN_MOVE | FAN_CREATE | FAN_DELETE)
53
54 /* Events that can only be reported with data type FSNOTIFY_EVENT_INODE */
55 #define FANOTIFY_INODE_EVENTS (FANOTIFY_DIRENT_EVENTS | \
56 FAN_ATTRIB | FAN_MOVE_SELF | FAN_DELETE_SELF)
57
58 /* Events that user can request to be notified on */
59 #define FANOTIFY_EVENTS (FANOTIFY_PATH_EVENTS | \
60 FANOTIFY_INODE_EVENTS)
61
62 /* Events that require a permission response from user */
63 #define FANOTIFY_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM | \
64 FAN_OPEN_EXEC_PERM)
65
66 /* Extra flags that may be reported with event or control handling of events */
67 #define FANOTIFY_EVENT_FLAGS (FAN_EVENT_ON_CHILD | FAN_ONDIR)
68
69 /* Events that may be reported to user */
70 #define FANOTIFY_OUTGOING_EVENTS (FANOTIFY_EVENTS | \
71 FANOTIFY_PERM_EVENTS | \
72 FAN_Q_OVERFLOW | FAN_ONDIR)
73
74 #define ALL_FANOTIFY_EVENT_BITS (FANOTIFY_OUTGOING_EVENTS | \
75 FANOTIFY_EVENT_FLAGS)
76
77 /* Do not use these old uapi constants internally */
78 #undef FAN_ALL_CLASS_BITS
79 #undef FAN_ALL_INIT_FLAGS
80 #undef FAN_ALL_MARK_FLAGS
81 #undef FAN_ALL_EVENTS
82 #undef FAN_ALL_PERM_EVENTS
83 #undef FAN_ALL_OUTGOING_EVENTS
84
85 #endif /* _LINUX_FANOTIFY_H */