#ifndef __LINUX_FSNOTIFY_BACKEND_H
#define __LINUX_FSNOTIFY_BACKEND_H
#ifdef __KERNEL__
#include <linux/idr.h>
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/path.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/atomic.h>
#include <linux/user_namespace.h>
#include <linux/refcount.h>
#include <linux/mempool.h>
#include <linux/sched/mm.h>
#define FS_ACCESS …
#define FS_MODIFY …
#define FS_ATTRIB …
#define FS_CLOSE_WRITE …
#define FS_CLOSE_NOWRITE …
#define FS_OPEN …
#define FS_MOVED_FROM …
#define FS_MOVED_TO …
#define FS_CREATE …
#define FS_DELETE …
#define FS_DELETE_SELF …
#define FS_MOVE_SELF …
#define FS_OPEN_EXEC …
#define FS_UNMOUNT …
#define FS_Q_OVERFLOW …
#define FS_ERROR …
#define FS_IN_IGNORED …
#define FS_OPEN_PERM …
#define FS_ACCESS_PERM …
#define FS_OPEN_EXEC_PERM …
#define FS_EVENT_ON_CHILD …
#define FS_RENAME …
#define FS_DN_MULTISHOT …
#define FS_ISDIR …
#define FS_MOVE …
#define ALL_FSNOTIFY_DIRENT_EVENTS …
#define ALL_FSNOTIFY_PERM_EVENTS …
#define FS_EVENTS_POSS_ON_CHILD …
#define FS_EVENTS_POSS_TO_PARENT …
#define ALL_FSNOTIFY_EVENTS …
#define ALL_FSNOTIFY_FLAGS …
#define ALL_FSNOTIFY_BITS …
struct fsnotify_group;
struct fsnotify_event;
struct fsnotify_mark;
struct fsnotify_event_private_data;
struct fsnotify_fname;
struct fsnotify_iter_info;
struct mem_cgroup;
struct fsnotify_ops { … };
struct fsnotify_event { … };
enum fsnotify_group_prio { … };
struct fsnotify_group { … };
static inline void fsnotify_group_lock(struct fsnotify_group *group)
{ … }
static inline void fsnotify_group_unlock(struct fsnotify_group *group)
{ … }
static inline void fsnotify_group_assert_locked(struct fsnotify_group *group)
{ … }
enum fsnotify_data_type { … };
struct fs_error_report { … };
static inline struct inode *fsnotify_data_inode(const void *data, int data_type)
{ … }
static inline struct dentry *fsnotify_data_dentry(const void *data, int data_type)
{ … }
static inline const struct path *fsnotify_data_path(const void *data,
int data_type)
{ … }
static inline struct super_block *fsnotify_data_sb(const void *data,
int data_type)
{ … }
static inline struct fs_error_report *fsnotify_data_error_report(
const void *data,
int data_type)
{ … }
enum fsnotify_iter_type { … };
enum fsnotify_obj_type { … };
static inline bool fsnotify_valid_obj_type(unsigned int obj_type)
{ … }
struct fsnotify_iter_info { … };
static inline bool fsnotify_iter_should_report_type(
struct fsnotify_iter_info *iter_info, int iter_type)
{ … }
static inline void fsnotify_iter_set_report_type(
struct fsnotify_iter_info *iter_info, int iter_type)
{ … }
static inline struct fsnotify_mark *fsnotify_iter_mark(
struct fsnotify_iter_info *iter_info, int iter_type)
{ … }
static inline int fsnotify_iter_step(struct fsnotify_iter_info *iter, int type,
struct fsnotify_mark **markp)
{ … }
#define FSNOTIFY_ITER_FUNCS(name, NAME) …
FSNOTIFY_ITER_FUNCS(…)
FSNOTIFY_ITER_FUNCS(…)
FSNOTIFY_ITER_FUNCS(…)
FSNOTIFY_ITER_FUNCS(…)
#define fsnotify_foreach_iter_type(type) …
#define fsnotify_foreach_iter_mark_type(iter, mark, type) …
struct fsnotify_mark_connector { … };
struct fsnotify_sb_info { … };
static inline struct fsnotify_sb_info *fsnotify_sb_info(struct super_block *sb)
{ … }
static inline atomic_long_t *fsnotify_sb_watched_objects(struct super_block *sb)
{ … }
struct fsnotify_mark { … };
#ifdef CONFIG_FSNOTIFY
extern int fsnotify(__u32 mask, const void *data, int data_type,
struct inode *dir, const struct qstr *name,
struct inode *inode, u32 cookie);
extern int __fsnotify_parent(struct dentry *dentry, __u32 mask, const void *data,
int data_type);
extern void __fsnotify_inode_delete(struct inode *inode);
extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
extern void fsnotify_sb_delete(struct super_block *sb);
extern void fsnotify_sb_free(struct super_block *sb);
extern u32 fsnotify_get_cookie(void);
static inline __u32 fsnotify_parent_needed_mask(__u32 mask)
{ … }
static inline int fsnotify_inode_watches_children(struct inode *inode)
{ … }
static inline void fsnotify_update_flags(struct dentry *dentry)
{ … }
extern struct fsnotify_group *fsnotify_alloc_group(
const struct fsnotify_ops *ops,
int flags);
extern void fsnotify_get_group(struct fsnotify_group *group);
extern void fsnotify_put_group(struct fsnotify_group *group);
extern void fsnotify_group_stop_queueing(struct fsnotify_group *group);
extern void fsnotify_destroy_group(struct fsnotify_group *group);
extern int fsnotify_fasync(int fd, struct file *file, int on);
extern void fsnotify_destroy_event(struct fsnotify_group *group,
struct fsnotify_event *event);
extern int fsnotify_insert_event(struct fsnotify_group *group,
struct fsnotify_event *event,
int (*merge)(struct fsnotify_group *,
struct fsnotify_event *),
void (*insert)(struct fsnotify_group *,
struct fsnotify_event *));
static inline int fsnotify_add_event(struct fsnotify_group *group,
struct fsnotify_event *event,
int (*merge)(struct fsnotify_group *,
struct fsnotify_event *))
{ … }
static inline void fsnotify_queue_overflow(struct fsnotify_group *group)
{ … }
static inline bool fsnotify_is_overflow_event(u32 mask)
{ … }
static inline bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group)
{ … }
extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
extern void fsnotify_remove_queued_event(struct fsnotify_group *group,
struct fsnotify_event *event);
static inline __u32 fsnotify_ignore_mask(struct fsnotify_mark *mark)
{ … }
static inline __u32 fsnotify_ignored_events(struct fsnotify_mark *mark)
{ … }
static inline bool fsnotify_mask_applicable(__u32 mask, bool is_dir,
int iter_type)
{ … }
static inline __u32 fsnotify_effective_ignore_mask(struct fsnotify_mark *mark,
bool is_dir, int iter_type)
{ … }
static inline __u32 fsnotify_calc_mask(struct fsnotify_mark *mark)
{ … }
extern __u32 fsnotify_conn_mask(struct fsnotify_mark_connector *conn);
extern void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn);
extern void fsnotify_init_mark(struct fsnotify_mark *mark,
struct fsnotify_group *group);
struct fsnotify_mark *fsnotify_find_mark(void *obj, unsigned int obj_type,
struct fsnotify_group *group);
int fsnotify_add_mark(struct fsnotify_mark *mark, void *obj,
unsigned int obj_type, int add_flags);
int fsnotify_add_mark_locked(struct fsnotify_mark *mark, void *obj,
unsigned int obj_type, int add_flags);
static inline int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
struct inode *inode,
int add_flags)
{ … }
static inline int fsnotify_add_inode_mark_locked(struct fsnotify_mark *mark,
struct inode *inode,
int add_flags)
{ … }
static inline struct fsnotify_mark *fsnotify_find_inode_mark(
struct inode *inode,
struct fsnotify_group *group)
{ … }
extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
struct fsnotify_group *group);
extern void fsnotify_detach_mark(struct fsnotify_mark *mark);
extern void fsnotify_free_mark(struct fsnotify_mark *mark);
extern void fsnotify_wait_marks_destroyed(void);
extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group,
unsigned int obj_type);
static inline void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
{ … }
static inline void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group)
{ … }
static inline void fsnotify_clear_sb_marks_by_group(struct fsnotify_group *group)
{ … }
extern void fsnotify_get_mark(struct fsnotify_mark *mark);
extern void fsnotify_put_mark(struct fsnotify_mark *mark);
extern void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info);
extern bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info);
static inline void fsnotify_init_event(struct fsnotify_event *event)
{ … }
#else
static inline int fsnotify(__u32 mask, const void *data, int data_type,
struct inode *dir, const struct qstr *name,
struct inode *inode, u32 cookie)
{
return 0;
}
static inline int __fsnotify_parent(struct dentry *dentry, __u32 mask,
const void *data, int data_type)
{
return 0;
}
static inline void __fsnotify_inode_delete(struct inode *inode)
{}
static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
{}
static inline void fsnotify_sb_delete(struct super_block *sb)
{}
static inline void fsnotify_sb_free(struct super_block *sb)
{}
static inline void fsnotify_update_flags(struct dentry *dentry)
{}
static inline u32 fsnotify_get_cookie(void)
{
return 0;
}
static inline void fsnotify_unmount_inodes(struct super_block *sb)
{}
#endif
#endif
#endif