xref: /openbmc/linux/fs/notify/fsnotify.h (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg 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 
12abc77577SJan Kara struct fsnotify_iter_info {
13abc77577SJan Kara 	struct fsnotify_mark *inode_mark;
14abc77577SJan Kara 	struct fsnotify_mark *vfsmount_mark;
15abc77577SJan Kara 	int srcu_idx;
16abc77577SJan Kara };
17abc77577SJan Kara 
18a2d8bc6cSEric Paris /* destroy all events sitting in this groups notification queue */
19a2d8bc6cSEric Paris extern void fsnotify_flush_notify(struct fsnotify_group *group);
20a2d8bc6cSEric Paris 
2175c1be48SEric Paris /* protects reads of inode and vfsmount marks list */
2275c1be48SEric Paris extern struct srcu_struct fsnotify_mark_srcu;
2375c1be48SEric Paris 
248edc6e16SJan Kara /* compare two groups for sorting of marks lists */
258edc6e16SJan Kara extern int fsnotify_compare_groups(struct fsnotify_group *a,
268edc6e16SJan Kara 				   struct fsnotify_group *b);
278edc6e16SJan Kara 
28a03e2e4fSJan Kara /* Destroy all marks connected via given connector */
2908991e83SJan Kara extern void fsnotify_destroy_marks(struct fsnotify_mark_connector __rcu **connp);
30925d1132SJan Kara /* run the list of all marks associated with inode and destroy them */
31925d1132SJan Kara static inline void fsnotify_clear_marks_by_inode(struct inode *inode)
32925d1132SJan Kara {
3308991e83SJan Kara 	fsnotify_destroy_marks(&inode->i_fsnotify_marks);
34925d1132SJan Kara }
35925d1132SJan Kara /* run the list of all marks associated with vfsmount and destroy them */
36925d1132SJan Kara static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
37925d1132SJan Kara {
3808991e83SJan Kara 	fsnotify_destroy_marks(&real_mount(mnt)->mnt_fsnotify_marks);
39925d1132SJan Kara }
40f09b04a0SJan Kara /* Wait until all marks queued for destruction are destroyed */
41f09b04a0SJan Kara extern void fsnotify_wait_marks_destroyed(void);
4235e48176SJan Kara 
43c28f7e56SEric Paris /*
44c28f7e56SEric Paris  * update the dentry->d_flags of all of inode's children to indicate if inode cares
45c28f7e56SEric Paris  * about events that happen to its children.
46c28f7e56SEric Paris  */
47c28f7e56SEric Paris extern void __fsnotify_update_child_dentry_flags(struct inode *inode);
48a2d8bc6cSEric Paris 
49a2d8bc6cSEric Paris /* allocate and destroy and event holder to attach events to notification/access queues */
50a2d8bc6cSEric Paris extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void);
51a2d8bc6cSEric Paris extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder);
52a2d8bc6cSEric Paris 
5390586523SEric Paris #endif	/* __FS_NOTIFY_FSNOTIFY_H_ */
54