diff options
Diffstat (limited to 'fs/notify/fanotify/fanotify.h')
| -rw-r--r-- | fs/notify/fanotify/fanotify.h | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h index 32a2f034fb94..2a5fb14115df 100644 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h | |||
| @@ -3,13 +3,12 @@ | |||
| 3 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
| 4 | 4 | ||
| 5 | extern struct kmem_cache *fanotify_event_cachep; | 5 | extern struct kmem_cache *fanotify_event_cachep; |
| 6 | extern struct kmem_cache *fanotify_perm_event_cachep; | ||
| 6 | 7 | ||
| 7 | /* | 8 | /* |
| 8 | * Lifetime of the structure differs for normal and permission events. In both | 9 | * Structure for normal fanotify events. It gets allocated in |
| 9 | * cases the structure is allocated in fanotify_handle_event(). For normal | 10 | * fanotify_handle_event() and freed when the information is retrieved by |
| 10 | * events the structure is freed immediately after reporting it to userspace. | 11 | * userspace |
| 11 | * For permission events we free it only after we receive response from | ||
| 12 | * userspace. | ||
| 13 | */ | 12 | */ |
| 14 | struct fanotify_event_info { | 13 | struct fanotify_event_info { |
| 15 | struct fsnotify_event fse; | 14 | struct fsnotify_event fse; |
| @@ -19,12 +18,33 @@ struct fanotify_event_info { | |||
| 19 | */ | 18 | */ |
| 20 | struct path path; | 19 | struct path path; |
| 21 | struct pid *tgid; | 20 | struct pid *tgid; |
| 21 | }; | ||
| 22 | |||
| 22 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 23 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
| 23 | u32 response; /* userspace answer to question */ | 24 | /* |
| 24 | #endif | 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 | */ | ||
| 31 | struct 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 */ | ||
| 25 | }; | 35 | }; |
| 26 | 36 | ||
| 37 | static inline struct fanotify_perm_event_info * | ||
| 38 | FANOTIFY_PE(struct fsnotify_event *fse) | ||
| 39 | { | ||
| 40 | return container_of(fse, struct fanotify_perm_event_info, fae.fse); | ||
| 41 | } | ||
| 42 | #endif | ||
| 43 | |||
| 27 | static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse) | 44 | static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse) |
| 28 | { | 45 | { |
| 29 | return container_of(fse, struct fanotify_event_info, fse); | 46 | return container_of(fse, struct fanotify_event_info, fse); |
| 30 | } | 47 | } |
| 48 | |||
| 49 | struct fanotify_event_info *fanotify_alloc_event(struct inode *inode, u32 mask, | ||
| 50 | struct path *path); | ||
