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*36f10f55SAmir Goldstein static inline struct inode *fsnotify_conn_inode( 13*36f10f55SAmir Goldstein struct fsnotify_mark_connector *conn) 14b812a9f5SAmir Goldstein { 15*36f10f55SAmir Goldstein return container_of(conn->obj, struct inode, i_fsnotify_marks); 16b812a9f5SAmir Goldstein } 17b812a9f5SAmir Goldstein 18*36f10f55SAmir Goldstein static inline struct mount *fsnotify_conn_mount( 19*36f10f55SAmir Goldstein struct fsnotify_mark_connector *conn) 20b812a9f5SAmir Goldstein { 21*36f10f55SAmir Goldstein return container_of(conn->obj, struct mount, mnt_fsnotify_marks); 22b812a9f5SAmir Goldstein } 23b812a9f5SAmir Goldstein 24a2d8bc6cSEric Paris /* destroy all events sitting in this groups notification queue */ 25a2d8bc6cSEric Paris extern void fsnotify_flush_notify(struct fsnotify_group *group); 26a2d8bc6cSEric Paris 2775c1be48SEric Paris /* protects reads of inode and vfsmount marks list */ 2875c1be48SEric Paris extern struct srcu_struct fsnotify_mark_srcu; 2975c1be48SEric Paris 308edc6e16SJan Kara /* compare two groups for sorting of marks lists */ 318edc6e16SJan Kara extern int fsnotify_compare_groups(struct fsnotify_group *a, 328edc6e16SJan Kara struct fsnotify_group *b); 338edc6e16SJan Kara 349b6e5434SAmir Goldstein /* Destroy all marks attached to an object via connector */ 359b6e5434SAmir Goldstein extern void fsnotify_destroy_marks(fsnotify_connp_t *connp); 36925d1132SJan Kara /* run the list of all marks associated with inode and destroy them */ 37925d1132SJan Kara static inline void fsnotify_clear_marks_by_inode(struct inode *inode) 38925d1132SJan Kara { 3908991e83SJan Kara fsnotify_destroy_marks(&inode->i_fsnotify_marks); 40925d1132SJan Kara } 41925d1132SJan Kara /* run the list of all marks associated with vfsmount and destroy them */ 42925d1132SJan Kara static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) 43925d1132SJan Kara { 4408991e83SJan Kara fsnotify_destroy_marks(&real_mount(mnt)->mnt_fsnotify_marks); 45925d1132SJan Kara } 46f09b04a0SJan Kara /* Wait until all marks queued for destruction are destroyed */ 47f09b04a0SJan Kara extern void fsnotify_wait_marks_destroyed(void); 4835e48176SJan Kara 49c28f7e56SEric Paris /* 50c28f7e56SEric Paris * update the dentry->d_flags of all of inode's children to indicate if inode cares 51c28f7e56SEric Paris * about events that happen to its children. 52c28f7e56SEric Paris */ 53c28f7e56SEric Paris extern void __fsnotify_update_child_dentry_flags(struct inode *inode); 54a2d8bc6cSEric Paris 55a2d8bc6cSEric Paris /* allocate and destroy and event holder to attach events to notification/access queues */ 56a2d8bc6cSEric Paris extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void); 57a2d8bc6cSEric Paris extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder); 58a2d8bc6cSEric Paris 5990586523SEric Paris #endif /* __FS_NOTIFY_FSNOTIFY_H_ */ 60