Commit 8ba8fa91 authored by Jan Kara's avatar Jan Kara Committed by Linus Torvalds

fsnotify: rename event handling functions

Rename fsnotify_add_notify_event() to fsnotify_add_event() since the
"notify" part is duplicit.  Rename fsnotify_remove_notify_event() and
fsnotify_peek_notify_event() to fsnotify_remove_first_event() and
fsnotify_peek_first_event() respectively since "notify" part is duplicit
and they really look at the first event in the queue.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3e584064
...@@ -210,7 +210,7 @@ static int fanotify_handle_event(struct fsnotify_group *group, ...@@ -210,7 +210,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
return -ENOMEM; return -ENOMEM;
fsn_event = &event->fse; fsn_event = &event->fse;
ret = fsnotify_add_notify_event(group, fsn_event, fanotify_merge); ret = fsnotify_add_event(group, fsn_event, fanotify_merge);
if (ret) { if (ret) {
/* Permission events shouldn't be merged */ /* Permission events shouldn't be merged */
BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS); BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS);
......
...@@ -66,7 +66,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group, ...@@ -66,7 +66,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
/* held the notification_mutex the whole time, so this is the /* held the notification_mutex the whole time, so this is the
* same event we peeked above */ * same event we peeked above */
return fsnotify_remove_notify_event(group); return fsnotify_remove_first_event(group);
} }
static int create_fd(struct fsnotify_group *group, static int create_fd(struct fsnotify_group *group,
......
...@@ -108,7 +108,7 @@ int inotify_handle_event(struct fsnotify_group *group, ...@@ -108,7 +108,7 @@ int inotify_handle_event(struct fsnotify_group *group,
if (len) if (len)
strcpy(event->name, file_name); strcpy(event->name, file_name);
ret = fsnotify_add_notify_event(group, fsn_event, inotify_merge); ret = fsnotify_add_event(group, fsn_event, inotify_merge);
if (ret) { if (ret) {
/* Our event wasn't used in the end. Free it. */ /* Our event wasn't used in the end. Free it. */
fsnotify_destroy_event(group, fsn_event); fsnotify_destroy_event(group, fsn_event);
......
...@@ -149,7 +149,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group, ...@@ -149,7 +149,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
if (fsnotify_notify_queue_is_empty(group)) if (fsnotify_notify_queue_is_empty(group))
return NULL; return NULL;
event = fsnotify_peek_notify_event(group); event = fsnotify_peek_first_event(group);
pr_debug("%s: group=%p event=%p\n", __func__, group, event); pr_debug("%s: group=%p event=%p\n", __func__, group, event);
...@@ -159,7 +159,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group, ...@@ -159,7 +159,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
/* held the notification_mutex the whole time, so this is the /* held the notification_mutex the whole time, so this is the
* same event we peeked above */ * same event we peeked above */
fsnotify_remove_notify_event(group); fsnotify_remove_first_event(group);
return event; return event;
} }
......
...@@ -83,10 +83,10 @@ void fsnotify_destroy_event(struct fsnotify_group *group, ...@@ -83,10 +83,10 @@ void fsnotify_destroy_event(struct fsnotify_group *group,
* added to the queue, 1 if the event was merged with some other queued event, * added to the queue, 1 if the event was merged with some other queued event,
* 2 if the queue of events has overflown. * 2 if the queue of events has overflown.
*/ */
int fsnotify_add_notify_event(struct fsnotify_group *group, int fsnotify_add_event(struct fsnotify_group *group,
struct fsnotify_event *event, struct fsnotify_event *event,
int (*merge)(struct list_head *, int (*merge)(struct list_head *,
struct fsnotify_event *)) struct fsnotify_event *))
{ {
int ret = 0; int ret = 0;
struct list_head *list = &group->notification_list; struct list_head *list = &group->notification_list;
...@@ -128,7 +128,7 @@ int fsnotify_add_notify_event(struct fsnotify_group *group, ...@@ -128,7 +128,7 @@ int fsnotify_add_notify_event(struct fsnotify_group *group,
* Remove and return the first event from the notification list. It is the * Remove and return the first event from the notification list. It is the
* responsibility of the caller to destroy the obtained event * responsibility of the caller to destroy the obtained event
*/ */
struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group) struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
{ {
struct fsnotify_event *event; struct fsnotify_event *event;
...@@ -140,7 +140,7 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group ...@@ -140,7 +140,7 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group
struct fsnotify_event, list); struct fsnotify_event, list);
/* /*
* We need to init list head for the case of overflow event so that * We need to init list head for the case of overflow event so that
* check in fsnotify_add_notify_events() works * check in fsnotify_add_event() works
*/ */
list_del_init(&event->list); list_del_init(&event->list);
group->q_len--; group->q_len--;
...@@ -149,9 +149,10 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group ...@@ -149,9 +149,10 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group
} }
/* /*
* This will not remove the event, that must be done with fsnotify_remove_notify_event() * This will not remove the event, that must be done with
* fsnotify_remove_first_event()
*/ */
struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group) struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group)
{ {
BUG_ON(!mutex_is_locked(&group->notification_mutex)); BUG_ON(!mutex_is_locked(&group->notification_mutex));
...@@ -169,7 +170,7 @@ void fsnotify_flush_notify(struct fsnotify_group *group) ...@@ -169,7 +170,7 @@ void fsnotify_flush_notify(struct fsnotify_group *group)
mutex_lock(&group->notification_mutex); mutex_lock(&group->notification_mutex);
while (!fsnotify_notify_queue_is_empty(group)) { while (!fsnotify_notify_queue_is_empty(group)) {
event = fsnotify_remove_notify_event(group); event = fsnotify_remove_first_event(group);
fsnotify_destroy_event(group, event); fsnotify_destroy_event(group, event);
} }
mutex_unlock(&group->notification_mutex); mutex_unlock(&group->notification_mutex);
......
...@@ -322,16 +322,16 @@ extern int fsnotify_fasync(int fd, struct file *file, int on); ...@@ -322,16 +322,16 @@ extern int fsnotify_fasync(int fd, struct file *file, int on);
extern void fsnotify_destroy_event(struct fsnotify_group *group, extern void fsnotify_destroy_event(struct fsnotify_group *group,
struct fsnotify_event *event); struct fsnotify_event *event);
/* attach the event to the group notification queue */ /* attach the event to the group notification queue */
extern int fsnotify_add_notify_event(struct fsnotify_group *group, extern int fsnotify_add_event(struct fsnotify_group *group,
struct fsnotify_event *event, struct fsnotify_event *event,
int (*merge)(struct list_head *, int (*merge)(struct list_head *,
struct fsnotify_event *)); struct fsnotify_event *));
/* true if the group notification queue is empty */ /* true if the group notification queue is empty */
extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
/* return, but do not dequeue the first event on the notification queue */ /* return, but do not dequeue the first event on the notification queue */
extern struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group); extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
/* return AND dequeue the first event on the notification queue */ /* return AND dequeue the first event on the notification queue */
extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group); extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
/* functions used to manipulate the marks attached to inodes */ /* functions used to manipulate the marks attached to inodes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment