• Home
  • Raw
  • Download

Lines Matching refs:group

54 static struct fsnotify_event *get_one_event(struct fsnotify_group *group,  in get_one_event()  argument
57 BUG_ON(!mutex_is_locked(&group->notification_mutex)); in get_one_event()
59 pr_debug("%s: group=%p count=%zd\n", __func__, group, count); in get_one_event()
61 if (fsnotify_notify_queue_is_empty(group)) in get_one_event()
69 return fsnotify_remove_first_event(group); in get_one_event()
72 static int create_fd(struct fsnotify_group *group, in create_fd() argument
79 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in create_fd()
81 client_fd = get_unused_fd_flags(group->fanotify_data.f_flags); in create_fd()
93 group->fanotify_data.f_flags | FMODE_NONOTIFY, in create_fd()
114 static int fill_event_metadata(struct fsnotify_group *group, in fill_event_metadata() argument
123 group, metadata, fsn_event); in fill_event_metadata()
136 metadata->fd = create_fd(group, event, file); in fill_event_metadata()
146 struct fsnotify_group *group, int fd) in dequeue_event() argument
150 spin_lock(&group->fanotify_data.access_lock); in dequeue_event()
151 list_for_each_entry(event, &group->fanotify_data.access_list, in dequeue_event()
160 spin_unlock(&group->fanotify_data.access_lock); in dequeue_event()
167 static int process_access_response(struct fsnotify_group *group, in process_access_response() argument
174 pr_debug("%s: group=%p fd=%d response=%d\n", __func__, group, in process_access_response()
192 event = dequeue_event(group, fd); in process_access_response()
197 wake_up(&group->fanotify_data.access_waitq); in process_access_response()
203 static ssize_t copy_event_to_user(struct fsnotify_group *group, in copy_event_to_user() argument
211 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in copy_event_to_user()
213 ret = fill_event_metadata(group, &fanotify_event_metadata, event, &f); in copy_event_to_user()
243 struct fsnotify_group *group = file->private_data; in fanotify_poll() local
246 poll_wait(file, &group->notification_waitq, wait); in fanotify_poll()
247 mutex_lock(&group->notification_mutex); in fanotify_poll()
248 if (!fsnotify_notify_queue_is_empty(group)) in fanotify_poll()
250 mutex_unlock(&group->notification_mutex); in fanotify_poll()
258 struct fsnotify_group *group; in fanotify_read() local
265 group = file->private_data; in fanotify_read()
267 pr_debug("%s: group=%p\n", __func__, group); in fanotify_read()
269 add_wait_queue(&group->notification_waitq, &wait); in fanotify_read()
271 mutex_lock(&group->notification_mutex); in fanotify_read()
272 kevent = get_one_event(group, count); in fanotify_read()
273 mutex_unlock(&group->notification_mutex); in fanotify_read()
296 ret = copy_event_to_user(group, kevent, buf); in fanotify_read()
302 fsnotify_destroy_event(group, kevent); in fanotify_read()
309 wake_up(&group->fanotify_data.access_waitq); in fanotify_read()
312 spin_lock(&group->fanotify_data.access_lock); in fanotify_read()
314 &group->fanotify_data.access_list); in fanotify_read()
315 spin_unlock(&group->fanotify_data.access_lock); in fanotify_read()
321 remove_wait_queue(&group->notification_waitq, &wait); in fanotify_read()
332 struct fsnotify_group *group; in fanotify_write() local
335 group = file->private_data; in fanotify_write()
340 pr_debug("%s: group=%p count=%zu\n", __func__, group, count); in fanotify_write()
345 ret = process_access_response(group, &response); in fanotify_write()
357 struct fsnotify_group *group = file->private_data; in fanotify_release() local
368 fsnotify_group_stop_queueing(group); in fanotify_release()
374 spin_lock(&group->fanotify_data.access_lock); in fanotify_release()
375 list_for_each_entry_safe(event, next, &group->fanotify_data.access_list, in fanotify_release()
377 pr_debug("%s: found group=%p event=%p\n", __func__, group, in fanotify_release()
383 spin_unlock(&group->fanotify_data.access_lock); in fanotify_release()
390 mutex_lock(&group->notification_mutex); in fanotify_release()
391 while (!fsnotify_notify_queue_is_empty(group)) { in fanotify_release()
392 fsn_event = fsnotify_remove_first_event(group); in fanotify_release()
394 fsnotify_destroy_event(group, fsn_event); in fanotify_release()
398 mutex_unlock(&group->notification_mutex); in fanotify_release()
401 wake_up(&group->fanotify_data.access_waitq); in fanotify_release()
405 fsnotify_destroy_group(group); in fanotify_release()
412 struct fsnotify_group *group; in fanotify_ioctl() local
418 group = file->private_data; in fanotify_ioctl()
424 mutex_lock(&group->notification_mutex); in fanotify_ioctl()
425 list_for_each_entry(fsn_event, &group->notification_list, list) in fanotify_ioctl()
427 mutex_unlock(&group->notification_mutex); in fanotify_ioctl()
527 static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group, in fanotify_remove_vfsmount_mark() argument
535 mutex_lock(&group->mark_mutex); in fanotify_remove_vfsmount_mark()
536 fsn_mark = fsnotify_find_vfsmount_mark(group, mnt); in fanotify_remove_vfsmount_mark()
538 mutex_unlock(&group->mark_mutex); in fanotify_remove_vfsmount_mark()
546 mutex_unlock(&group->mark_mutex); in fanotify_remove_vfsmount_mark()
557 static int fanotify_remove_inode_mark(struct fsnotify_group *group, in fanotify_remove_inode_mark() argument
565 mutex_lock(&group->mark_mutex); in fanotify_remove_inode_mark()
566 fsn_mark = fsnotify_find_inode_mark(group, inode); in fanotify_remove_inode_mark()
568 mutex_unlock(&group->mark_mutex); in fanotify_remove_inode_mark()
576 mutex_unlock(&group->mark_mutex); in fanotify_remove_inode_mark()
617 static struct fsnotify_mark *fanotify_add_new_mark(struct fsnotify_group *group, in fanotify_add_new_mark() argument
624 if (atomic_read(&group->num_marks) > group->fanotify_data.max_marks) in fanotify_add_new_mark()
632 ret = fsnotify_add_mark_locked(mark, group, inode, mnt, 0); in fanotify_add_new_mark()
642 static int fanotify_add_vfsmount_mark(struct fsnotify_group *group, in fanotify_add_vfsmount_mark() argument
649 mutex_lock(&group->mark_mutex); in fanotify_add_vfsmount_mark()
650 fsn_mark = fsnotify_find_vfsmount_mark(group, mnt); in fanotify_add_vfsmount_mark()
652 fsn_mark = fanotify_add_new_mark(group, NULL, mnt); in fanotify_add_vfsmount_mark()
654 mutex_unlock(&group->mark_mutex); in fanotify_add_vfsmount_mark()
659 mutex_unlock(&group->mark_mutex); in fanotify_add_vfsmount_mark()
668 static int fanotify_add_inode_mark(struct fsnotify_group *group, in fanotify_add_inode_mark() argument
675 pr_debug("%s: group=%p inode=%p\n", __func__, group, inode); in fanotify_add_inode_mark()
687 mutex_lock(&group->mark_mutex); in fanotify_add_inode_mark()
688 fsn_mark = fsnotify_find_inode_mark(group, inode); in fanotify_add_inode_mark()
690 fsn_mark = fanotify_add_new_mark(group, inode, NULL); in fanotify_add_inode_mark()
692 mutex_unlock(&group->mark_mutex); in fanotify_add_inode_mark()
697 mutex_unlock(&group->mark_mutex); in fanotify_add_inode_mark()
709 struct fsnotify_group *group; in SYSCALL_DEFINE2() local
748 group = fsnotify_alloc_group(&fanotify_fsnotify_ops); in SYSCALL_DEFINE2()
749 if (IS_ERR(group)) { in SYSCALL_DEFINE2()
751 return PTR_ERR(group); in SYSCALL_DEFINE2()
754 group->fanotify_data.user = user; in SYSCALL_DEFINE2()
762 group->overflow_event = &oevent->fse; in SYSCALL_DEFINE2()
766 group->fanotify_data.f_flags = event_f_flags; in SYSCALL_DEFINE2()
768 spin_lock_init(&group->fanotify_data.access_lock); in SYSCALL_DEFINE2()
769 init_waitqueue_head(&group->fanotify_data.access_waitq); in SYSCALL_DEFINE2()
770 INIT_LIST_HEAD(&group->fanotify_data.access_list); in SYSCALL_DEFINE2()
774 group->priority = FS_PRIO_0; in SYSCALL_DEFINE2()
777 group->priority = FS_PRIO_1; in SYSCALL_DEFINE2()
780 group->priority = FS_PRIO_2; in SYSCALL_DEFINE2()
791 group->max_events = UINT_MAX; in SYSCALL_DEFINE2()
793 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS; in SYSCALL_DEFINE2()
800 group->fanotify_data.max_marks = UINT_MAX; in SYSCALL_DEFINE2()
802 group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS; in SYSCALL_DEFINE2()
805 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); in SYSCALL_DEFINE2()
812 fsnotify_destroy_group(group); in SYSCALL_DEFINE2()
822 struct fsnotify_group *group; in SYSCALL_DEFINE5() local
870 group = f.file->private_data; in SYSCALL_DEFINE5()
878 group->priority == FS_PRIO_0) in SYSCALL_DEFINE5()
884 fsnotify_clear_vfsmount_marks_by_group(group); in SYSCALL_DEFINE5()
886 fsnotify_clear_inode_marks_by_group(group); in SYSCALL_DEFINE5()
904 ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags); in SYSCALL_DEFINE5()
906 ret = fanotify_add_inode_mark(group, inode, mask, flags); in SYSCALL_DEFINE5()
910 ret = fanotify_remove_vfsmount_mark(group, mnt, mask, flags); in SYSCALL_DEFINE5()
912 ret = fanotify_remove_inode_mark(group, inode, mask, flags); in SYSCALL_DEFINE5()