ARM: tegra: clock: Fix emulation clock table
[linux-2.6.git] / kernel / audit_tree.c
index ecf0bf2..5bf0790 100644 (file)
@@ -22,7 +22,7 @@ struct audit_tree {
 
 struct audit_chunk {
        struct list_head hash;
-       struct fsnotify_mark_entry mark;
+       struct fsnotify_mark mark;
        struct list_head trees;         /* with root here */
        int dead;
        int count;
@@ -93,16 +93,10 @@ static inline void get_tree(struct audit_tree *tree)
        atomic_inc(&tree->count);
 }
 
-static void __put_tree(struct rcu_head *rcu)
-{
-       struct audit_tree *tree = container_of(rcu, struct audit_tree, head);
-       kfree(tree);
-}
-
 static inline void put_tree(struct audit_tree *tree)
 {
        if (atomic_dec_and_test(&tree->count))
-               call_rcu(&tree->head, __put_tree);
+               kfree_rcu(tree, head);
 }
 
 /* to avoid bringing the entire thing in audit.h */
@@ -134,7 +128,7 @@ static void __put_chunk(struct rcu_head *rcu)
        audit_put_chunk(chunk);
 }
 
-static void audit_tree_destroy_watch(struct fsnotify_mark_entry *entry)
+static void audit_tree_destroy_watch(struct fsnotify_mark *entry)
 {
        struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);
        call_rcu(&chunk->head, __put_chunk);
@@ -176,12 +170,12 @@ static inline struct list_head *chunk_hash(const struct inode *inode)
 /* hash_lock & entry->lock is held by caller */
 static void insert_hash(struct audit_chunk *chunk)
 {
-       struct fsnotify_mark_entry *entry = &chunk->mark;
+       struct fsnotify_mark *entry = &chunk->mark;
        struct list_head *list;
 
-       if (!entry->inode)
+       if (!entry->i.inode)
                return;
-       list = chunk_hash(entry->inode);
+       list = chunk_hash(entry->i.inode);
        list_add_rcu(&chunk->hash, list);
 }
 
@@ -193,7 +187,7 @@ struct audit_chunk *audit_tree_lookup(const struct inode *inode)
 
        list_for_each_entry_rcu(p, list, hash) {
                /* mark.inode may have gone NULL, but who cares? */
-               if (p->mark.inode == inode) {
+               if (p->mark.i.inode == inode) {
                        atomic_long_inc(&p->refs);
                        return p;
                }
@@ -222,8 +216,8 @@ static struct audit_chunk *find_chunk(struct node *p)
 static void untag_chunk(struct node *p)
 {
        struct audit_chunk *chunk = find_chunk(p);
-       struct fsnotify_mark_entry *entry = &chunk->mark;
-       struct audit_chunk *new;
+       struct fsnotify_mark *entry = &chunk->mark;
+       struct audit_chunk *new = NULL;
        struct audit_tree *owner;
        int size = chunk->count - 1;
        int i, j;
@@ -232,9 +226,14 @@ static void untag_chunk(struct node *p)
 
        spin_unlock(&hash_lock);
 
+       if (size)
+               new = alloc_chunk(size);
+
        spin_lock(&entry->lock);
-       if (chunk->dead || !entry->inode) {
+       if (chunk->dead || !entry->i.inode) {
                spin_unlock(&entry->lock);
+               if (new)
+                       free_chunk(new);
                goto out;
        }
 
@@ -250,16 +249,16 @@ static void untag_chunk(struct node *p)
                list_del_rcu(&chunk->hash);
                spin_unlock(&hash_lock);
                spin_unlock(&entry->lock);
-               fsnotify_destroy_mark_by_entry(entry);
+               fsnotify_destroy_mark(entry);
                fsnotify_put_mark(entry);
                goto out;
        }
 
-       new = alloc_chunk(size);
        if (!new)
                goto Fallback;
+
        fsnotify_duplicate_mark(&new->mark, entry);
-       if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.inode, 1)) {
+       if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.i.inode, NULL, 1)) {
                free_chunk(new);
                goto Fallback;
        }
@@ -293,7 +292,7 @@ static void untag_chunk(struct node *p)
                owner->root = new;
        spin_unlock(&hash_lock);
        spin_unlock(&entry->lock);
-       fsnotify_destroy_mark_by_entry(entry);
+       fsnotify_destroy_mark(entry);
        fsnotify_put_mark(entry);
        goto out;
 
