xref: /openbmc/linux/fs/notify/fanotify/fanotify.h (revision afc98d90)
1 #include <linux/fsnotify_backend.h>
2 #include <linux/path.h>
3 #include <linux/slab.h>
4 
5 extern struct kmem_cache *fanotify_event_cachep;
6 
7 /*
8  * Lifetime of the structure differs for normal and permission events. In both
9  * cases the structure is allocated in fanotify_handle_event(). For normal
10  * events the structure is freed immediately after reporting it to userspace.
11  * For permission events we free it only after we receive response from
12  * userspace.
13  */
14 struct fanotify_event_info {
15 	struct fsnotify_event fse;
16 	/*
17 	 * We hold ref to this path so it may be dereferenced at any point
18 	 * during this object's lifetime
19 	 */
20 	struct path path;
21 	struct pid *tgid;
22 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
23 	u32 response;	/* userspace answer to question */
24 #endif
25 };
26 
27 static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse)
28 {
29 	return container_of(fse, struct fanotify_event_info, fse);
30 }
31