xref: /openbmc/linux/fs/notify/fsnotify.h (revision 75c1be487a690db43da2c1234fcacd84c982803c)
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 
919c2a0e1SEric Paris /* all groups which receive inode fsnotify events */
1019c2a0e1SEric Paris extern struct list_head fsnotify_inode_groups;
117131485aSEric Paris /* all groups which receive vfsmount fsnotify events */
127131485aSEric Paris extern struct list_head fsnotify_vfsmount_groups;
1319c2a0e1SEric Paris /* all bitwise OR of all event types (FS_*) for all fsnotify_inode_groups */
1419c2a0e1SEric Paris extern __u32 fsnotify_inode_mask;
157131485aSEric Paris /* all bitwise OR of all event types (FS_*) for all fsnotify_vfsmount_groups */
167131485aSEric Paris extern __u32 fsnotify_vfsmount_mask;
173be25f49SEric Paris 
18a2d8bc6cSEric Paris /* destroy all events sitting in this groups notification queue */
19a2d8bc6cSEric Paris extern void fsnotify_flush_notify(struct fsnotify_group *group);
20a2d8bc6cSEric Paris 
21*75c1be48SEric Paris /* protects reads of inode and vfsmount marks list */
22*75c1be48SEric Paris extern struct srcu_struct fsnotify_mark_srcu;
23*75c1be48SEric Paris 
2490b1e7a5SEric Paris extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark,
2590b1e7a5SEric Paris 						__u32 mask);
265444e298SEric Paris /* add a mark to an inode */
275444e298SEric Paris extern int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
285444e298SEric Paris 				   struct fsnotify_group *group, struct inode *inode,
295444e298SEric Paris 				   int allow_dups);
300d48b7f0SEric Paris /* add a mark to a vfsmount */
310d48b7f0SEric Paris extern int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
320d48b7f0SEric Paris 				      struct fsnotify_group *group, struct vfsmount *mnt,
330d48b7f0SEric Paris 				      int allow_dups);
345444e298SEric Paris 
354ca76352SEric Paris /* add a group to the inode group list */
364ca76352SEric Paris extern void fsnotify_add_inode_group(struct fsnotify_group *group);
377131485aSEric Paris /* add a group to the vfsmount group list */
387131485aSEric Paris extern void fsnotify_add_vfsmount_group(struct fsnotify_group *group);
393be25f49SEric Paris /* final kfree of a group */
403be25f49SEric Paris extern void fsnotify_final_destroy_group(struct fsnotify_group *group);
41a2d8bc6cSEric Paris 
420d48b7f0SEric Paris /* vfsmount specific destruction of a mark */
430d48b7f0SEric Paris extern void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark);
445444e298SEric Paris /* inode specific destruction of a mark */
455444e298SEric Paris extern void fsnotify_destroy_inode_mark(struct fsnotify_mark *mark);
463be25f49SEric Paris /* run the list of all marks associated with inode and flag them to be freed */
473be25f49SEric Paris extern void fsnotify_clear_marks_by_inode(struct inode *inode);
48ca9c726eSAndreas Gruenbacher /* run the list of all marks associated with vfsmount and flag them to be freed */
49ca9c726eSAndreas Gruenbacher extern void fsnotify_clear_marks_by_mount(struct vfsmount *mnt);
50c28f7e56SEric Paris /*
51c28f7e56SEric Paris  * update the dentry->d_flags of all of inode's children to indicate if inode cares
52c28f7e56SEric Paris  * about events that happen to its children.
53c28f7e56SEric Paris  */
54c28f7e56SEric Paris extern void __fsnotify_update_child_dentry_flags(struct inode *inode);
55a2d8bc6cSEric Paris 
56a2d8bc6cSEric Paris /* allocate and destroy and event holder to attach events to notification/access queues */
57a2d8bc6cSEric Paris extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void);
58a2d8bc6cSEric Paris extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder);
59a2d8bc6cSEric Paris 
6090586523SEric Paris #endif	/* __FS_NOTIFY_FSNOTIFY_H_ */
61