Skip to content

Commit f905c2f

Browse files
jankarapcmoore
authored andcommitted
audit: Use 'mark' name for fsnotify_mark variables
Variables pointing to fsnotify_mark are sometimes called 'entry' and sometimes 'mark'. Use 'mark' in all places. Reviewed-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz> [PM: minor merge fuzz due to updated patches previously in the series] Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 83d23bc commit f905c2f

1 file changed

Lines changed: 40 additions & 39 deletions

File tree

‎kernel/audit_tree.c‎

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,19 @@ static void audit_mark_put_chunk(struct audit_chunk *chunk)
158158
call_rcu(&chunk->head, __put_chunk);
159159
}
160160

161-
static inline struct audit_tree_mark *audit_mark(struct fsnotify_mark *entry)
161+
static inline struct audit_tree_mark *audit_mark(struct fsnotify_mark *mark)
162162
{
163-
return container_of(entry, struct audit_tree_mark, mark);
163+
return container_of(mark, struct audit_tree_mark, mark);
164164
}
165165

166166
static struct audit_chunk *mark_chunk(struct fsnotify_mark *mark)
167167
{
168168
return audit_mark(mark)->chunk;
169169
}
170170

171-
static void audit_tree_destroy_watch(struct fsnotify_mark *entry)
171+
static void audit_tree_destroy_watch(struct fsnotify_mark *mark)
172172
{
173-
kmem_cache_free(audit_tree_mark_cachep, audit_mark(entry));
173+
kmem_cache_free(audit_tree_mark_cachep, audit_mark(mark));
174174
}
175175

176176
static struct fsnotify_mark *alloc_mark(void)
@@ -224,7 +224,7 @@ static inline struct list_head *chunk_hash(unsigned long key)
224224
return chunk_hash_heads + n % HASH_SIZE;
225225
}
226226

227-
/* hash_lock & entry->group->mark_mutex is held by caller */
227+
/* hash_lock & mark->group->mark_mutex is held by caller */
228228
static void insert_hash(struct audit_chunk *chunk)
229229
{
230230
struct list_head *list;
@@ -278,16 +278,16 @@ static struct audit_chunk *find_chunk(struct node *p)
278278
return container_of(p, struct audit_chunk, owners[0]);
279279
}
280280

281-
static void replace_mark_chunk(struct fsnotify_mark *entry,
281+
static void replace_mark_chunk(struct fsnotify_mark *mark,
282282
struct audit_chunk *chunk)
283283
{
284284
struct audit_chunk *old;
285285

286286
assert_spin_locked(&hash_lock);
287-
old = mark_chunk(entry);
288-
audit_mark(entry)->chunk = chunk;
287+
old = mark_chunk(mark);
288+
audit_mark(mark)->chunk = chunk;
289289
if (chunk)
290-
chunk->mark = entry;
290+
chunk->mark = mark;
291291
if (old)
292292
old->mark = NULL;
293293
}
@@ -348,7 +348,7 @@ static int chunk_count_trees(struct audit_chunk *chunk)
348348
return ret;
349349
}
350350

351-
static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *entry)
351+
static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *mark)
352352
{
353353
struct audit_chunk *new;
354354
int size;
@@ -358,21 +358,21 @@ static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *entry)
358358
* mark_mutex stabilizes chunk attached to the mark so we can check
359359
* whether it didn't change while we've dropped hash_lock.
360360
*/
361-
if (!(entry->flags & FSNOTIFY_MARK_FLAG_ATTACHED) ||
362-
mark_chunk(entry) != chunk)
361+
if (!(mark->flags & FSNOTIFY_MARK_FLAG_ATTACHED) ||
362+
mark_chunk(mark) != chunk)
363363
goto out_mutex;
364364

365365
size = chunk_count_trees(chunk);
366366
if (!size) {
367367
spin_lock(&hash_lock);
368368
list_del_init(&chunk->trees);
369369
list_del_rcu(&chunk->hash);
370-
replace_mark_chunk(entry, NULL);
370+
replace_mark_chunk(mark, NULL);
371371
spin_unlock(&hash_lock);
372-
fsnotify_detach_mark(entry);
372+
fsnotify_detach_mark(mark);
373373
mutex_unlock(&audit_tree_group->mark_mutex);
374374
audit_mark_put_chunk(chunk);
375-
fsnotify_free_mark(entry);
375+
fsnotify_free_mark(mark);
376376
return;
377377
}
378378

