xref: /openbmc/linux/fs/notify/fsnotify.h (revision 9b6e543450dc03635899ba56b1c39cc593694560)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
290586523SEric Paris #ifndef __FS_NOTIFY_FSNOTIFY_H_
390586523SEric Paris #define __FS_NOTIFY_FSNOTIFY_H_
490586523SEric Paris 
590586523SEric Paris #include <linux/list.h>
690586523SEric Paris #include <linux/fsnotify.h>
790586523SEric Paris #include <linux/srcu.h>
890586523SEric Paris #include <linux/types.h>
990586523SEric Paris 
10925d1132SJan Kara #include "../mount.h"
11925d1132SJan Kara 
12a2d8bc6cSEric Paris /* destroy all events sitting in this groups notification queue */
13a2d8bc6cSEric Paris extern void fsnotify_flush_notify(struct fsnotify_group *group);
14a2d8bc6cSEric Paris 
1575c1be48SEric Paris /* protects reads of inode and vfsmount marks list */
1675c1be48SEric Paris extern struct srcu_struct fsnotify_mark_srcu;
1775c1be48SEric Paris 
188edc6e16SJan Kara /* compare two groups for sorting of marks lists */
198edc6e16SJan Kara extern int fsnotify_compare_groups(struct fsnotify_group *a,
208edc6e16SJan Kara 				   struct fsnotify_group *b);
218edc6e16SJan Kara 
22*9b6e5434SAmir Goldstein /* Destroy all marks attached to an object via connector */
23*9b6e5434SAmir Goldstein extern void fsnotify_destroy_marks(fsnotify_connp_t *connp);
24925d1132SJan Kara /* run the list of all marks associated with inode and destroy them */
25925d1132SJan Kara static inline void fsnotify_clear_marks_by_inode(struct inode *inode)
26925d1132SJan Kara {
2708991e83SJan Kara 	fsnotify_destroy_marks(&inode->i_fsnotify_marks);
28925d1132SJan Kara }
29925d1132SJan Kara /* run the list of all marks associated with vfsmount and destroy them */
30925d1132SJan Kara static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
31925d1132SJan Kara {
3208991e83SJan Kara 	fsnotify_destroy_marks(&real_mount(mnt)->mnt_fsnotify_marks);
33925d1132SJan Kara }
34f09b04a0SJan Kara /* Wait until all marks queued for destruction are destroyed */
35f09b04a0SJan Kara extern void fsnotify_wait_marks_destroyed(void);
3635e48176SJan Kara 
37c28f7e56SEric Paris /*
38c28f7e56SEric Paris  * update the dentry->d_flags of all of inode's children to indicate if inode cares
39c28f7e56SEric Paris  * about events that happen to its children.
40c28f7e56SEric Paris  */
41c28f7e56SEric Paris extern void __fsnotify_update_child_dentry_flags(struct inode *inode);
42a2d8bc6cSEric Paris 
43a2d8bc6cSEric Paris /* allocate and destroy and event holder to attach events to notification/access queues */
44a2d8bc6cSEric Paris extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void);
45a2d8bc6cSEric Paris extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder);
46a2d8bc6cSEric Paris 
4790586523SEric Paris #endif	/* __FS_NOTIFY_FSNOTIFY_H_ */
48