@@ -316,13 +315,13 @@ out:
 
 static int create_chunk(struct inode *inode, struct audit_tree *tree)
 {
-       struct fsnotify_mark_entry *entry;
+       struct fsnotify_mark *entry;
        struct audit_chunk *chunk = alloc_chunk(1);
        if (!chunk)
                return -ENOMEM;
 
        entry = &chunk->mark;
-       if (fsnotify_add_mark(entry, audit_tree_group, inode, 0)) {
+       if (fsnotify_add_mark(entry, audit_tree_group, inode, NULL, 0)) {
                free_chunk(chunk);
                return -ENOSPC;
        }
@@ -333,7 +332,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
                spin_unlock(&hash_lock);
                chunk->dead = 1;
                spin_unlock(&entry->lock);
-               fsnotify_destroy_mark_by_entry(entry);
+               fsnotify_destroy_mark(entry);
                fsnotify_put_mark(entry);
                return 0;
        }
@@ -354,15 +353,13 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
 /* the first tagged inode becomes root of tree */
 static int tag_chunk(struct inode *inode, struct audit_tree *tree)
 {
-       struct fsnotify_mark_entry *old_entry, *chunk_entry;
+       struct fsnotify_mark *old_entry, *chunk_entry;
        struct audit_tree *owner;
        struct audit_chunk *chunk, *old;
        struct node *p;
        int n;
 
-       spin_lock(&inode->i_lock);
-       old_entry = fsnotify_find_mark_entry(audit_tree_group, inode);
-       spin_unlock(&inode->i_lock);
+       old_entry = fsnotify_find_inode_mark(audit_tree_group, inode);
        if (!old_entry)
                return create_chunk(inode, tree);
 
@@ -388,7 +385,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
        chunk_entry = &chunk->mark;
 
        spin_lock(&old_entry->lock);
-       if (!old_entry->inode) {
+       if (!old_entry->i.inode) {
                /* old_entry is being shot, lets just lie */
                spin_unlock(&old_entry->lock);
                fsnotify_put_mark(old_entry);
@@ -397,7 +394,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
        }
 
        fsnotify_duplicate_mark(chunk_entry, old_entry);
-       if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->inode, 1)) {
+       if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->i.inode, NULL, 1)) {
                spin_unlock(&old_entry->lock);
                free_chunk(chunk);
                fsnotify_put_mark(old_entry);
@@ -415,7 +412,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
                spin_unlock(&chunk_entry->lock);
                spin_unlock(&old_entry->lock);
 
-               fsnotify_destroy_mark_by_entry(chunk_entry);
+               fsnotify_destroy_mark(chunk_entry);
 
                fsnotify_put_mark(chunk_entry);
                fsnotify_put_mark(old_entry);
@@ -446,7 +443,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
        spin_unlock(&hash_lock);
        spin_unlock(&chunk_entry->lock);
        spin_unlock(&old_entry->lock);
-       fsnotify_destroy_mark_by_entry(old_entry);
+       fsnotify_destroy_mark(old_entry);
        fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */
        fsnotify_put_mark(old_entry); /* and kill it */
        return 0;
@@ -604,8 +601,8 @@ void audit_trim_trees(void)
                spin_lock(&hash_lock);
                list_for_each_entry(node, &tree->chunks, list) {
                        struct audit_chunk *chunk = find_chunk(node);
-                       /* this could be NULL if the watch is dieing else where... */
-                       struct inode *inode = chunk->mark.inode;
+                       /* this could be NULL if the watch is dying else where... */
+                       struct inode *inode = chunk->mark.i.inode;
                        node->index |= 1U<<31;
                        if (iterate_mounts(compare_root, inode, root_mnt))
                                node->index &= ~(1U<<31);
@@ -905,13 +902,16 @@ static void evict_chunk(struct audit_chunk *chunk)
        mutex_unlock(&audit_filter_mutex);
 }
 
-static int audit_tree_handle_event(struct fsnotify_group *group, struct fsnotify_event *event)
+static int audit_tree_handle_event(struct fsnotify_group *group,
+                                  struct fsnotify_mark *inode_mark,
+                                  struct fsnotify_mark *vfsmonut_mark,
+                                  struct fsnotify_event *event)
 {
        BUG();
        return -EOPNOTSUPP;
 }
 
-static void audit_tree_freeing_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group)
+static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify_group *group)
 {
        struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);
 
@@ -920,10 +920,11 @@ static void audit_tree_freeing_mark(struct fsnotify_mark_entry *entry, struct fs
 }
 
 static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode,
-                                 struct vfsmount *mnt, __u32 mask, void *data,
-                                 int data_type)
+                                 struct fsnotify_mark *inode_mark,
+                                 struct fsnotify_mark *vfsmount_mark,
+                                 __u32 mask, void *data, int data_type)
 {
-       return 0;
+       return false;
 }
 
 static const struct fsnotify_ops audit_tree_ops = {