@@ -398,39 +398,39 @@ static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *entry)
398398
/* Call with group->mark_mutex held, releases it */
399399
static int create_chunk(struct inode *inode, struct audit_tree *tree)
400400
{
401-
struct fsnotify_mark *entry;
401+
struct fsnotify_mark *mark;
402402
struct audit_chunk *chunk = alloc_chunk(1);
403403

404404
if (!chunk) {
405405
mutex_unlock(&audit_tree_group->mark_mutex);
406406
return -ENOMEM;
407407
}
408408

409-
entry = alloc_mark();
410-
if (!entry) {
409+
mark = alloc_mark();
410+
if (!mark) {
411411
mutex_unlock(&audit_tree_group->mark_mutex);
412412
kfree(chunk);
413413
return -ENOMEM;
414414
}
415415

416-
if (fsnotify_add_inode_mark_locked(entry, inode, 0)) {
416+
if (fsnotify_add_inode_mark_locked(mark, inode, 0)) {
417417
mutex_unlock(&audit_tree_group->mark_mutex);
418-
fsnotify_put_mark(entry);
418+
fsnotify_put_mark(mark);
419419
kfree(chunk);
420420
return -ENOSPC;
421421
}
422422

423423
spin_lock(&hash_lock);
424424
if (tree->goner) {
425425
spin_unlock(&hash_lock);
426-
fsnotify_detach_mark(entry);
426+
fsnotify_detach_mark(mark);
427427
mutex_unlock(&audit_tree_group->mark_mutex);
428-
fsnotify_free_mark(entry);
429-
fsnotify_put_mark(entry);
428+
fsnotify_free_mark(mark);
429+
fsnotify_put_mark(mark);
430430
kfree(chunk);
431431
return 0;
432432
}
433-
replace_mark_chunk(entry, chunk);
433+
replace_mark_chunk(mark, chunk);
434434
chunk->owners[0].index = (1U << 31);
435435
chunk->owners[0].owner = tree;
436436
get_tree(tree);
@@ -452,21 +452,21 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
452452
* we get notification through ->freeing_mark callback and cleanup
453453
* chunk pointing to this mark.
454454
*/
455-
fsnotify_put_mark(entry);
455+
fsnotify_put_mark(mark);
456456
return 0;
457457
}
458458

459459
/* the first tagged inode becomes root of tree */
460460
static int tag_chunk(struct inode *inode, struct audit_tree *tree)
461461
{
462-
struct fsnotify_mark *entry;
462+
struct fsnotify_mark *mark;
463463
struct audit_chunk *chunk, *old;
464464
struct node *p;
465465
int n;
466466

467467
mutex_lock(&audit_tree_group->mark_mutex);
468-
entry = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_tree_group);
469-
if (!entry)
468+
mark = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_tree_group);
469+
if (!mark)
470470
return create_chunk(inode, tree);
471471

472472
/*
@@ -476,12 +476,12 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
476476
*/
477477
/* are we already there? */
478478
spin_lock(&hash_lock);
479-
old = mark_chunk(entry);
479+
old = mark_chunk(mark);
480480
for (n = 0; n < old->count; n++) {
481481
if (old->owners[n].owner == tree) {
482482
spin_unlock(&hash_lock);
483483
mutex_unlock(&audit_tree_group->mark_mutex);
484-
fsnotify_put_mark(entry);
484+
fsnotify_put_mark(mark);
485485
return 0;
486486
}
487487
}
@@ -490,15 +490,15 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
490490
chunk = alloc_chunk(old->count + 1);
491491
if (!chunk) {
492492
mutex_unlock(&audit_tree_group->mark_mutex);
493-
fsnotify_put_mark(entry);
493+
fsnotify_put_mark(mark);
494494
return -ENOMEM;
495495
}
496496

497497
spin_lock(&hash_lock);
498498
if (tree->goner) {
499499
spin_unlock(&hash_lock);
500500
mutex_unlock(&audit_tree_group->mark_mutex);
501-
fsnotify_put_mark(entry);
501+
fsnotify_put_mark(mark);
502502
kfree(chunk);
503503
return 0;
504504
}
@@ -518,7 +518,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
518518
replace_chunk(chunk, old);
519519
spin_unlock(&hash_lock);
520520
mutex_unlock(&audit_tree_group->mark_mutex);
521-
fsnotify_put_mark(entry); /* pair to fsnotify_find mark_entry */
521+
fsnotify_put_mark(mark); /* pair to fsnotify_find_mark */
522522
audit_mark_put_chunk(old);
523523

524524
return 0;
@@ -1044,16 +1044,17 @@ static int audit_tree_handle_event(struct fsnotify_group *group,
10441044
return 0;
10451045
}
10461046

1047-
static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify_group *group)
1047+
static void audit_tree_freeing_mark(struct fsnotify_mark *mark,
1048+
struct fsnotify_group *group)
10481049
{
10491050
struct audit_chunk *chunk;
10501051

1051-
mutex_lock(&entry->group->mark_mutex);
1052+
mutex_lock(&mark->group->mark_mutex);
10521053
spin_lock(&hash_lock);
1053-
chunk = mark_chunk(entry);
1054-
replace_mark_chunk(entry, NULL);
1054+
chunk = mark_chunk(mark);
1055+
replace_mark_chunk(mark, NULL);
10551056
spin_unlock(&hash_lock);
1056-
mutex_unlock(&entry->group->mark_mutex);
1057+
mutex_unlock(&mark->group->mark_mutex);
10571058
if (chunk) {
10581059
evict_chunk(chunk);
10591060
audit_mark_put_chunk(chunk);
@@ -1063,7 +1064,7 @@ static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify
10631064
* We are guaranteed to have at least one reference to the mark from
10641065
* either the inode or the caller of fsnotify_destroy_mark().
10651066
*/
1066-
BUG_ON(refcount_read(&entry->refcnt) < 1);
1067+
BUG_ON(refcount_read(&mark->refcnt) < 1);
10671068
}
10681069

10691070
static const struct fsnotify_ops audit_tree_ops = {

0 commit comments

Comments
 (0)