fsnotify.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /* prepare for freeing all marks associated with given group */
  52. extern void fsnotify_detach_group_marks(struct fsnotify_group *group);
  53. /*
  54. * wait for fsnotify_mark_srcu period to end and free all marks in destroy_list
  55. */
  56. extern void fsnotify_mark_destroy_list(void);
  57. /*
  58. * update the dentry->d_flags of all of inode's children to indicate if inode cares
  59. * about events that happen to its children.
  60. */
  61. extern void __fsnotify_update_child_dentry_flags(struct inode *inode);
  62. /* allocate and destroy and event holder to attach events to notification/access queues */
  63. extern struct fsnotify_event_holder *fsnotify_alloc_event_holder(void);
  64. extern void fsnotify_destroy_event_holder(struct fsnotify_event_holder *holder);
  65. #endif /* __FS_NOTIFY_FSNOTIFY_H_ */