summaryrefslogtreecommitdiff
path: root/fs/notify/fanotify/fanotify.h
blob: 59c3331a0e81ad346643e5ef9c0beacfa97c53e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <linux/fanotify.h>
#include <linux/fsnotify_backend.h>
#include <linux/net.h>
#include <linux/kernel.h>
#include <linux/types.h>

extern const struct fsnotify_ops fanotify_fsnotify_ops;

static inline bool fanotify_mark_flags_valid(unsigned int flags)
{
	/* must be either and add or a remove */
	if (!(flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)))
		return false;

	/* cannot be both add and remove */
	if ((flags & FAN_MARK_ADD) &&
	    (flags & FAN_MARK_REMOVE))
		return false;

	/* cannot have more flags than we know about */
	if (flags & ~FAN_ALL_MARK_FLAGS)
		return false;

	return true;
}

static inline bool fanotify_mask_valid(__u32 mask)
{
	if (mask & ~((__u32)FAN_ALL_INCOMING_EVENTS))
		return false;
	return true;
}