Skip to content

Commit 57d4374

Browse files
chleroypcmoore
authored andcommitted
audit: rename struct node to struct audit_node to prevent future name collisions
Future work in the powerpc code results in a name collision with the identified "node" as struct node defined in kernel/audit_tree.c conflicts with struct node defined in include/linux/node.h (below). This patch takes the proactive route and renames the audit code's struct node to audit_node. CC kernel/audit_tree.o kernel/audit_tree.c:33:9: error: redefinition of 'struct node' 33 | struct node { | ^~~~ In file included from ./include/linux/cpu.h:17, from ./include/linux/static_call.h:102, from ./arch/powerpc/include/asm/machdep.h:10, from ./arch/powerpc/include/asm/archrandom.h:7, from ./include/linux/random.h:121, from ./include/linux/net.h:18, from ./include/linux/skbuff.h:26, from kernel/audit.h:11, from kernel/audit_tree.c:2: ./include/linux/node.h:84:8: note: originally defined here 84 | struct node { | ^~~~ make[2]: *** [kernel/audit_tree.o] Error 1 Signed-off-by: Christophe Leroy <[email protected]> Reviewed-by: Richard Guy Briggs <[email protected]> [PM: rewrite subj/desc as the build failure is just a RFC patch] Signed-off-by: Paul Moore <[email protected]>
1 parent 6880fa6 commit 57d4374

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

kernel/audit_tree.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct audit_chunk {
3030
int count;
3131
atomic_long_t refs;
3232
struct rcu_head head;
33-
struct node {
33+
struct audit_node {
3434
struct list_head list;
3535
struct audit_tree *owner;
3636
unsigned index; /* index; upper bit indicates 'will prune' */
@@ -269,7 +269,7 @@ bool audit_tree_match(struct audit_chunk *chunk, struct audit_tree *tree)
269269

270270
/* tagging and untagging inodes with trees */
271271

272-
static struct audit_chunk *find_chunk(struct node *p)
272+
static struct audit_chunk *find_chunk(struct audit_node *p)
273273
{
274274
int index = p->index & ~(1U<<31);
275275
p -= index;
@@ -322,7 +322,7 @@ static void replace_chunk(struct audit_chunk *new, struct audit_chunk *old)
322322
list_replace_rcu(&old->hash, &new->hash);
323323
}
324324

325-
static void remove_chunk_node(struct audit_chunk *chunk, struct node *p)
325+
static void remove_chunk_node(struct audit_chunk *chunk, struct audit_node *p)
326326
{
327327
struct audit_tree *owner = p->owner;
328328

@@ -459,7 +459,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
459459
{
460460
struct fsnotify_mark *mark;
461461
struct audit_chunk *chunk, *old;
462-
struct node *p;
462+
struct audit_node *p;
463463
int n;
464464

465465
mutex_lock(&audit_tree_group->mark_mutex);
@@ -570,11 +570,11 @@ static void prune_tree_chunks(struct audit_tree *victim, bool tagged)
570570
{
571571
spin_lock(&hash_lock);
572572
while (!list_empty(&victim->chunks)) {
573-
struct node *p;
573+
struct audit_node *p;
574574
struct audit_chunk *chunk;
575575
struct fsnotify_mark *mark;
576576

577-
p = list_first_entry(&victim->chunks, struct node, list);
577+
p = list_first_entry(&victim->chunks, struct audit_node, list);
578578
/* have we run out of marked? */
579579
if (tagged && !(p->index & (1U<<31)))
580580
break;
@@ -616,7 +616,7 @@ static void trim_marked(struct audit_tree *tree)
616616
}
617617
/* reorder */
618618
for (p = tree->chunks.next; p != &tree->chunks; p = q) {
619-
struct node *node = list_entry(p, struct node, list);
619+
struct audit_node *node = list_entry(p, struct audit_node, list);
620620
q = p->next;
621621
if (node->index & (1U<<31)) {
622622
list_del_init(p);
@@ -684,7 +684,7 @@ void audit_trim_trees(void)
684684
struct audit_tree *tree;
685685
struct path path;
686686
struct vfsmount *root_mnt;
687-
struct node *node;
687+
struct audit_node *node;
688688
int err;
689689

690690
tree = container_of(cursor.next, struct audit_tree, list);
@@ -839,7 +839,7 @@ int audit_add_tree_rule(struct audit_krule *rule)
839839
drop_collected_mounts(mnt);
840840

841841
if (!err) {
842-
struct node *node;
842+
struct audit_node *node;
843843
spin_lock(&hash_lock);
844844
list_for_each_entry(node, &tree->chunks, list)
845845
node->index &= ~(1U<<31);
@@ -938,7 +938,7 @@ int audit_tag_tree(char *old, char *new)
938938
mutex_unlock(&audit_filter_mutex);
939939

940940
if (!failed) {
941-
struct node *node;
941+
struct audit_node *node;
942942
spin_lock(&hash_lock);
943943
list_for_each_entry(node, &tree->chunks, list)
944944
node->index &= ~(1U<<31);

0 commit comments

Comments
 (0)