Eric Paris | 63c882a | 2009-05-21 17:02:01 -0400 | [diff] [blame] | 1 | #include <linux/fsnotify_backend.h> |
| 2 | #include <linux/inotify.h> |
| 3 | #include <linux/slab.h> /* struct kmem_cache */ |
| 4 | |
Jan Kara | 7053aee | 2014-01-21 15:48:14 -0800 | [diff] [blame] | 5 | struct inotify_event_info { |
| 6 | struct fsnotify_event fse; |
Eric Paris | 63c882a | 2009-05-21 17:02:01 -0400 | [diff] [blame] | 7 | int wd; |
Jan Kara | 7053aee | 2014-01-21 15:48:14 -0800 | [diff] [blame] | 8 | u32 sync_cookie; |
| 9 | int name_len; |
| 10 | char name[]; |
Eric Paris | 63c882a | 2009-05-21 17:02:01 -0400 | [diff] [blame] | 11 | }; |
| 12 | |
Eric Paris | 000285d | 2009-12-17 21:24:24 -0500 | [diff] [blame] | 13 | struct inotify_inode_mark { |
| 14 | struct fsnotify_mark fsn_mark; |
Eric Paris | 63c882a | 2009-05-21 17:02:01 -0400 | [diff] [blame] | 15 | int wd; |
| 16 | }; |
| 17 | |
Jan Kara | 7053aee | 2014-01-21 15:48:14 -0800 | [diff] [blame] | 18 | static inline struct inotify_event_info *INOTIFY_E(struct fsnotify_event *fse) |
| 19 | { |
| 20 | return container_of(fse, struct inotify_event_info, fse); |
| 21 | } |
| 22 | |
Eric Paris | 000285d | 2009-12-17 21:24:24 -0500 | [diff] [blame] | 23 | extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, |
Eric Paris | 528da3e | 2009-06-12 16:04:26 -0400 | [diff] [blame] | 24 | struct fsnotify_group *group); |
Jan Kara | 7053aee | 2014-01-21 15:48:14 -0800 | [diff] [blame] | 25 | extern int inotify_handle_event(struct fsnotify_group *group, |
| 26 | struct inode *inode, |
| 27 | struct fsnotify_mark *inode_mark, |
| 28 | struct fsnotify_mark *vfsmount_mark, |
Al Viro | 3cd5eca | 2016-11-20 20:19:09 -0500 | [diff] [blame] | 29 | u32 mask, const void *data, int data_type, |
Jan Kara | 45a22f4 | 2014-02-17 13:09:50 +0100 | [diff] [blame] | 30 | const unsigned char *file_name, u32 cookie); |
Eric Paris | 63c882a | 2009-05-21 17:02:01 -0400 | [diff] [blame] | 31 | |
| 32 | extern const struct fsnotify_ops inotify_fsnotify_ops; |
Nikolay Borisov | 1cce1ee | 2016-12-14 15:56:33 +0200 | [diff] [blame] | 33 | |
| 34 | #ifdef CONFIG_INOTIFY_USER |
| 35 | static inline void dec_inotify_instances(struct ucounts *ucounts) |
| 36 | { |
| 37 | dec_ucount(ucounts, UCOUNT_INOTIFY_INSTANCES); |
| 38 | } |
| 39 | |
| 40 | static inline struct ucounts *inc_inotify_watches(struct ucounts *ucounts) |
| 41 | { |
| 42 | return inc_ucount(ucounts->ns, ucounts->uid, UCOUNT_INOTIFY_WATCHES); |
| 43 | } |
| 44 | |
| 45 | static inline void dec_inotify_watches(struct ucounts *ucounts) |
| 46 | { |
| 47 | dec_ucount(ucounts, UCOUNT_INOTIFY_WATCHES); |
| 48 | } |
| 49 | #endif |