Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Eric Paris | ff0b16a | 2009-12-17 21:24:25 -0500 | [diff] [blame] | 2 | #ifndef _LINUX_FANOTIFY_H |
| 3 | #define _LINUX_FANOTIFY_H |
| 4 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 5 | #include <uapi/linux/fanotify.h> |
Eric Paris | ff0b16a | 2009-12-17 21:24:25 -0500 | [diff] [blame] | 6 | |
Amir Goldstein | 96a71f2 | 2018-09-21 21:20:30 +0300 | [diff] [blame] | 7 | #define FAN_GROUP_FLAG(group, flag) \ |
| 8 | ((group)->fanotify_data.flags & (flag)) |
| 9 | |
Amir Goldstein | 23c9dee | 2018-10-04 00:25:35 +0300 | [diff] [blame] | 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_INIT_FLAGS (FANOTIFY_CLASS_BITS | \ |
Amir Goldstein | d0a6a87 | 2018-10-04 00:25:38 +0300 | [diff] [blame] | 22 | FAN_REPORT_TID | \ |
Amir Goldstein | 23c9dee | 2018-10-04 00:25:35 +0300 | [diff] [blame] | 23 | FAN_CLOEXEC | FAN_NONBLOCK | \ |
| 24 | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS) |
| 25 | |
| 26 | #define FANOTIFY_MARK_TYPE_BITS (FAN_MARK_INODE | FAN_MARK_MOUNT | \ |
| 27 | FAN_MARK_FILESYSTEM) |
| 28 | |
| 29 | #define FANOTIFY_MARK_FLAGS (FANOTIFY_MARK_TYPE_BITS | \ |
| 30 | FAN_MARK_ADD | \ |
| 31 | FAN_MARK_REMOVE | \ |
| 32 | FAN_MARK_DONT_FOLLOW | \ |
| 33 | FAN_MARK_ONLYDIR | \ |
| 34 | FAN_MARK_IGNORED_MASK | \ |
| 35 | FAN_MARK_IGNORED_SURV_MODIFY | \ |
| 36 | FAN_MARK_FLUSH) |
| 37 | |
| 38 | /* Events that user can request to be notified on */ |
| 39 | #define FANOTIFY_EVENTS (FAN_ACCESS | FAN_MODIFY | \ |
Matthew Bobrowski | 9b076f1 | 2018-11-08 14:07:14 +1100 | [diff] [blame] | 40 | FAN_CLOSE | FAN_OPEN | FAN_OPEN_EXEC) |
Amir Goldstein | 23c9dee | 2018-10-04 00:25:35 +0300 | [diff] [blame] | 41 | |
| 42 | /* Events that require a permission response from user */ |
Matthew Bobrowski | 66917a3 | 2018-11-08 14:12:44 +1100 | [diff] [blame] | 43 | #define FANOTIFY_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM | \ |
| 44 | FAN_OPEN_EXEC_PERM) |
Amir Goldstein | 23c9dee | 2018-10-04 00:25:35 +0300 | [diff] [blame] | 45 | |
Amir Goldstein | bdd5a46 | 2018-10-04 00:25:37 +0300 | [diff] [blame] | 46 | /* Extra flags that may be reported with event or control handling of events */ |
| 47 | #define FANOTIFY_EVENT_FLAGS (FAN_EVENT_ON_CHILD | FAN_ONDIR) |
| 48 | |
Amir Goldstein | 23c9dee | 2018-10-04 00:25:35 +0300 | [diff] [blame] | 49 | /* Events that may be reported to user */ |
| 50 | #define FANOTIFY_OUTGOING_EVENTS (FANOTIFY_EVENTS | \ |
| 51 | FANOTIFY_PERM_EVENTS | \ |
| 52 | FAN_Q_OVERFLOW) |
| 53 | |
Amir Goldstein | bdd5a46 | 2018-10-04 00:25:37 +0300 | [diff] [blame] | 54 | #define ALL_FANOTIFY_EVENT_BITS (FANOTIFY_OUTGOING_EVENTS | \ |
| 55 | FANOTIFY_EVENT_FLAGS) |
| 56 | |
Amir Goldstein | 23c9dee | 2018-10-04 00:25:35 +0300 | [diff] [blame] | 57 | /* Do not use these old uapi constants internally */ |
| 58 | #undef FAN_ALL_CLASS_BITS |
| 59 | #undef FAN_ALL_INIT_FLAGS |
| 60 | #undef FAN_ALL_MARK_FLAGS |
| 61 | #undef FAN_ALL_EVENTS |
| 62 | #undef FAN_ALL_PERM_EVENTS |
| 63 | #undef FAN_ALL_OUTGOING_EVENTS |
| 64 | |
Eric Paris | ff0b16a | 2009-12-17 21:24:25 -0500 | [diff] [blame] | 65 | #endif /* _LINUX_FANOTIFY_H */ |