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 12*b812a9f5SAmir Goldstein static inline struct inode *fsnotify_obj_inode(fsnotify_connp_t *connp) 13*b812a9f5SAmir Goldstein { 14*b812a9f5SAmir Goldstein return container_of(connp, struct inode, i_fsnotify_marks); 15*b812a9f5SAmir Goldstein } 16*b812a9f5SAmir Goldstein 17*b812a9f5SAmir Goldstein static inline struct mount *fsnotify_obj_mount(fsnotify_connp_t *connp) 18*b812a9f5SAmir Goldstein { 19*b812a9f5SAmir Goldstein return container_of(connp, struct mount, mnt_fsnotify_marks); 20*b812a9f5SAmir Goldstein } 21*b812a9f5SAmir Goldstein 22a2d8bc6cSEric Paris /* destroy all events sitting in this groups notification queue */ 23a2d8bc6cSEric Paris extern void fsnotify_flush_notify(struct fsnotify_group *group); 24a2d8bc6cSEric Paris 2575c1be48SEric Paris /* protects reads of inode and vfsmount marks list */ 2675c1be48SEric Paris extern struct srcu_struct fsnotify_mark_srcu; 2775c1be48SEric Paris 288edc6e16SJan Kara /* compare two groups for sorting of marks lists */ 298edc6e16SJan Kara extern int fsnotify_compare_groups(struct fsnotify_group *a, 308edc6e16SJan Kara struct fsnotify_group *b); 318edc6e16SJan Kara 329b6e5434SAmir Goldstein /* Destroy all marks attached to an object via connector */ 339b6e5434SAmir Goldstein extern void fsnotify_destroy_marks(fsnotify_connp_t *connp); 34925d1132SJan Kara /* run the list of all marks associated with inode and destroy them */ 35925d1132SJan Kara static inline void fsnotify_clear_marks_by_inode(struct inode *inode) 36925d1132SJan Kara { 3708991e83SJan Kara fsnotify_destroy_marks(&inode->i_fsnotify_marks); 38925d1132SJan Kara } 39925d1132SJan Kara /* run the list of all marks associated with vfsmount and destroy them */ 40925d1132SJan Kara static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) 41925d1132SJan Kara { 4208991e83SJan Kara fsnotify_destroy_marks(&real_mount(mnt)->mnt_fsnotify_marks); 43925d1132SJan Kara } 44f09b04a0SJan Kara /* Wait until all marks queued for destruction are destroyed */ 45f09b04a0SJan Kara extern void fsnotify_wait_marks_destroyed(void); 4635e48176SJan Kara 47c28f7e56SEric Paris /* 48c28f7e56SEric Paris * update the dentry->d_flags of all of inode's children to indicate if inode cares 49c28f7e56SEric Paris * about events that happen to its children. 50c28f7e56SEric Paris */ 51c28f7e56SEric Paris extern void __fsnotify_update_child_dentry_flags(struct inode *inode); 52a2d8bc6cSEric Paris 53a2d8bc6cSEric Paris /* allocate and destroy and event holder to attach events to notification/access queues */ 54a2d8bc6cSEric Paris extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void); 55a2d8bc6cSEric Paris extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder); 56a2d8bc6cSEric Paris 5790586523SEric Paris #endif /* __FS_NOTIFY_FSNOTIFY_H_ */ 58