Lines Matching refs:user
98 typedef void (*user_event_func_t) (struct user_event *user, struct iov_iter *i,
125 struct user_event *user = (struct user_event *)call->data; in user_event_get_fields() local
127 return &user->fields; in user_event_get_fields()
234 static void user_event_destroy_validators(struct user_event *user) in user_event_destroy_validators() argument
237 struct list_head *head = &user->validators; in user_event_destroy_validators()
245 static void user_event_destroy_fields(struct user_event *user) in user_event_destroy_fields() argument
248 struct list_head *head = &user->fields; in user_event_destroy_fields()
256 static int user_event_add_field(struct user_event *user, const char *type, in user_event_add_field() argument
294 list_add_tail(&validator->link, &user->validators); in user_event_add_field()
304 list_add(&field->link, &user->fields); in user_event_add_field()
310 user->min_size = (offset + size) - sizeof(struct trace_entry); in user_event_add_field()
319 static int user_event_parse_field(char *field, struct user_event *user, in user_event_parse_field() argument
406 return user_event_add_field(user, type, name, saved_offset, size, in user_event_parse_field()
410 static int user_event_parse_fields(struct user_event *user, char *args) in user_event_parse_fields() argument
420 ret = user_event_parse_field(field, user, &offset); in user_event_parse_fields()
486 static int user_event_set_print_fmt(struct user_event *user, char *buf, int len) in user_event_set_print_fmt() argument
489 struct list_head *head = &user->fields; in user_event_set_print_fmt()
520 static int user_event_create_print_fmt(struct user_event *user) in user_event_create_print_fmt() argument
525 len = user_event_set_print_fmt(user, NULL, 0); in user_event_create_print_fmt()
532 user_event_set_print_fmt(user, print_fmt, len); in user_event_create_print_fmt()
534 user->call.print_fmt = print_fmt; in user_event_create_print_fmt()
554 static int user_event_set_call_visible(struct user_event *user, bool visible) in user_event_set_call_visible() argument
579 ret = trace_add_event_call(&user->call); in user_event_set_call_visible()
581 ret = trace_remove_event_call(&user->call); in user_event_set_call_visible()
589 static int destroy_user_event(struct user_event *user) in destroy_user_event() argument
594 user_event_destroy_fields(user); in destroy_user_event()
596 ret = user_event_set_call_visible(user, false); in destroy_user_event()
601 dyn_event_remove(&user->devent); in destroy_user_event()
603 register_page_data[user->index] = 0; in destroy_user_event()
604 clear_bit(user->index, page_bitmap); in destroy_user_event()
605 hash_del(&user->node); in destroy_user_event()
607 user_event_destroy_validators(user); in destroy_user_event()
608 kfree(user->call.print_fmt); in destroy_user_event()
609 kfree(EVENT_NAME(user)); in destroy_user_event()
610 kfree(user); in destroy_user_event()
617 struct user_event *user; in find_user_event() local
622 hash_for_each_possible(register_table, user, node, key) in find_user_event()
623 if (!strcmp(EVENT_NAME(user), name)) { in find_user_event()
624 atomic_inc(&user->refcnt); in find_user_event()
625 return user; in find_user_event()
631 static int user_event_validate(struct user_event *user, void *data, int len) in user_event_validate() argument
633 struct list_head *head = &user->validators; in user_event_validate()
667 static void user_event_ftrace(struct user_event *user, struct iov_iter *i, in user_event_ftrace() argument
691 if (!list_empty(&user->validators) && in user_event_ftrace()
692 unlikely(user_event_validate(user, entry, size))) in user_event_ftrace()
708 static void user_event_perf(struct user_event *user, struct iov_iter *i, in user_event_perf() argument
713 perf_head = this_cpu_ptr(user->call.perf_events); in user_event_perf()
732 if (!list_empty(&user->validators) && in user_event_perf()
733 unlikely(user_event_validate(user, perf_entry, size))) in user_event_perf()
737 user->call.event.type, 1, regs, in user_event_perf()
751 static void update_reg_page_for(struct user_event *user) in update_reg_page_for() argument
753 struct tracepoint *tp = &user->tracepoint; in update_reg_page_for()
782 register_page_data[user->index] = status; in update_reg_page_for()
792 struct user_event *user = (struct user_event *)call->data; in user_event_reg() local
795 if (!user) in user_event_reg()
838 atomic_inc(&user->refcnt); in user_event_reg()
839 update_reg_page_for(user); in user_event_reg()
842 update_reg_page_for(user); in user_event_reg()
843 atomic_dec(&user->refcnt); in user_event_reg()
849 struct user_event *user; in user_event_create() local
866 ret = user_event_parse_cmd(name, &user); in user_event_create()
869 atomic_dec(&user->refcnt); in user_event_create()
881 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_show() local
886 seq_printf(m, "%s%s", USER_EVENTS_PREFIX, EVENT_NAME(user)); in user_event_show()
888 head = trace_get_fields(&user->call); in user_event_show()
911 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_is_busy() local
913 return atomic_read(&user->refcnt) != 0; in user_event_is_busy()
918 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_free() local
920 if (atomic_read(&user->refcnt) != 0) in user_event_free()
923 return destroy_user_event(user); in user_event_free()
977 static bool user_fields_match(struct user_event *user, int argc, in user_fields_match() argument
981 struct list_head *head = &user->fields; in user_fields_match()
997 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_match() local
1000 match = strcmp(EVENT_NAME(user), event) == 0 && in user_event_match()
1004 match = user_fields_match(user, argc, argv); in user_event_match()
1017 static int user_event_trace_register(struct user_event *user) in user_event_trace_register() argument
1021 ret = register_trace_event(&user->call.event); in user_event_trace_register()
1026 ret = user_event_set_call_visible(user, true); in user_event_trace_register()
1029 unregister_trace_event(&user->call.event); in user_event_trace_register()
1045 struct user_event *user; in user_event_parse() local
1049 user = find_user_event(name, &key); in user_event_parse()
1052 if (user) { in user_event_parse()
1053 *newuser = user; in user_event_parse()
1067 user = kzalloc(sizeof(*user), GFP_KERNEL); in user_event_parse()
1069 if (!user) in user_event_parse()
1072 INIT_LIST_HEAD(&user->class.fields); in user_event_parse()
1073 INIT_LIST_HEAD(&user->fields); in user_event_parse()
1074 INIT_LIST_HEAD(&user->validators); in user_event_parse()
1076 user->tracepoint.name = name; in user_event_parse()
1078 ret = user_event_parse_fields(user, args); in user_event_parse()
1083 ret = user_event_create_print_fmt(user); in user_event_parse()
1088 user->call.data = user; in user_event_parse()
1089 user->call.class = &user->class; in user_event_parse()
1090 user->call.name = name; in user_event_parse()
1091 user->call.flags = TRACE_EVENT_FL_TRACEPOINT; in user_event_parse()
1092 user->call.tp = &user->tracepoint; in user_event_parse()
1093 user->call.event.funcs = &user_event_funcs; in user_event_parse()
1095 user->class.system = USER_EVENTS_SYSTEM; in user_event_parse()
1096 user->class.fields_array = user_event_fields_array; in user_event_parse()
1097 user->class.get_fields = user_event_get_fields; in user_event_parse()
1098 user->class.reg = user_event_reg; in user_event_parse()
1099 user->class.probe = user_event_ftrace; in user_event_parse()
1101 user->class.perf_probe = user_event_perf; in user_event_parse()
1106 ret = user_event_trace_register(user); in user_event_parse()
1111 user->index = index; in user_event_parse()
1114 atomic_inc(&user->refcnt); in user_event_parse()
1116 dyn_event_init(&user->devent, &user_event_dops); in user_event_parse()
1117 dyn_event_add(&user->devent, &user->call); in user_event_parse()
1118 set_bit(user->index, page_bitmap); in user_event_parse()
1119 hash_add(register_table, &user->node, key); in user_event_parse()
1123 *newuser = user; in user_event_parse()
1128 user_event_destroy_fields(user); in user_event_parse()
1129 user_event_destroy_validators(user); in user_event_parse()
1130 kfree(user); in user_event_parse()
1141 struct user_event *user = find_user_event(name, &key); in delete_user_event() local
1143 if (!user) in delete_user_event()
1147 if (atomic_read(&user->refcnt) != 1) { in delete_user_event()
1152 ret = destroy_user_event(user); in delete_user_event()
1160 atomic_dec(&user->refcnt); in delete_user_event()
1171 struct user_event *user = NULL; in user_events_write_core() local
1189 user = refs->events[idx]; in user_events_write_core()
1193 if (unlikely(user == NULL)) in user_events_write_core()
1196 if (unlikely(i->count < user->min_size)) in user_events_write_core()
1199 tp = &user->tracepoint; in user_events_write_core()
1226 probe_func(user, ©, tpdata, &faulted); in user_events_write_core()
1259 static int user_events_ref_add(struct file *file, struct user_event *user) in user_events_ref_add() argument
1271 if (refs->events[i] == user) in user_events_ref_add()
1287 new_refs->events[i] = user; in user_events_ref_add()
1289 atomic_inc(&user->refcnt); in user_events_ref_add()
1322 struct user_event *user; in user_events_ioctl_reg() local
1339 ret = user_event_parse_cmd(name, &user); in user_events_ioctl_reg()
1346 ret = user_events_ref_add(file, user); in user_events_ioctl_reg()
1349 atomic_dec(&user->refcnt); in user_events_ioctl_reg()
1356 put_user(user->index, &ureg->status_index); in user_events_ioctl_reg()
1416 struct user_event *user; in user_events_release() local
1436 user = refs->events[i]; in user_events_release()
1438 if (user) in user_events_release()
1439 atomic_dec(&user->refcnt); in user_events_release()
1493 struct user_event *user; in user_seq_show() local
1499 hash_for_each(register_table, i, user, node) { in user_seq_show()
1500 status = register_page_data[user->index]; in user_seq_show()
1501 flags = user->flags; in user_seq_show()
1503 seq_printf(m, "%d:%s", user->index, EVENT_NAME(user)); in user_seq_show()