Linux Audio

Check our new training course

Linux BSP development engineering services

Need help to port Linux and bootloaders to your hardware?
Loading...
v4.17
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#include <linux/fsnotify_backend.h>
 3#include <linux/path.h>
 4#include <linux/slab.h>
 5
 6extern struct kmem_cache *fanotify_mark_cache;
 7extern struct kmem_cache *fanotify_event_cachep;
 8extern struct kmem_cache *fanotify_perm_event_cachep;
 9
10/*
11 * Structure for normal fanotify events. It gets allocated in
12 * fanotify_handle_event() and freed when the information is retrieved by
13 * userspace
14 */
15struct fanotify_event_info {
16	struct fsnotify_event fse;
17	/*
18	 * We hold ref to this path so it may be dereferenced at any point
19	 * during this object's lifetime
20	 */
21	struct path path;
22	struct pid *tgid;
23};
24
 
25/*
26 * Structure for permission fanotify events. It gets allocated and freed in
27 * fanotify_handle_event() since we wait there for user response. When the
28 * information is retrieved by userspace the structure is moved from
29 * group->notification_list to group->fanotify_data.access_list to wait for
30 * user response.
31 */
32struct fanotify_perm_event_info {
33	struct fanotify_event_info fae;
34	int response;	/* userspace answer to question */
35	int fd;		/* fd we passed to userspace for this event */
36};
37
38static inline struct fanotify_perm_event_info *
39FANOTIFY_PE(struct fsnotify_event *fse)
40{
41	return container_of(fse, struct fanotify_perm_event_info, fae.fse);
42}
43
44static inline bool fanotify_is_perm_event(u32 mask)
45{
46	return IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS) &&
47		mask & FAN_ALL_PERM_EVENTS;
48}
49
50static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse)
51{
52	return container_of(fse, struct fanotify_event_info, fse);
53}
54
55struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
56						 struct inode *inode, u32 mask,
57						 const struct path *path);
v4.10.11
 
 1#include <linux/fsnotify_backend.h>
 2#include <linux/path.h>
 3#include <linux/slab.h>
 4
 
 5extern struct kmem_cache *fanotify_event_cachep;
 6extern struct kmem_cache *fanotify_perm_event_cachep;
 7
 8/*
 9 * Structure for normal fanotify events. It gets allocated in
10 * fanotify_handle_event() and freed when the information is retrieved by
11 * userspace
12 */
13struct fanotify_event_info {
14	struct fsnotify_event fse;
15	/*
16	 * We hold ref to this path so it may be dereferenced at any point
17	 * during this object's lifetime
18	 */
19	struct path path;
20	struct pid *tgid;
21};
22
23#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
24/*
25 * Structure for permission fanotify events. It gets allocated and freed in
26 * fanotify_handle_event() since we wait there for user response. When the
27 * information is retrieved by userspace the structure is moved from
28 * group->notification_list to group->fanotify_data.access_list to wait for
29 * user response.
30 */
31struct fanotify_perm_event_info {
32	struct fanotify_event_info fae;
33	int response;	/* userspace answer to question */
34	int fd;		/* fd we passed to userspace for this event */
35};
36
37static inline struct fanotify_perm_event_info *
38FANOTIFY_PE(struct fsnotify_event *fse)
39{
40	return container_of(fse, struct fanotify_perm_event_info, fae.fse);
41}
42#endif
 
 
 
 
 
43
44static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse)
45{
46	return container_of(fse, struct fanotify_event_info, fse);
47}
48
49struct fanotify_event_info *fanotify_alloc_event(struct inode *inode, u32 mask,
 
50						 const struct path *path);