Skip to content

Commit b249f5b

Browse files
amir73iljankara
authored andcommitted
fsnotify: add fsnotify_add_inode_mark() wrappers
Before changing the arguments of the functions fsnotify_add_mark() and fsnotify_add_mark_locked(), convert most callers to use a wrapper. Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent 837a393 commit b249f5b

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

fs/notify/dnotify/dnotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
319319
dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
320320
spin_lock(&fsn_mark->lock);
321321
} else {
322-
error = fsnotify_add_mark_locked(new_fsn_mark, inode, NULL, 0);
322+
error = fsnotify_add_inode_mark_locked(new_fsn_mark, inode, 0);
323323
if (error) {
324324
mutex_unlock(&dnotify_group->mark_mutex);
325325
goto out_err;

fs/notify/inotify/inotify_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ static int inotify_new_watch(struct fsnotify_group *group,
582582
}
583583

584584
/* we are on the idr, now get on the inode */
585-
ret = fsnotify_add_mark_locked(&tmp_i_mark->fsn_mark, inode, NULL, 0);
585+
ret = fsnotify_add_inode_mark_locked(&tmp_i_mark->fsn_mark, inode, 0);
586586
if (ret) {
587587
/* we failed to get on the inode, get off the idr */
588588
inotify_remove_from_idr(group, tmp_i_mark);

include/linux/fsnotify_backend.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,21 @@ extern struct fsnotify_mark *fsnotify_find_mark(
401401
extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct inode *inode,
402402
struct vfsmount *mnt, int allow_dups);
403403
extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
404-
struct inode *inode, struct vfsmount *mnt, int allow_dups);
404+
struct inode *inode, struct vfsmount *mnt,
405+
int allow_dups);
406+
/* attach the mark to the inode */
407+
static inline int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
408+
struct inode *inode,
409+
int allow_dups)
410+
{
411+
return fsnotify_add_mark(mark, inode, NULL, allow_dups);
412+
}
413+
static inline int fsnotify_add_inode_mark_locked(struct fsnotify_mark *mark,
414+
struct inode *inode,
415+
int allow_dups)
416+
{
417+
return fsnotify_add_mark_locked(mark, inode, NULL, allow_dups);
418+
}
405419
/* given a group and a mark, flag mark to be freed when all references are dropped */
406420
extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
407421
struct fsnotify_group *group);

kernel/audit_fsnotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct audit_fsnotify_mark *audit_alloc_mark(struct audit_krule *krule, char *pa
109109
audit_update_mark(audit_mark, dentry->d_inode);
110110
audit_mark->rule = krule;
111111

112-
ret = fsnotify_add_mark(&audit_mark->mark, inode, NULL, true);
112+
ret = fsnotify_add_inode_mark(&audit_mark->mark, inode, true);
113113
if (ret < 0) {
114114
fsnotify_put_mark(&audit_mark->mark);
115115
audit_mark = ERR_PTR(ret);

kernel/audit_tree.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ static void untag_chunk(struct node *p)
288288
if (!new)
289289
goto Fallback;
290290

291-
if (fsnotify_add_mark_locked(&new->mark, entry->connector->inode,
292-
NULL, 1)) {
291+
if (fsnotify_add_inode_mark_locked(&new->mark, entry->connector->inode,
292+
1)) {
293293
fsnotify_put_mark(&new->mark);
294294
goto Fallback;
295295
}
@@ -354,7 +354,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
354354
return -ENOMEM;
355355

356356
entry = &chunk->mark;
357-
if (fsnotify_add_mark(entry, inode, NULL, 0)) {
357+
if (fsnotify_add_inode_mark(entry, inode, 0)) {
358358
fsnotify_put_mark(entry);
359359
return -ENOSPC;
360360
}
@@ -434,8 +434,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
434434
return -ENOENT;
435435
}
436436

437-
if (fsnotify_add_mark_locked(chunk_entry,
438-
old_entry->connector->inode, NULL, 1)) {
437+
if (fsnotify_add_inode_mark_locked(chunk_entry,
438+
old_entry->connector->inode, 1)) {
439439
spin_unlock(&old_entry->lock);
440440
mutex_unlock(&old_entry->group->mark_mutex);
441441
fsnotify_put_mark(chunk_entry);

kernel/audit_watch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static struct audit_parent *audit_init_parent(struct path *path)
160160

161161
fsnotify_init_mark(&parent->mark, audit_watch_group);
162162
parent->mark.mask = AUDIT_FS_WATCH;
163-
ret = fsnotify_add_mark(&parent->mark, inode, NULL, 0);
163+
ret = fsnotify_add_inode_mark(&parent->mark, inode, 0);
164164
if (ret < 0) {
165165
audit_free_parent(parent);
166166
return ERR_PTR(ret);

0 commit comments

Comments
 (0)