#include "audit.h"
#include <linux/fsnotify_backend.h>
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/kthread.h>
#include <linux/refcount.h>
#include <linux/slab.h>
struct audit_tree;
struct audit_chunk;
struct audit_tree { … };
struct audit_chunk { … };
struct audit_tree_mark { … };
static LIST_HEAD(tree_list);
static LIST_HEAD(prune_list);
static struct task_struct *prune_thread;
static struct fsnotify_group *audit_tree_group __ro_after_init;
static struct kmem_cache *audit_tree_mark_cachep __ro_after_init;
static struct audit_tree *alloc_tree(const char *s)
{ … }
static inline void get_tree(struct audit_tree *tree)
{ … }
static inline void put_tree(struct audit_tree *tree)
{ … }
const char *audit_tree_path(struct audit_tree *tree)
{ … }
static void free_chunk(struct audit_chunk *chunk)
{ … }
void audit_put_chunk(struct audit_chunk *chunk)
{ … }
static void __put_chunk(struct rcu_head *rcu)
{ … }
static void audit_mark_put_chunk(struct audit_chunk *chunk)
{ … }
static inline struct audit_tree_mark *audit_mark(struct fsnotify_mark *mark)
{ … }
static struct audit_chunk *mark_chunk(struct fsnotify_mark *mark)
{ … }
static void audit_tree_destroy_watch(struct fsnotify_mark *mark)
{ … }
static struct fsnotify_mark *alloc_mark(void)
{ … }
static struct audit_chunk *alloc_chunk(int count)
{ … }
enum { … };
static struct list_head chunk_hash_heads[HASH_SIZE];
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(hash_lock);
static unsigned long inode_to_key(const struct inode *inode)
{ … }
static inline struct list_head *chunk_hash(unsigned long key)
{ … }
static void insert_hash(struct audit_chunk *chunk)
{ … }
struct audit_chunk *audit_tree_lookup(const struct inode *inode)
{ … }
bool audit_tree_match(struct audit_chunk *chunk, struct audit_tree *tree)
{ … }
static struct audit_chunk *find_chunk(struct audit_node *p)
{ … }
static void replace_mark_chunk(struct fsnotify_mark *mark,
struct audit_chunk *chunk)
{ … }
static void replace_chunk(struct audit_chunk *new, struct audit_chunk *old)
{ … }
static void remove_chunk_node(struct audit_chunk *chunk, struct audit_node *p)
{ … }
static int chunk_count_trees(struct audit_chunk *chunk)
{ … }
static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *mark)
{ … }
static int create_chunk(struct inode *inode, struct audit_tree *tree)
{ … }
static int tag_chunk(struct inode *inode, struct audit_tree *tree)
{ … }
static void audit_tree_log_remove_rule(struct audit_context *context,
struct audit_krule *rule)
{ … }
static void kill_rules(struct audit_context *context, struct audit_tree *tree)
{ … }
static void prune_tree_chunks(struct audit_tree *victim, bool tagged)
{ … }
static void prune_one(struct audit_tree *victim)
{ … }
static void trim_marked(struct audit_tree *tree)
{ … }
static void audit_schedule_prune(void);
int audit_remove_tree_rule(struct audit_krule *rule)
{ … }
static int compare_root(struct vfsmount *mnt, void *arg)
{ … }
void audit_trim_trees(void)
{ … }
int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op)
{ … }
void audit_put_tree(struct audit_tree *tree)
{ … }
static int tag_mount(struct vfsmount *mnt, void *arg)
{ … }
static int prune_tree_thread(void *unused)
{ … }
static int audit_launch_prune(void)
{ … }
int audit_add_tree_rule(struct audit_krule *rule)
{ … }
int audit_tag_tree(char *old, char *new)
{ … }
static void audit_schedule_prune(void)
{ … }
void audit_kill_trees(struct audit_context *context)
{ … }
static void evict_chunk(struct audit_chunk *chunk)
{ … }
static int audit_tree_handle_event(struct fsnotify_mark *mark, u32 mask,
struct inode *inode, struct inode *dir,
const struct qstr *file_name, u32 cookie)
{ … }
static void audit_tree_freeing_mark(struct fsnotify_mark *mark,
struct fsnotify_group *group)
{ … }
static const struct fsnotify_ops audit_tree_ops = …;
static int __init audit_tree_init(void)
{ … }
__initcall(audit_tree_init);