Lines Matching refs:event

140 static int fanotify_dir_name_info_len(struct fanotify_event *event)  in fanotify_dir_name_info_len()  argument
142 struct fanotify_info *info = fanotify_event_info(event); in fanotify_dir_name_info_len()
143 int dir_fh_len = fanotify_event_dir_fh_len(event); in fanotify_dir_name_info_len()
144 int dir2_fh_len = fanotify_event_dir2_fh_len(event); in fanotify_dir_name_info_len()
158 struct fanotify_event *event) in fanotify_event_len() argument
167 if (fanotify_is_error_event(event->mask)) in fanotify_event_len()
170 if (fanotify_event_has_any_dir_fh(event)) { in fanotify_event_len()
171 event_len += fanotify_dir_name_info_len(event); in fanotify_event_len()
173 (event->mask & FAN_ONDIR)) { in fanotify_event_len()
184 if (fanotify_event_has_object_fh(event)) { in fanotify_event_len()
185 fh_len = fanotify_event_object_fh_len(event); in fanotify_event_len()
196 struct fanotify_event *event) in fanotify_unhash_event() argument
201 group, event, fanotify_event_hash_bucket(group, event)); in fanotify_unhash_event()
203 if (WARN_ON_ONCE(hlist_unhashed(&event->merge_list))) in fanotify_unhash_event()
206 hlist_del_init(&event->merge_list); in fanotify_unhash_event()
219 struct fanotify_event *event = NULL; in get_one_event() local
230 event = FANOTIFY_E(fsn_event); in get_one_event()
231 event_size = fanotify_event_len(info_mode, event); in get_one_event()
234 event = ERR_PTR(-EINVAL); in get_one_event()
243 if (fanotify_is_perm_event(event->mask)) in get_one_event()
244 FANOTIFY_PERM(event)->state = FAN_EVENT_REPORTED; in get_one_event()
245 if (fanotify_is_hashed_event(event->mask)) in get_one_event()
246 fanotify_unhash_event(group, event); in get_one_event()
249 return event; in get_one_event()
311 struct fanotify_perm_event *event, u32 response, in finish_permission_event() argument
318 event->response = response & ~FAN_INFO; in finish_permission_event()
320 memcpy(&event->audit_rule, friar, sizeof(*friar)); in finish_permission_event()
322 if (event->state == FAN_EVENT_CANCELED) in finish_permission_event()
325 event->state = FAN_EVENT_ANSWERED; in finish_permission_event()
328 fsnotify_destroy_event(group, &event->fae.fse); in finish_permission_event()
336 struct fanotify_perm_event *event; in process_access_response() local
377 list_for_each_entry(event, &group->fanotify_data.access_list, in process_access_response()
379 if (event->fd != fd) in process_access_response()
382 list_del_init(&event->fae.fse.list); in process_access_response()
383 finish_permission_event(group, event, response, &friar); in process_access_response()
392 static size_t copy_error_info_to_user(struct fanotify_event *event, in copy_error_info_to_user() argument
396 struct fanotify_error_event *fee = FANOTIFY_EE(event); in copy_error_info_to_user()
533 static int copy_info_records_to_user(struct fanotify_event *event, in copy_info_records_to_user() argument
548 if (fanotify_event_has_dir_fh(event)) { in copy_info_records_to_user()
553 if (event->mask & FAN_RENAME) in copy_info_records_to_user()
556 ret = copy_fid_info_to_user(fanotify_event_fsid(event), in copy_info_records_to_user()
570 if (fanotify_event_has_dir2_fh(event)) { in copy_info_records_to_user()
572 ret = copy_fid_info_to_user(fanotify_event_fsid(event), in copy_info_records_to_user()
585 if (fanotify_event_has_object_fh(event)) { in copy_info_records_to_user()
596 (event->mask & FAN_ONDIR)) { in copy_info_records_to_user()
605 } else if ((event->mask & ALL_FSNOTIFY_DIRENT_EVENTS) || in copy_info_records_to_user()
606 (event->mask & FAN_ONDIR)) { in copy_info_records_to_user()
623 ret = copy_fid_info_to_user(fanotify_event_fsid(event), in copy_info_records_to_user()
624 fanotify_event_object_fh(event), in copy_info_records_to_user()
645 if (fanotify_is_error_event(event->mask)) { in copy_info_records_to_user()
646 ret = copy_error_info_to_user(event, buf, count); in copy_info_records_to_user()
658 struct fanotify_event *event, in copy_event_to_user() argument
662 const struct path *path = fanotify_event_path(event); in copy_event_to_user()
663 struct fanotify_info *info = fanotify_event_info(event); in copy_event_to_user()
669 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in copy_event_to_user()
671 metadata.event_len = fanotify_event_len(info_mode, event); in copy_event_to_user()
675 metadata.mask = event->mask & FANOTIFY_OUTGOING_EVENTS; in copy_event_to_user()
676 metadata.pid = pid_vnr(event->pid); in copy_event_to_user()
683 task_tgid(current) != event->pid) in copy_event_to_user()
718 !pid_has_task(event->pid, PIDTYPE_TGID)) { in copy_event_to_user()
721 pidfd = pidfd_prepare(event->pid, 0, &pidfd_file); in copy_event_to_user()
741 if (fanotify_is_perm_event(event->mask)) in copy_event_to_user()
742 FANOTIFY_PERM(event)->fd = fd; in copy_event_to_user()
745 ret = copy_info_records_to_user(event, info, info_mode, pidfd, in copy_event_to_user()
792 struct fanotify_event *event; in fanotify_read() local
809 event = get_one_event(group, count); in fanotify_read()
810 if (IS_ERR(event)) { in fanotify_read()
811 ret = PTR_ERR(event); in fanotify_read()
815 if (!event) { in fanotify_read()
831 ret = copy_event_to_user(group, event, buf, count); in fanotify_read()
846 if (!fanotify_is_perm_event(event->mask)) { in fanotify_read()
847 fsnotify_destroy_event(group, &event->fse); in fanotify_read()
852 FANOTIFY_PERM(event), FAN_DENY, NULL); in fanotify_read()
856 list_add_tail(&event->fse.list, in fanotify_read()
923 struct fanotify_perm_event *event; in fanotify_release() local
925 event = list_first_entry(&group->fanotify_data.access_list, in fanotify_release()
927 list_del_init(&event->fae.fse.list); in fanotify_release()
928 finish_permission_event(group, event, FAN_ALLOW, NULL); in fanotify_release()
938 struct fanotify_event *event = FANOTIFY_E(fsn_event); in fanotify_release() local
940 if (!(event->mask & FANOTIFY_PERM_EVENTS)) { in fanotify_release()
944 finish_permission_event(group, FANOTIFY_PERM(event), in fanotify_release()