mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
fanotify: Fold dequeue_event() into process_access_response()
Fold dequeue_event() into process_access_response(). This will make changes to use of ->response field easier. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
53136b393c
commit
af6a511306
1 changed files with 13 additions and 28 deletions
|
@ -138,28 +138,6 @@ static int create_fd(struct fsnotify_group *group,
|
||||||
return client_fd;
|
return client_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct fanotify_perm_event *dequeue_event(
|
|
||||||
struct fsnotify_group *group, int fd)
|
|
||||||
{
|
|
||||||
struct fanotify_perm_event *event, *return_e = NULL;
|
|
||||||
|
|
||||||
spin_lock(&group->notification_lock);
|
|
||||||
list_for_each_entry(event, &group->fanotify_data.access_list,
|
|
||||||
fae.fse.list) {
|
|
||||||
if (event->fd != fd)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
list_del_init(&event->fae.fse.list);
|
|
||||||
return_e = event;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
spin_unlock(&group->notification_lock);
|
|
||||||
|
|
||||||
pr_debug("%s: found return_re=%p\n", __func__, return_e);
|
|
||||||
|
|
||||||
return return_e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int process_access_response(struct fsnotify_group *group,
|
static int process_access_response(struct fsnotify_group *group,
|
||||||
struct fanotify_response *response_struct)
|
struct fanotify_response *response_struct)
|
||||||
{
|
{
|
||||||
|
@ -188,14 +166,21 @@ static int process_access_response(struct fsnotify_group *group,
|
||||||
if ((response & FAN_AUDIT) && !FAN_GROUP_FLAG(group, FAN_ENABLE_AUDIT))
|
if ((response & FAN_AUDIT) && !FAN_GROUP_FLAG(group, FAN_ENABLE_AUDIT))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
event = dequeue_event(group, fd);
|
spin_lock(&group->notification_lock);
|
||||||
if (!event)
|
list_for_each_entry(event, &group->fanotify_data.access_list,
|
||||||
return -ENOENT;
|
fae.fse.list) {
|
||||||
|
if (event->fd != fd)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
list_del_init(&event->fae.fse.list);
|
||||||
event->response = response;
|
event->response = response;
|
||||||
|
spin_unlock(&group->notification_lock);
|
||||||
wake_up(&group->fanotify_data.access_waitq);
|
wake_up(&group->fanotify_data.access_waitq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
spin_unlock(&group->notification_lock);
|
||||||
|
|
||||||
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int copy_fid_to_user(struct fanotify_event *event, char __user *buf)
|
static int copy_fid_to_user(struct fanotify_event *event, char __user *buf)
|
||||||
|
|
Loading…
Reference in a new issue