Lines Matching refs:file

72 #define do_for_each_event_file(tr, file)			\  argument
74 list_for_each_entry(file, &tr->events, list)
76 #define do_for_each_event_file_safe(tr, file) \ argument
79 list_for_each_entry_safe(file, ___n, &tr->events, list)
703 struct trace_event_file *file = data; in trace_event_reg() local
710 file); in trace_event_reg()
714 file); in trace_event_reg()
742 struct trace_event_file *file; in trace_event_enable_cmd_record() local
747 do_for_each_event_file(tr, file) { in trace_event_enable_cmd_record()
749 if (!(file->flags & EVENT_FILE_FL_ENABLED)) in trace_event_enable_cmd_record()
754 set_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in trace_event_enable_cmd_record()
757 clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in trace_event_enable_cmd_record()
764 struct trace_event_file *file; in trace_event_enable_tgid_record() local
769 do_for_each_event_file(tr, file) { in trace_event_enable_tgid_record()
770 if (!(file->flags & EVENT_FILE_FL_ENABLED)) in trace_event_enable_tgid_record()
775 set_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags); in trace_event_enable_tgid_record()
779 &file->flags); in trace_event_enable_tgid_record()
784 static int __ftrace_event_enable_disable(struct trace_event_file *file, in __ftrace_event_enable_disable() argument
787 struct trace_event_call *call = file->event_call; in __ftrace_event_enable_disable()
788 struct trace_array *tr = file->tr; in __ftrace_event_enable_disable()
789 bool soft_mode = atomic_read(&file->sm_ref) != 0; in __ftrace_event_enable_disable()
809 if (atomic_dec_return(&file->sm_ref) > 0) in __ftrace_event_enable_disable()
811 disable = file->flags & EVENT_FILE_FL_SOFT_DISABLED; in __ftrace_event_enable_disable()
818 if (disable && (file->flags & EVENT_FILE_FL_ENABLED)) { in __ftrace_event_enable_disable()
819 clear_bit(EVENT_FILE_FL_ENABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
820 if (file->flags & EVENT_FILE_FL_RECORDED_CMD) { in __ftrace_event_enable_disable()
822 clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in __ftrace_event_enable_disable()
825 if (file->flags & EVENT_FILE_FL_RECORDED_TGID) { in __ftrace_event_enable_disable()
827 clear_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags); in __ftrace_event_enable_disable()
830 ret = call->class->reg(call, TRACE_REG_UNREGISTER, file); in __ftrace_event_enable_disable()
836 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
838 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
850 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
852 if (atomic_inc_return(&file->sm_ref) > 1) in __ftrace_event_enable_disable()
858 if (!(file->flags & EVENT_FILE_FL_ENABLED)) { in __ftrace_event_enable_disable()
863 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
868 set_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in __ftrace_event_enable_disable()
874 set_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags); in __ftrace_event_enable_disable()
877 ret = call->class->reg(call, TRACE_REG_REGISTER, file); in __ftrace_event_enable_disable()
887 set_bit(EVENT_FILE_FL_ENABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
890 set_bit(EVENT_FILE_FL_WAS_ENABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
898 int trace_event_enable_disable(struct trace_event_file *file, in trace_event_enable_disable() argument
901 return __ftrace_event_enable_disable(file, enable, soft_disable); in trace_event_enable_disable()
904 static int ftrace_event_enable_disable(struct trace_event_file *file, in ftrace_event_enable_disable() argument
907 return __ftrace_event_enable_disable(file, enable, 0); in ftrace_event_enable_disable()
1026 struct trace_event_file *file; in ftrace_clear_events() local
1029 list_for_each_entry(file, &tr->events, list) { in ftrace_clear_events()
1030 ftrace_event_enable_disable(file, 0); in ftrace_clear_events()
1180 struct trace_event_file *file; in __ftrace_clear_event_pids() local
1195 list_for_each_entry(file, &tr->events, list) { in __ftrace_clear_event_pids()
1196 clear_bit(EVENT_FILE_FL_PID_FILTER_BIT, &file->flags); in __ftrace_clear_event_pids()
1287 void event_file_get(struct trace_event_file *file) in event_file_get() argument
1289 refcount_inc(&file->ref); in event_file_get()
1292 void event_file_put(struct trace_event_file *file) in event_file_put() argument
1294 if (WARN_ON_ONCE(!refcount_read(&file->ref))) { in event_file_put()
1295 if (file->flags & EVENT_FILE_FL_FREED) in event_file_put()
1296 kmem_cache_free(file_cachep, file); in event_file_put()
1300 if (refcount_dec_and_test(&file->ref)) { in event_file_put()
1302 if (WARN_ON_ONCE(!(file->flags & EVENT_FILE_FL_FREED))) in event_file_put()
1304 kmem_cache_free(file_cachep, file); in event_file_put()
1308 static void remove_event_file_dir(struct trace_event_file *file) in remove_event_file_dir() argument
1310 eventfs_remove_dir(file->ei); in remove_event_file_dir()
1311 list_del(&file->list); in remove_event_file_dir()
1312 remove_subsystem(file->system); in remove_event_file_dir()
1313 free_event_filter(file->filter); in remove_event_file_dir()
1314 file->flags |= EVENT_FILE_FL_FREED; in remove_event_file_dir()
1315 event_file_put(file); in remove_event_file_dir()
1329 struct trace_event_file *file; in __ftrace_set_clr_event_nolock() local
1348 list_for_each_entry(file, &tr->events, list) { in __ftrace_set_clr_event_nolock()
1350 call = file->event_call; in __ftrace_set_clr_event_nolock()
1375 ret = ftrace_event_enable_disable(file, set); in __ftrace_set_clr_event_nolock()
1517 ftrace_event_write(struct file *file, const char __user *ubuf, in ftrace_event_write() argument
1521 struct seq_file *m = file->private_data; in ftrace_event_write()
1559 struct trace_event_file *file = v; in t_next() local
1565 list_for_each_entry_continue(file, &tr->events, list) { in t_next()
1566 call = file->event_call; in t_next()
1573 return file; in t_next()
1581 struct trace_event_file *file; in t_start() local
1587 file = list_entry(&tr->events, struct trace_event_file, list); in t_start()
1589 file = t_next(m, file, &l); in t_start()
1590 if (!file) in t_start()
1593 return file; in t_start()
1604 struct trace_event_file *file; member
1613 struct trace_event_file *file; in s_next() local
1619 file = iter->file; in s_next()
1620 list_for_each_entry_continue(file, &tr->events, list) { in s_next()
1621 if (file->flags & EVENT_FILE_FL_ENABLED) { in s_next()
1622 iter->file = file; in s_next()
1659 iter->file = list_entry(&tr->events, struct trace_event_file, list); in s_start()
1671 struct trace_event_file *file = v; in t_show() local
1672 struct trace_event_call *call = file->event_call; in t_show()
1709 struct trace_event_file *file = v; in t_show_filters() local
1710 struct trace_event_call *call = file->event_call; in t_show_filters()
1715 filter = rcu_dereference(file->filter); in t_show_filters()
1738 struct trace_event_file *file = v; in t_show_triggers() local
1739 struct trace_event_call *call = file->event_call; in t_show_triggers()
1747 if (list_empty(&file->triggers)) in t_show_triggers()
1752 list_for_each_entry_rcu(data, &file->triggers, list) { in t_show_triggers()
1770 return t_show(m, iter->file); in s_show()
1791 return t_show(m, iter->file); in s_show()
1873 event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, in event_enable_read()
1876 struct trace_event_file *file; in event_enable_read() local
1881 file = event_file_file(filp); in event_enable_read()
1882 if (likely(file)) in event_enable_read()
1883 flags = file->flags; in event_enable_read()
1886 if (!file) in event_enable_read()
1893 if (atomic_read(&file->sm_ref) != 0) in event_enable_read()
1902 event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, in event_enable_write()
1905 struct trace_event_file *file; in event_enable_write() local
1918 file = event_file_file(filp); in event_enable_write()
1919 if (!file) in event_enable_write()
1921 ret = tracing_update_buffers(file->tr); in event_enable_write()
1924 ret = ftrace_event_enable_disable(file, val); in event_enable_write()
1948 struct trace_event_file *file; in trace_events_enabled() local
1953 list_for_each_entry(file, &tr->events, list) { in trace_events_enabled()
1954 call = file->event_call; in trace_events_enabled()
1967 set |= (1 << !!(file->flags & EVENT_FILE_FL_ENABLED)); in trace_events_enabled()
1980 system_enable_read(struct file *filp, char __user *ubuf, size_t cnt, in system_enable_read()
2002 system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, in system_enable_write()
2049 struct trace_event_file *file = event_file_data(m->private); in f_next() local
2050 struct trace_event_call *call = file->event_call; in f_next()
2082 struct trace_event_file *file = event_file_data(m->private); in f_show() local
2083 struct trace_event_call *call = file->event_call; in f_show()
2138 struct trace_event_file *file; in f_start() local
2144 file = event_file_file(m->private); in f_start()
2145 if (!file) in f_start()
2166 static int trace_format_open(struct inode *inode, struct file *file) in trace_format_open() argument
2173 ret = seq_open(file, &trace_format_seq_ops); in trace_format_open()
2177 m = file->private_data; in trace_format_open()
2178 m->private = file; in trace_format_open()
2185 event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) in event_id_read()
2201 event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, in event_filter_read()
2204 struct trace_event_file *file; in event_filter_read() local
2219 file = event_file_file(filp); in event_filter_read()
2220 if (file) in event_filter_read()
2221 print_event_filter(file, s); in event_filter_read()
2224 if (file) in event_filter_read()
2234 event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, in event_filter_write()
2237 struct trace_event_file *file; in event_filter_write() local
2249 file = event_file_file(filp); in event_filter_write()
2250 if (file) { in event_filter_write()
2251 if (file->flags & EVENT_FILE_FL_FREED) in event_filter_write()
2254 err = apply_event_filter(file, buf); in event_filter_write()
2269 static int subsystem_open(struct inode *inode, struct file *filp) in subsystem_open()
2318 static int system_tr_open(struct inode *inode, struct file *filp) in system_tr_open()
2340 static int subsystem_release(struct inode *inode, struct file *file) in subsystem_release() argument
2342 struct trace_subsystem_dir *dir = file->private_data; in subsystem_release()
2360 subsystem_filter_read(struct file *filp, char __user *ubuf, size_t cnt, in subsystem_filter_read()
2387 subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, in subsystem_filter_write()
2412 show_header_page_file(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) in show_header_page_file()
2437 show_header_event_file(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) in show_header_event_file()
2509 event_pid_write(struct file *filp, const char __user *ubuf, in event_pid_write()
2517 struct trace_event_file *file; in event_pid_write() local
2550 list_for_each_entry(file, &tr->events, list) { in event_pid_write()
2551 set_bit(EVENT_FILE_FL_PID_FILTER_BIT, &file->flags); in event_pid_write()
2574 ftrace_event_pid_write(struct file *filp, const char __user *ubuf, in ftrace_event_pid_write()
2581 ftrace_event_npid_write(struct file *filp, const char __user *ubuf, in ftrace_event_npid_write()
2587 static int ftrace_event_avail_open(struct inode *inode, struct file *file);
2588 static int ftrace_event_set_open(struct inode *inode, struct file *file);
2589 static int ftrace_event_show_filters_open(struct inode *inode, struct file *file);
2590 static int ftrace_event_show_triggers_open(struct inode *inode, struct file *file);
2591 static int ftrace_event_set_pid_open(struct inode *inode, struct file *file);
2592 static int ftrace_event_set_npid_open(struct inode *inode, struct file *file);
2593 static int ftrace_event_release(struct inode *inode, struct file *file);
2751 ftrace_event_open(struct inode *inode, struct file *file, in ftrace_event_open() argument
2761 ret = seq_open(file, seq_ops); in ftrace_event_open()
2764 m = file->private_data; in ftrace_event_open()
2771 static int ftrace_event_release(struct inode *inode, struct file *file) in ftrace_event_release() argument
2777 return seq_release(inode, file); in ftrace_event_release()
2781 ftrace_event_avail_open(struct inode *inode, struct file *file) in ftrace_event_avail_open() argument
2786 return ftrace_event_open(inode, file, seq_ops); in ftrace_event_avail_open()
2790 ftrace_event_set_open(struct inode *inode, struct file *file) in ftrace_event_set_open() argument
2800 if ((file->f_mode & FMODE_WRITE) && in ftrace_event_set_open()
2801 (file->f_flags & O_TRUNC)) in ftrace_event_set_open()
2804 ret = ftrace_event_open(inode, file, seq_ops); in ftrace_event_set_open()
2819 ftrace_event_show_filters_open(struct inode *inode, struct file *file) in ftrace_event_show_filters_open() argument
2821 return ftrace_event_open(inode, file, &show_show_event_filters_seq_ops); in ftrace_event_show_filters_open()
2833 ftrace_event_show_triggers_open(struct inode *inode, struct file *file) in ftrace_event_show_triggers_open() argument
2835 return ftrace_event_open(inode, file, &show_show_event_triggers_seq_ops); in ftrace_event_show_triggers_open()
2839 ftrace_event_set_pid_open(struct inode *inode, struct file *file) in ftrace_event_set_pid_open() argument
2849 if ((file->f_mode & FMODE_WRITE) && in ftrace_event_set_pid_open()
2850 (file->f_flags & O_TRUNC)) in ftrace_event_set_pid_open()
2853 ret = ftrace_event_open(inode, file, seq_ops); in ftrace_event_set_pid_open()
2860 ftrace_event_set_npid_open(struct inode *inode, struct file *file) in ftrace_event_set_npid_open() argument
2870 if ((file->f_mode & FMODE_WRITE) && in ftrace_event_set_npid_open()
2871 (file->f_flags & O_TRUNC)) in ftrace_event_set_npid_open()
2874 ret = ftrace_event_open(inode, file, seq_ops); in ftrace_event_set_npid_open()
2929 struct trace_event_file *file, struct eventfs_inode *parent) in event_subsystem_dir() argument
2951 file->system = dir; in event_subsystem_dir()
2994 file->system = dir; in event_subsystem_dir()
3050 struct trace_event_file *file = *data; in event_callback() local
3051 struct trace_event_call *call = file->event_call; in event_callback()
3125 struct trace_event_file *file = data; in event_release() local
3127 event_file_put(file); in event_release()
3131 event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file) in event_create_dir() argument
3133 struct trace_event_call *call = file->event_call; in event_create_dir()
3134 struct trace_array *tr = file->tr; in event_create_dir()
3192 e_events = event_subsystem_dir(tr, call->class->system, file, parent); in event_create_dir()
3199 ei = eventfs_create_dir(name, e_events, event_entries, nr_entries, file); in event_create_dir()
3205 file->ei = ei; in event_create_dir()
3214 event_file_get(file); in event_create_dir()
3221 struct trace_event_file *file; in remove_event_from_tracers() local
3224 do_for_each_event_file_safe(tr, file) { in remove_event_from_tracers()
3225 if (file->event_call != call) in remove_event_from_tracers()
3228 remove_event_file_dir(file); in remove_event_from_tracers()
3242 struct trace_event_file *file; in event_remove() local
3244 do_for_each_event_file(tr, file) { in event_remove()
3245 if (file->event_call != call) in event_remove()
3248 if (file->flags & EVENT_FILE_FL_WAS_ENABLED) in event_remove()
3251 ftrace_event_enable_disable(file, 0); in event_remove()
3644 struct trace_event_file *file; in trace_create_new_event() local
3650 file = kmem_cache_alloc(file_cachep, GFP_TRACE); in trace_create_new_event()
3651 if (!file) in trace_create_new_event()
3661 file->flags |= EVENT_FILE_FL_PID_FILTER; in trace_create_new_event()
3663 file->event_call = call; in trace_create_new_event()
3664 file->tr = tr; in trace_create_new_event()
3665 atomic_set(&file->sm_ref, 0); in trace_create_new_event()
3666 atomic_set(&file->tm_ref, 0); in trace_create_new_event()
3667 INIT_LIST_HEAD(&file->triggers); in trace_create_new_event()
3668 list_add(&file->list, &tr->events); in trace_create_new_event()
3669 refcount_set(&file->ref, 1); in trace_create_new_event()
3671 return file; in trace_create_new_event()
3714 struct trace_event_file *file; in __trace_add_new_event() local
3716 file = trace_create_new_event(call, tr); in __trace_add_new_event()
3723 if (!file) in __trace_add_new_event()
3726 if (IS_ERR(file)) in __trace_add_new_event()
3727 return PTR_ERR(file); in __trace_add_new_event()
3730 return event_create_dir(tr->event_dir, file); in __trace_add_new_event()
3735 static void trace_early_triggers(struct trace_event_file *file, const char *name) in trace_early_triggers() argument
3744 ret = trigger_process_regex(file, bootup_triggers[i].trigger); in trace_early_triggers()
3762 struct trace_event_file *file; in __trace_early_add_new_event() local
3765 file = trace_create_new_event(call, tr); in __trace_early_add_new_event()
3772 if (!file) in __trace_early_add_new_event()
3775 if (IS_ERR(file)) in __trace_early_add_new_event()
3776 return PTR_ERR(file); in __trace_early_add_new_event()
3782 trace_early_triggers(file, trace_event_name(call)); in __trace_early_add_new_event()
3820 struct trace_event_file *file; in probe_remove_event_call() local
3826 do_for_each_event_file(tr, file) { in probe_remove_event_call()
3827 if (file->event_call != call) in probe_remove_event_call()
3834 if (file->flags & EVENT_FILE_FL_ENABLED) in probe_remove_event_call()
3837 if (file->flags & EVENT_FILE_FL_WAS_ENABLED) in probe_remove_event_call()
4011 struct trace_event_file *file; in __find_event_file() local
4015 list_for_each_entry(file, &tr->events, list) { in __find_event_file()
4017 call = file->event_call; in __find_event_file()
4025 return file; in __find_event_file()
4034 struct trace_event_file *file; in find_event_file() local
4036 file = __find_event_file(tr, system, event); in find_event_file()
4037 if (!file || !file->event_call->class->reg || in find_event_file()
4038 file->event_call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) in find_event_file()
4041 return file; in find_event_file()
4069 struct trace_event_file *file = NULL; in trace_get_event_file() local
4084 file = find_event_file(tr, system, event); in trace_get_event_file()
4085 if (!file) { in trace_get_event_file()
4091 ret = trace_event_try_get_ref(file->event_call); in trace_get_event_file()
4097 return file; in trace_get_event_file()
4110 void trace_put_event_file(struct trace_event_file *file) in trace_put_event_file() argument
4113 trace_event_put_ref(file->event_call); in trace_put_event_file()
4116 trace_array_put(file->tr); in trace_put_event_file()
4122 struct trace_event_file *file; member
4131 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &data->file->flags); in update_event_probe()
4133 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &data->file->flags); in update_event_probe()
4172 if (edata->enable == !(edata->file->flags & EVENT_FILE_FL_SOFT_DISABLED)) in event_enable_count_probe()
4200 edata->file->event_call->class->system, in event_enable_print()
4201 trace_event_name(edata->file->event_call)); in event_enable_print()
4242 __ftrace_event_enable_disable(edata->file, 0, 1); in free_probe_data()
4243 trace_event_put_ref(edata->file->event_call); in free_probe_data()
4306 struct trace_event_file *file; in event_enable_func() local
4331 file = find_event_file(tr, system, event); in event_enable_func()
4332 if (!file) in event_enable_func()
4361 ret = trace_event_try_get_ref(file->event_call); in event_enable_func()
4365 ret = __ftrace_event_enable_disable(file, 1, 1); in event_enable_func()
4376 data->file = file; in event_enable_func()
4394 __ftrace_event_enable_disable(file, 0, 1); in event_enable_func()
4396 trace_event_put_ref(file->event_call); in event_enable_func()
4435 struct trace_event_file *file; in __trace_early_add_event_dirs() local
4439 list_for_each_entry(file, &tr->events, list) { in __trace_early_add_event_dirs()
4440 ret = event_create_dir(tr->event_dir, file); in __trace_early_add_event_dirs()
4443 trace_event_name(file->event_call)); in __trace_early_add_event_dirs()
4475 struct trace_event_file *file, *next; in __trace_remove_event_dirs() local
4477 list_for_each_entry_safe(file, next, &tr->events, list) in __trace_remove_event_dirs()
4478 remove_event_file_dir(file); in __trace_remove_event_dirs()
4896 struct trace_event_file *file; in event_trace_self_tests() local
4908 list_for_each_entry(file, &tr->events, list) { in event_trace_self_tests()
4910 call = file->event_call; in event_trace_self_tests()
4934 if (file->flags & EVENT_FILE_FL_ENABLED) { in event_trace_self_tests()
4940 ftrace_event_enable_disable(file, 1); in event_trace_self_tests()
4942 ftrace_event_enable_disable(file, 0); in event_trace_self_tests()