aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-08-06 19:03:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:12 -0400
commit8ba8fa917093510cdcb4ec8ff8b9603e1b525658 (patch)
tree95726b87a1902928c854e9372a3932dc55fa77aa /fs
parent3e584064840de14856451ea9ce443c5d4f7e31ff (diff)
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: Jan Kara <jack@suse.cz> Cc: Eric Paris <eparis@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/notify/fanotify/fanotify.c2
-rw-r--r--fs/notify/fanotify/fanotify_user.c2
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c2
-rw-r--r--fs/notify/inotify/inotify_user.c4
-rw-r--r--fs/notify/notification.c19
5 files changed, 15 insertions, 14 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index ee9cb3795c2b..fdeb36b70c65 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -210,7 +210,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
210 return -ENOMEM; 210 return -ENOMEM;
211 211
212 fsn_event = &event->fse; 212 fsn_event = &event->fse;
213 ret = fsnotify_add_notify_event(group, fsn_event, fanotify_merge); 213 ret = fsnotify_add_event(group, fsn_event, fanotify_merge);
214 if (ret) { 214 if (ret) {
215 /* Permission events shouldn't be merged */ 215 /* Permission events shouldn't be merged */
216 BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS); 216 BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS);
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 3fdc8a3e1134..fbf2210823ab 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -66,7 +66,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
66 66
67 /* held the notification_mutex the whole time, so this is the 67 /* held the notification_mutex the whole time, so this is the
68 * same event we peeked above */ 68 * same event we peeked above */
69 return fsnotify_remove_notify_event(group); 69 return fsnotify_remove_first_event(group);
70} 70}
71 71
72static int create_fd(struct fsnotify_group *group, 72static int create_fd(struct fsnotify_group *group,
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 43ab1e1a07a2..0f88bc0b4e6c 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -108,7 +108,7 @@ int inotify_handle_event(struct fsnotify_group *group,
108 if (len) 108 if (len)
109 strcpy(event->name, file_name); 109 strcpy(event->name, file_name);
110 110
111 ret = fsnotify_add_notify_event(group, fsn_event, inotify_merge); 111 ret = fsnotify_add_event(group, fsn_event, inotify_merge);
112 if (ret) { 112 if (ret) {
113 /* Our event wasn't used in the end. Free it. */ 113 /* Our event wasn't used in the end. Free it. */
114 fsnotify_destroy_event(group, fsn_event); 114 fsnotify_destroy_event(group, fsn_event);
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index cc423a30a0c8..daf76652fe58 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -149,7 +149,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
149 if (fsnotify_notify_queue_is_empty(group)) 149 if (fsnotify_notify_queue_is_empty(group))
150 return NULL; 150 return NULL;
151 151
152 event = fsnotify_peek_notify_event(group); 152 event = fsnotify_peek_first_event(group);
153 153
154 pr_debug("%s: group=%p event=%p\n", __func__, group, event); 154 pr_debug("%s: group=%p event=%p\n", __func__, group, event);
155 155
@@ -159,7 +159,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
159 159
160 /* held the notification_mutex the whole time, so this is the 160 /* held the notification_mutex the whole time, so this is the
161 * same event we peeked above */ 161 * same event we peeked above */
162 fsnotify_remove_notify_event(group); 162 fsnotify_remove_first_event(group);
163 163
164 return event; 164 return event;
165} 165}
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index 1e58402171a5..1d394220acbe 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -83,10 +83,10 @@ void fsnotify_destroy_event(struct fsnotify_group *group,
83 * added to the queue, 1 if the event was merged with some other queued event, 83 * added to the queue, 1 if the event was merged with some other queued event,
84 * 2 if the queue of events has overflown. 84 * 2 if the queue of events has overflown.
85 */ 85 */
86int fsnotify_add_notify_event(struct fsnotify_group *group, 86int fsnotify_add_event(struct fsnotify_group *group,
87 struct fsnotify_event *event, 87 struct fsnotify_event *event,
88 int (*merge)(struct list_head *, 88 int (*merge)(struct list_head *,
89 struct fsnotify_event *)) 89 struct fsnotify_event *))
90{ 90{
91 int ret = 0; 91 int ret = 0;
92 struct list_head *list = &group->notification_list; 92 struct list_head *list = &group->notification_list;
@@ -128,7 +128,7 @@ queue:
128 * Remove and return the first event from the notification list. It is the 128 * Remove and return the first event from the notification list. It is the
129 * responsibility of the caller to destroy the obtained event 129 * responsibility of the caller to destroy the obtained event
130 */ 130 */
131struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group) 131struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
132{ 132{
133 struct fsnotify_event *event; 133 struct fsnotify_event *event;
134 134
@@ -140,7 +140,7 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group
140 struct fsnotify_event, list); 140 struct fsnotify_event, list);
141 /* 141 /*
142 * We need to init list head for the case of overflow event so that 142 * We need to init list head for the case of overflow event so that
143 * check in fsnotify_add_notify_events() works 143 * check in fsnotify_add_event() works
144 */ 144 */
145 list_del_init(&event->list); 145 list_del_init(&event->list);
146 group->q_len--; 146 group->q_len--;
@@ -149,9 +149,10 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group
149} 149}
150 150
151/* 151/*
152 * This will not remove the event, that must be done with fsnotify_remove_notify_event() 152 * This will not remove the event, that must be done with
153 * fsnotify_remove_first_event()
153 */ 154 */
154struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group) 155struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group)
155{ 156{
156 BUG_ON(!mutex_is_locked(&group->notification_mutex)); 157 BUG_ON(!mutex_is_locked(&group->notification_mutex));
157 158
@@ -169,7 +170,7 @@ void fsnotify_flush_notify(struct fsnotify_group *group)
169 170
170 mutex_lock(&group->notification_mutex); 171 mutex_lock(&group->notification_mutex);
171 while (!fsnotify_notify_queue_is_empty(group)) { 172 while (!fsnotify_notify_queue_is_empty(group)) {
172 event = fsnotify_remove_notify_event(group); 173 event = fsnotify_remove_first_event(group);
173 fsnotify_destroy_event(group, event); 174 fsnotify_destroy_event(group, event);
174 } 175 }
175 mutex_unlock(&group->notification_mutex); 176 mutex_unlock(&group->notification_mutex);