Skip to content

Commit

Permalink
fsnotify: introduce fsnotify_get_group()
Browse files Browse the repository at this point in the history
Introduce fsnotify_get_group() which increments the reference counter of a group.

Signed-off-by: Lino Sanfilippo <[email protected]>
Signed-off-by: Eric Paris <[email protected]>
  • Loading branch information
LinoSanfilippo333 authored and eparis committed Dec 11, 2012
1 parent d8153d4 commit 9861295
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions fs/notify/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ void fsnotify_destroy_group(struct fsnotify_group *group)
fsnotify_final_destroy_group(group);
}

/*
* Get reference to a group.
*/
void fsnotify_get_group(struct fsnotify_group *group)
{
atomic_inc(&group->refcnt);
}

/*
* Drop a reference to a group. Free it if it's through.
*/
Expand Down
4 changes: 3 additions & 1 deletion include/linux/fsnotify_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,10 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode

/* called from fsnotify listeners, such as fanotify or dnotify */

/* get a reference to an existing or create a new group */
/* create a new group */
extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
/* get reference to a group */
extern void fsnotify_get_group(struct fsnotify_group *group);
/* drop reference on a group from fsnotify_alloc_group */
extern void fsnotify_put_group(struct fsnotify_group *group);
/* destroy group */
Expand Down

0 comments on commit 9861295

Please sign in to comment.