inotify.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <linux/fsnotify_backend.h>
  3. #include <linux/inotify.h>
  4. #include <linux/slab.h> /* struct kmem_cache */
  5. struct inotify_event_info {
  6. struct fsnotify_event fse;
  7. int wd;
  8. u32 sync_cookie;
  9. int name_len;
  10. char name[];
  11. };
  12. struct inotify_inode_mark {
  13. struct fsnotify_mark fsn_mark;
  14. int wd;
  15. };
  16. static inline struct inotify_event_info *INOTIFY_E(struct fsnotify_event *fse)
  17. {
  18. return container_of(fse, struct inotify_event_info, fse);
  19. }
  20. extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
  21. struct fsnotify_group *group);
  22. extern int inotify_handle_event(struct fsnotify_group *group,
  23. struct inode *inode,
  24. u32 mask, const void *data, int data_type,
  25. const unsigned char *file_name, u32 cookie,
  26. struct fsnotify_iter_info *iter_info);
  27. extern const struct fsnotify_ops inotify_fsnotify_ops;
  28. extern struct kmem_cache *inotify_inode_mark_cachep;
  29. #ifdef CONFIG_INOTIFY_USER
  30. static inline void dec_inotify_instances(struct ucounts *ucounts)
  31. {
  32. dec_ucount(ucounts, UCOUNT_INOTIFY_INSTANCES);
  33. }
  34. static inline struct ucounts *inc_inotify_watches(struct ucounts *ucounts)
  35. {
  36. return inc_ucount(ucounts->ns, ucounts->uid, UCOUNT_INOTIFY_WATCHES);
  37. }
  38. static inline void dec_inotify_watches(struct ucounts *ucounts)
  39. {
  40. dec_ucount(ucounts, UCOUNT_INOTIFY_WATCHES);
  41. }
  42. #endif