190586523SEric Paris #ifndef __FS_NOTIFY_FSNOTIFY_H_ 290586523SEric Paris #define __FS_NOTIFY_FSNOTIFY_H_ 390586523SEric Paris 490586523SEric Paris #include <linux/list.h> 590586523SEric Paris #include <linux/fsnotify.h> 690586523SEric Paris #include <linux/srcu.h> 790586523SEric Paris #include <linux/types.h> 890586523SEric Paris 9*925d1132SJan Kara #include "../mount.h" 10*925d1132SJan Kara 11a2d8bc6cSEric Paris /* destroy all events sitting in this groups notification queue */ 12a2d8bc6cSEric Paris extern void fsnotify_flush_notify(struct fsnotify_group *group); 13a2d8bc6cSEric Paris 1475c1be48SEric Paris /* protects reads of inode and vfsmount marks list */ 1575c1be48SEric Paris extern struct srcu_struct fsnotify_mark_srcu; 1675c1be48SEric Paris 170809ab69SJan Kara /* Calculate mask of events for a list of marks */ 180809ab69SJan Kara extern u32 fsnotify_recalc_mask(struct hlist_head *head); 190809ab69SJan Kara 208edc6e16SJan Kara /* compare two groups for sorting of marks lists */ 218edc6e16SJan Kara extern int fsnotify_compare_groups(struct fsnotify_group *a, 228edc6e16SJan Kara struct fsnotify_group *b); 238edc6e16SJan Kara 2490b1e7a5SEric Paris extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark, 2590b1e7a5SEric Paris __u32 mask); 260809ab69SJan Kara /* Add mark to a proper place in mark list */ 270809ab69SJan Kara extern int fsnotify_add_mark_list(struct hlist_head *head, 280809ab69SJan Kara struct fsnotify_mark *mark, 290809ab69SJan Kara int allow_dups); 305444e298SEric Paris /* add a mark to an inode */ 315444e298SEric Paris extern int fsnotify_add_inode_mark(struct fsnotify_mark *mark, 325444e298SEric Paris struct fsnotify_group *group, struct inode *inode, 335444e298SEric Paris int allow_dups); 340d48b7f0SEric Paris /* add a mark to a vfsmount */ 350d48b7f0SEric Paris extern int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, 360d48b7f0SEric Paris struct fsnotify_group *group, struct vfsmount *mnt, 370d48b7f0SEric Paris int allow_dups); 385444e298SEric Paris 390d48b7f0SEric Paris /* vfsmount specific destruction of a mark */ 400d48b7f0SEric Paris extern void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark); 415444e298SEric Paris /* inode specific destruction of a mark */ 425444e298SEric Paris extern void fsnotify_destroy_inode_mark(struct fsnotify_mark *mark); 430809ab69SJan Kara /* Find mark belonging to given group in the list of marks */ 440809ab69SJan Kara extern struct fsnotify_mark *fsnotify_find_mark(struct hlist_head *head, 450809ab69SJan Kara struct fsnotify_group *group); 46*925d1132SJan Kara /* Destroy all marks in the given list protected by 'lock' */ 47*925d1132SJan Kara extern void fsnotify_destroy_marks(struct hlist_head *head, spinlock_t *lock); 48*925d1132SJan Kara /* run the list of all marks associated with inode and destroy them */ 49*925d1132SJan Kara static inline void fsnotify_clear_marks_by_inode(struct inode *inode) 50*925d1132SJan Kara { 51*925d1132SJan Kara fsnotify_destroy_marks(&inode->i_fsnotify_marks, &inode->i_lock); 52*925d1132SJan Kara } 53*925d1132SJan Kara /* run the list of all marks associated with vfsmount and destroy them */ 54*925d1132SJan Kara static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) 55*925d1132SJan Kara { 56*925d1132SJan Kara fsnotify_destroy_marks(&real_mount(mnt)->mnt_fsnotify_marks, 57*925d1132SJan Kara &mnt->mnt_root->d_lock); 58*925d1132SJan Kara } 59c28f7e56SEric Paris /* 60c28f7e56SEric Paris * update the dentry->d_flags of all of inode's children to indicate if inode cares 61c28f7e56SEric Paris * about events that happen to its children. 62c28f7e56SEric Paris */ 63c28f7e56SEric Paris extern void __fsnotify_update_child_dentry_flags(struct inode *inode); 64a2d8bc6cSEric Paris 65a2d8bc6cSEric Paris /* allocate and destroy and event holder to attach events to notification/access queues */ 66a2d8bc6cSEric Paris extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void); 67a2d8bc6cSEric Paris extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder); 68a2d8bc6cSEric Paris 6990586523SEric Paris #endif /* __FS_NOTIFY_FSNOTIFY_H_ */ 70