Lines Matching refs:group
115 struct fsnotify_group *group = file->private_data; in inotify_poll() local
118 poll_wait(file, &group->notification_waitq, wait); in inotify_poll()
119 mutex_lock(&group->notification_mutex); in inotify_poll()
120 if (!fsnotify_notify_queue_is_empty(group)) in inotify_poll()
122 mutex_unlock(&group->notification_mutex); in inotify_poll()
134 static struct fsnotify_event *get_one_event(struct fsnotify_group *group, in get_one_event() argument
140 if (fsnotify_notify_queue_is_empty(group)) in get_one_event()
143 event = fsnotify_peek_notify_event(group); in get_one_event()
145 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in get_one_event()
155 fsnotify_remove_notify_event(group); in get_one_event()
166 static ssize_t copy_event_to_user(struct fsnotify_group *group, in copy_event_to_user() argument
176 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in copy_event_to_user()
180 fsn_priv = fsnotify_remove_priv_from_event(group, event); in copy_event_to_user()
234 struct fsnotify_group *group; in inotify_read() local
241 group = file->private_data; in inotify_read()
244 prepare_to_wait(&group->notification_waitq, &wait, TASK_INTERRUPTIBLE); in inotify_read()
246 mutex_lock(&group->notification_mutex); in inotify_read()
247 kevent = get_one_event(group, count); in inotify_read()
248 mutex_unlock(&group->notification_mutex); in inotify_read()
250 pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent); in inotify_read()
256 ret = copy_event_to_user(group, kevent, buf); in inotify_read()
278 finish_wait(&group->notification_waitq, &wait); in inotify_read()
286 struct fsnotify_group *group = file->private_data; in inotify_release() local
288 pr_debug("%s: group=%p\n", __func__, group); in inotify_release()
291 fsnotify_destroy_group(group); in inotify_release()
299 struct fsnotify_group *group; in inotify_ioctl() local
306 group = file->private_data; in inotify_ioctl()
309 pr_debug("%s: group=%p cmd=%u\n", __func__, group, cmd); in inotify_ioctl()
313 mutex_lock(&group->notification_mutex); in inotify_ioctl()
314 list_for_each_entry(holder, &group->notification_list, event_list) { in inotify_ioctl()
321 mutex_unlock(&group->notification_mutex); in inotify_ioctl()
378 static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group *group, in inotify_idr_find_locked() argument
381 struct idr *idr = &group->inotify_data.idr; in inotify_idr_find_locked()
382 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find_locked()
399 static struct inotify_inode_mark *inotify_idr_find(struct fsnotify_group *group, in inotify_idr_find() argument
403 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find()
406 i_mark = inotify_idr_find_locked(group, wd); in inotify_idr_find()
412 static void do_inotify_remove_from_idr(struct fsnotify_group *group, in do_inotify_remove_from_idr() argument
415 struct idr *idr = &group->inotify_data.idr; in do_inotify_remove_from_idr()
416 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in do_inotify_remove_from_idr()
431 static void inotify_remove_from_idr(struct fsnotify_group *group, in inotify_remove_from_idr() argument
434 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_remove_from_idr()
448 i_mark->fsn_mark.group, i_mark->fsn_mark.i.inode); in inotify_remove_from_idr()
453 found_i_mark = inotify_idr_find_locked(group, wd); in inotify_remove_from_idr()
457 i_mark->fsn_mark.group, i_mark->fsn_mark.i.inode); in inotify_remove_from_idr()
470 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group, in inotify_remove_from_idr()
472 found_i_mark->fsn_mark.group, in inotify_remove_from_idr()
485 i_mark->fsn_mark.group, i_mark->fsn_mark.i.inode); in inotify_remove_from_idr()
490 do_inotify_remove_from_idr(group, i_mark); in inotify_remove_from_idr()
503 struct fsnotify_group *group) in inotify_ignored_and_remove_idr() argument
525 fsnotify_get_group(group); in inotify_ignored_and_remove_idr()
526 fsn_event_priv->group = group; in inotify_ignored_and_remove_idr()
529 notify_event = fsnotify_add_notify_event(group, ignored_event, fsn_event_priv, NULL); in inotify_ignored_and_remove_idr()
544 inotify_remove_from_idr(group, i_mark); in inotify_ignored_and_remove_idr()
546 atomic_dec(&group->inotify_data.user->inotify_watches); in inotify_ignored_and_remove_idr()
559 static int inotify_update_existing_watch(struct fsnotify_group *group, in inotify_update_existing_watch() argument
572 fsn_mark = fsnotify_find_inode_mark(group, inode); in inotify_update_existing_watch()
610 static int inotify_new_watch(struct fsnotify_group *group, in inotify_new_watch() argument
617 struct idr *idr = &group->inotify_data.idr; in inotify_new_watch()
618 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_new_watch()
631 if (atomic_read(&group->inotify_data.user->inotify_watches) >= inotify_max_user_watches) in inotify_new_watch()
639 ret = fsnotify_add_mark(&tmp_i_mark->fsn_mark, group, inode, NULL, 0); in inotify_new_watch()
642 inotify_remove_from_idr(group, tmp_i_mark); in inotify_new_watch()
647 atomic_inc(&group->inotify_data.user->inotify_watches); in inotify_new_watch()
659 static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg) in inotify_update_watch() argument
665 ret = inotify_update_existing_watch(group, inode, arg); in inotify_update_watch()
668 ret = inotify_new_watch(group, inode, arg); in inotify_update_watch()
682 struct fsnotify_group *group; in inotify_new_group() local
684 group = fsnotify_alloc_group(&inotify_fsnotify_ops); in inotify_new_group()
685 if (IS_ERR(group)) in inotify_new_group()
686 return group; in inotify_new_group()
688 group->max_events = max_events; in inotify_new_group()
690 spin_lock_init(&group->inotify_data.idr_lock); in inotify_new_group()
691 idr_init(&group->inotify_data.idr); in inotify_new_group()
692 group->inotify_data.user = get_current_user(); in inotify_new_group()
694 if (atomic_inc_return(&group->inotify_data.user->inotify_devs) > in inotify_new_group()
696 fsnotify_destroy_group(group); in inotify_new_group()
700 return group; in inotify_new_group()
707 struct fsnotify_group *group; in SYSCALL_DEFINE1() local
718 group = inotify_new_group(inotify_max_queued_events); in SYSCALL_DEFINE1()
719 if (IS_ERR(group)) in SYSCALL_DEFINE1()
720 return PTR_ERR(group); in SYSCALL_DEFINE1()
722 ret = anon_inode_getfd("inotify", &inotify_fops, group, in SYSCALL_DEFINE1()
725 fsnotify_destroy_group(group); in SYSCALL_DEFINE1()
738 struct fsnotify_group *group; in SYSCALL_DEFINE3() local
781 group = f.file->private_data; in SYSCALL_DEFINE3()
784 ret = inotify_update_watch(group, inode, mask); in SYSCALL_DEFINE3()
793 struct fsnotify_group *group; in SYSCALL_DEFINE2() local
807 group = f.file->private_data; in SYSCALL_DEFINE2()
810 i_mark = inotify_idr_find(group, wd); in SYSCALL_DEFINE2()
816 fsnotify_destroy_mark(&i_mark->fsn_mark, group); in SYSCALL_DEFINE2()