Skip to content

Commit 8ba8fa9

Browse files
jankaratorvalds
authored andcommitted
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. [[email protected]: coding-style fixes] Signed-off-by: Jan Kara <[email protected]> Cc: Eric Paris <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3e58406 commit 8ba8fa9

File tree

6 files changed

+21
-20
lines changed

6 files changed

+21
-20
lines changed

fs/notify/fanotify/fanotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
210210
return -ENOMEM;
211211

212212
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);
214214
if (ret) {
215215
/* Permission events shouldn't be merged */
216216
BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS);

fs/notify/fanotify/fanotify_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
6666

6767
/* held the notification_mutex the whole time, so this is the
6868
* same event we peeked above */
69-
return fsnotify_remove_notify_event(group);
69+
return fsnotify_remove_first_event(group);
7070
}
7171

7272
static int create_fd(struct fsnotify_group *group,

fs/notify/inotify/inotify_fsnotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int inotify_handle_event(struct fsnotify_group *group,
108108
if (len)
109109
strcpy(event->name, file_name);
110110

111-
ret = fsnotify_add_notify_event(group, fsn_event, inotify_merge);
111+
ret = fsnotify_add_event(group, fsn_event, inotify_merge);
112112
if (ret) {
113113
/* Our event wasn't used in the end. Free it. */
114114
fsnotify_destroy_event(group, fsn_event);

fs/notify/inotify/inotify_user.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
149149
if (fsnotify_notify_queue_is_empty(group))
150150
return NULL;
151151

152-
event = fsnotify_peek_notify_event(group);
152+
event = fsnotify_peek_first_event(group);
153153

154154
pr_debug("%s: group=%p event=%p\n", __func__, group, event);
155155

@@ -159,7 +159,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
159159

160160
/* held the notification_mutex the whole time, so this is the
161161
* same event we peeked above */
162-
fsnotify_remove_notify_event(group);
162+
fsnotify_remove_first_event(group);
163163

164164
return event;
165165
}

fs/notify/notification.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ void fsnotify_destroy_event(struct fsnotify_group *group,
8383
* added to the queue, 1 if the event was merged with some other queued event,
8484
* 2 if the queue of events has overflown.
8585
*/
86-
int fsnotify_add_notify_event(struct fsnotify_group *group,
87-
struct fsnotify_event *event,
88-
int (*merge)(struct list_head *,
89-
struct fsnotify_event *))
86+
int fsnotify_add_event(struct fsnotify_group *group,
87+
struct fsnotify_event *event,
88+
int (*merge)(struct list_head *,
89+
struct fsnotify_event *))
9090
{
9191
int ret = 0;
9292
struct list_head *list = &group->notification_list;
@@ -128,7 +128,7 @@ int fsnotify_add_notify_event(struct fsnotify_group *group,
128128
* Remove and return the first event from the notification list. It is the
129129
* responsibility of the caller to destroy the obtained event
130130
*/
131-
struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group)
131+
struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
132132
{
133133
struct fsnotify_event *event;
134134

@@ -140,7 +140,7 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group
140140
struct fsnotify_event, list);
141141
/*
142142
* 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
144144
*/
145145
list_del_init(&event->list);
146146
group->q_len--;
@@ -149,9 +149,10 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group
149149
}
150150

151151
/*
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()
153154
*/
154-
struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group)
155+
struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group)
155156
{
156157
BUG_ON(!mutex_is_locked(&group->notification_mutex));
157158

@@ -169,7 +170,7 @@ void fsnotify_flush_notify(struct fsnotify_group *group)
169170

170171
mutex_lock(&group->notification_mutex);
171172
while (!fsnotify_notify_queue_is_empty(group)) {
172-
event = fsnotify_remove_notify_event(group);
173+
event = fsnotify_remove_first_event(group);
173174
fsnotify_destroy_event(group, event);
174175
}
175176
mutex_unlock(&group->notification_mutex);

include/linux/fsnotify_backend.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,16 @@ extern int fsnotify_fasync(int fd, struct file *file, int on);
322322
extern void fsnotify_destroy_event(struct fsnotify_group *group,
323323
struct fsnotify_event *event);
324324
/* attach the event to the group notification queue */
325-
extern int fsnotify_add_notify_event(struct fsnotify_group *group,
326-
struct fsnotify_event *event,
327-
int (*merge)(struct list_head *,
328-
struct fsnotify_event *));
325+
extern int fsnotify_add_event(struct fsnotify_group *group,
326+
struct fsnotify_event *event,
327+
int (*merge)(struct list_head *,
328+
struct fsnotify_event *));
329329
/* true if the group notification queue is empty */
330330
extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
331331
/* return, but do not dequeue the first event on the notification queue */
332-
extern struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group);
332+
extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
333333
/* return AND dequeue the first event on the notification queue */
334-
extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group);
334+
extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
335335

336336
/* functions used to manipulate the marks attached to inodes */
337337

0 commit comments

Comments
 (0)