blob: caf55c67fc6c381c45e7e47de10695560d388aba [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Eric Parisff0b16a2009-12-17 21:24:25 -05002#ifndef _LINUX_FANOTIFY_H
3#define _LINUX_FANOTIFY_H
4
David Howells607ca462012-10-13 10:46:48 +01005#include <uapi/linux/fanotify.h>
Eric Parisff0b16a2009-12-17 21:24:25 -05006
Amir Goldstein96a71f22018-09-21 21:20:30 +03007#define FAN_GROUP_FLAG(group, flag) \
8 ((group)->fanotify_data.flags & (flag))
9
Amir Goldstein23c9dee2018-10-04 00:25:35 +030010/*
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 | \
22 FAN_CLOEXEC | FAN_NONBLOCK | \
23 FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
24
25#define FANOTIFY_MARK_TYPE_BITS (FAN_MARK_INODE | FAN_MARK_MOUNT | \
26 FAN_MARK_FILESYSTEM)
27
28#define FANOTIFY_MARK_FLAGS (FANOTIFY_MARK_TYPE_BITS | \
29 FAN_MARK_ADD | \
30 FAN_MARK_REMOVE | \
31 FAN_MARK_DONT_FOLLOW | \
32 FAN_MARK_ONLYDIR | \
33 FAN_MARK_IGNORED_MASK | \
34 FAN_MARK_IGNORED_SURV_MODIFY | \
35 FAN_MARK_FLUSH)
36
37/* Events that user can request to be notified on */
38#define FANOTIFY_EVENTS (FAN_ACCESS | FAN_MODIFY | \
39 FAN_CLOSE | FAN_OPEN)
40
41/* Events that require a permission response from user */
42#define FANOTIFY_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
43
Amir Goldsteinbdd5a462018-10-04 00:25:37 +030044/* Extra flags that may be reported with event or control handling of events */
45#define FANOTIFY_EVENT_FLAGS (FAN_EVENT_ON_CHILD | FAN_ONDIR)
46
Amir Goldstein23c9dee2018-10-04 00:25:35 +030047/* Events that may be reported to user */
48#define FANOTIFY_OUTGOING_EVENTS (FANOTIFY_EVENTS | \
49 FANOTIFY_PERM_EVENTS | \
50 FAN_Q_OVERFLOW)
51
Amir Goldsteinbdd5a462018-10-04 00:25:37 +030052#define ALL_FANOTIFY_EVENT_BITS (FANOTIFY_OUTGOING_EVENTS | \
53 FANOTIFY_EVENT_FLAGS)
54
Amir Goldstein23c9dee2018-10-04 00:25:35 +030055/* Do not use these old uapi constants internally */
56#undef FAN_ALL_CLASS_BITS
57#undef FAN_ALL_INIT_FLAGS
58#undef FAN_ALL_MARK_FLAGS
59#undef FAN_ALL_EVENTS
60#undef FAN_ALL_PERM_EVENTS
61#undef FAN_ALL_OUTGOING_EVENTS
62
Eric Parisff0b16a2009-12-17 21:24:25 -050063#endif /* _LINUX_FANOTIFY_H */