xref: /openbmc/linux/fs/notify/fsnotify.h (revision 08991e83b7286635167bab40927665a90fb00d81)
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 
9925d1132SJan Kara #include "../mount.h"
10925d1132SJan 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 
178edc6e16SJan Kara /* compare two groups for sorting of marks lists */
188edc6e16SJan Kara extern int fsnotify_compare_groups(struct fsnotify_group *a,
198edc6e16SJan Kara 				   struct fsnotify_group *b);
208edc6e16SJan Kara 
210809ab69SJan Kara /* Find mark belonging to given group in the list of marks */
229dd813c1SJan Kara extern struct fsnotify_mark *fsnotify_find_mark(
23*08991e83SJan Kara 				struct fsnotify_mark_connector __rcu **connp,
240809ab69SJan Kara 				struct fsnotify_group *group);
25a03e2e4fSJan Kara /* Destroy all marks connected via given connector */
26*08991e83SJan Kara extern void fsnotify_destroy_marks(struct fsnotify_mark_connector __rcu **connp);
27925d1132SJan Kara /* run the list of all marks associated with inode and destroy them */
28925d1132SJan Kara static inline void fsnotify_clear_marks_by_inode(struct inode *inode)
29925d1132SJan Kara {
30*08991e83SJan Kara 	fsnotify_destroy_marks(&inode->i_fsnotify_marks);
31925d1132SJan Kara }
32925d1132SJan Kara /* run the list of all marks associated with vfsmount and destroy them */
33925d1132SJan Kara static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
34925d1132SJan Kara {
35*08991e83SJan Kara 	fsnotify_destroy_marks(&real_mount(mnt)->mnt_fsnotify_marks);
36925d1132SJan Kara }
3735e48176SJan Kara /* prepare for freeing all marks associated with given group */
3835e48176SJan Kara extern void fsnotify_detach_group_marks(struct fsnotify_group *group);
3935e48176SJan Kara /*
4035e48176SJan Kara  * wait for fsnotify_mark_srcu period to end and free all marks in destroy_list
4135e48176SJan Kara  */
4235e48176SJan Kara extern void fsnotify_mark_destroy_list(void);
4335e48176SJan Kara 
44c28f7e56SEric Paris /*
45c28f7e56SEric Paris  * update the dentry->d_flags of all of inode's children to indicate if inode cares
46c28f7e56SEric Paris  * about events that happen to its children.
47c28f7e56SEric Paris  */
48c28f7e56SEric Paris extern void __fsnotify_update_child_dentry_flags(struct inode *inode);
49a2d8bc6cSEric Paris 
50a2d8bc6cSEric Paris /* allocate and destroy and event holder to attach events to notification/access queues */
51a2d8bc6cSEric Paris extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void);
52a2d8bc6cSEric Paris extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder);
53a2d8bc6cSEric Paris 
5490586523SEric Paris #endif	/* __FS_NOTIFY_FSNOTIFY_H_ */
55