fsnotify.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef __FS_NOTIFY_FSNOTIFY_H_
  2. #define __FS_NOTIFY_FSNOTIFY_H_
  3. #include <linux/list.h>
  4. #include <linux/fsnotify.h>
  5. #include <linux/srcu.h>
  6. #include <linux/types.h>
  7. #include "../mount.h"
  8. /* destroy all events sitting in this groups notification queue */
  9. extern void fsnotify_flush_notify(struct fsnotify_group *group);
  10. /* protects reads of inode and vfsmount marks list */
  11. extern struct srcu_struct fsnotify_mark_srcu;
  12. /* Calculate mask of events for a list of marks */
  13. extern u32 fsnotify_recalc_mask(struct hlist_head *head);
  14. /* compare two groups for sorting of marks lists */
  15. extern int fsnotify_compare_groups(struct fsnotify_group *a,
  16. struct fsnotify_group *b);
  17. extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark,
  18. __u32 mask);
  19. /* Add mark to a proper place in mark list */
  20. extern int fsnotify_add_mark_list(struct hlist_head *head,
  21. struct fsnotify_mark *mark,
  22. int allow_dups);
  23. /* add a mark to an inode */
  24. extern int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
  25. struct fsnotify_group *group, struct inode *inode,
  26. int allow_dups);
  27. /* add a mark to a vfsmount */
  28. extern int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
  29. struct fsnotify_group *group, struct vfsmount *mnt,
  30. int allow_dups);
  31. /* vfsmount specific destruction of a mark */
  32. extern void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark);
  33. /* inode specific destruction of a mark */
  34. extern void fsnotify_destroy_inode_mark(struct fsnotify_mark *mark);
  35. /* Find mark belonging to given group in the list of marks */
  36. extern struct fsnotify_mark *fsnotify_find_mark(struct hlist_head *head,
  37. struct fsnotify_group *group);
  38. /* Destroy all marks in the given list protected by 'lock' */
  39. extern void fsnotify_destroy_marks(struct hlist_head *head, spinlock_t *lock);
  40. /* run the list of all marks associated with inode and destroy them */
  41. static inline void fsnotify_clear_marks_by_inode(struct inode *inode)
  42. {
  43. fsnotify_destroy_marks(&inode->i_fsnotify_marks, &inode->i_lock);
  44. }
  45. /* run the list of all marks associated with vfsmount and destroy them */
  46. static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
  47. {
  48. fsnotify_destroy_marks(&real_mount(mnt)->mnt_fsnotify_marks,
  49. &mnt->mnt_root->d_lock);
  50. }
  51. /*
  52. * update the dentry->d_flags of all of inode's children to indicate if inode cares
  53. * about events that happen to its children.
  54. */
  55. extern void __fsnotify_update_child_dentry_flags(struct inode *inode);
  56. /* allocate and destroy and event holder to attach events to notification/access queues */
  57. extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void);
  58. extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder);
  59. #endif /* __FS_NOTIFY_FSNOTIFY_H_ */