Lines Matching refs:file
62 #define do_for_each_event_file(tr, file) \ argument
64 list_for_each_entry(file, &tr->events, list)
66 #define do_for_each_event_file_safe(tr, file) \ argument
69 list_for_each_entry_safe(file, ___n, &tr->events, list)
283 struct trace_event_file *file = data; in trace_event_reg() local
290 file); in trace_event_reg()
294 file); in trace_event_reg()
320 struct trace_event_file *file; in trace_event_enable_cmd_record() local
325 do_for_each_event_file(tr, file) { in trace_event_enable_cmd_record()
327 if (!(file->flags & EVENT_FILE_FL_ENABLED)) in trace_event_enable_cmd_record()
332 set_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in trace_event_enable_cmd_record()
335 clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in trace_event_enable_cmd_record()
342 struct trace_event_file *file; in trace_event_enable_tgid_record() local
347 do_for_each_event_file(tr, file) { in trace_event_enable_tgid_record()
348 if (!(file->flags & EVENT_FILE_FL_ENABLED)) in trace_event_enable_tgid_record()
353 set_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags); in trace_event_enable_tgid_record()
357 &file->flags); in trace_event_enable_tgid_record()
362 static int __ftrace_event_enable_disable(struct trace_event_file *file, in __ftrace_event_enable_disable() argument
365 struct trace_event_call *call = file->event_call; in __ftrace_event_enable_disable()
366 struct trace_array *tr = file->tr; in __ftrace_event_enable_disable()
367 unsigned long file_flags = file->flags; in __ftrace_event_enable_disable()
387 if (atomic_dec_return(&file->sm_ref) > 0) in __ftrace_event_enable_disable()
389 disable = file->flags & EVENT_FILE_FL_SOFT_DISABLED; in __ftrace_event_enable_disable()
390 clear_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags); in __ftrace_event_enable_disable()
392 disable = !(file->flags & EVENT_FILE_FL_SOFT_MODE); in __ftrace_event_enable_disable()
394 if (disable && (file->flags & EVENT_FILE_FL_ENABLED)) { in __ftrace_event_enable_disable()
395 clear_bit(EVENT_FILE_FL_ENABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
396 if (file->flags & EVENT_FILE_FL_RECORDED_CMD) { in __ftrace_event_enable_disable()
398 clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in __ftrace_event_enable_disable()
401 if (file->flags & EVENT_FILE_FL_RECORDED_TGID) { in __ftrace_event_enable_disable()
403 clear_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags); in __ftrace_event_enable_disable()
406 call->class->reg(call, TRACE_REG_UNREGISTER, file); in __ftrace_event_enable_disable()
409 if (file->flags & EVENT_FILE_FL_SOFT_MODE) in __ftrace_event_enable_disable()
410 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
412 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
424 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
426 if (atomic_inc_return(&file->sm_ref) > 1) in __ftrace_event_enable_disable()
428 set_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags); in __ftrace_event_enable_disable()
431 if (!(file->flags & EVENT_FILE_FL_ENABLED)) { in __ftrace_event_enable_disable()
436 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
441 set_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); in __ftrace_event_enable_disable()
447 set_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags); in __ftrace_event_enable_disable()
450 ret = call->class->reg(call, TRACE_REG_REGISTER, file); in __ftrace_event_enable_disable()
460 set_bit(EVENT_FILE_FL_ENABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
463 set_bit(EVENT_FILE_FL_WAS_ENABLED_BIT, &file->flags); in __ftrace_event_enable_disable()
470 (file->flags & EVENT_FILE_FL_SOFT_DISABLED)) { in __ftrace_event_enable_disable()
471 if (file->flags & EVENT_FILE_FL_SOFT_DISABLED) in __ftrace_event_enable_disable()
480 int trace_event_enable_disable(struct trace_event_file *file, in trace_event_enable_disable() argument
483 return __ftrace_event_enable_disable(file, enable, soft_disable); in trace_event_enable_disable()
486 static int ftrace_event_enable_disable(struct trace_event_file *file, in ftrace_event_enable_disable() argument
489 return __ftrace_event_enable_disable(file, enable, 0); in ftrace_event_enable_disable()
494 struct trace_event_file *file; in ftrace_clear_events() local
497 list_for_each_entry(file, &tr->events, list) { in ftrace_clear_events()
498 ftrace_event_enable_disable(file, 0); in ftrace_clear_events()
603 struct trace_event_file *file; in __ftrace_clear_event_pids() local
623 list_for_each_entry(file, &tr->events, list) { in __ftrace_clear_event_pids()
624 clear_bit(EVENT_FILE_FL_PID_FILTER_BIT, &file->flags); in __ftrace_clear_event_pids()
706 static void remove_event_file_dir(struct trace_event_file *file) in remove_event_file_dir() argument
708 struct dentry *dir = file->dir; in remove_event_file_dir()
722 list_del(&file->list); in remove_event_file_dir()
723 remove_subsystem(file->system); in remove_event_file_dir()
724 free_event_filter(file->filter); in remove_event_file_dir()
725 kmem_cache_free(file_cachep, file); in remove_event_file_dir()
735 struct trace_event_file *file; in __ftrace_set_clr_event_nolock() local
741 list_for_each_entry(file, &tr->events, list) { in __ftrace_set_clr_event_nolock()
743 call = file->event_call; in __ftrace_set_clr_event_nolock()
763 ret = ftrace_event_enable_disable(file, set); in __ftrace_set_clr_event_nolock()
857 ftrace_event_write(struct file *file, const char __user *ubuf, in ftrace_event_write() argument
861 struct seq_file *m = file->private_data; in ftrace_event_write()
899 struct trace_event_file *file = v; in t_next() local
905 list_for_each_entry_continue(file, &tr->events, list) { in t_next()
906 call = file->event_call; in t_next()
913 return file; in t_next()
921 struct trace_event_file *file; in t_start() local
927 file = list_entry(&tr->events, struct trace_event_file, list); in t_start()
929 file = t_next(m, file, &l); in t_start()
930 if (!file) in t_start()
933 return file; in t_start()
939 struct trace_event_file *file = v; in s_next() local
944 list_for_each_entry_continue(file, &tr->events, list) { in s_next()
945 if (file->flags & EVENT_FILE_FL_ENABLED) in s_next()
946 return file; in s_next()
954 struct trace_event_file *file; in s_start() local
960 file = list_entry(&tr->events, struct trace_event_file, list); in s_start()
962 file = s_next(m, file, &l); in s_start()
963 if (!file) in s_start()
966 return file; in s_start()
971 struct trace_event_file *file = v; in t_show() local
972 struct trace_event_call *call = file->event_call; in t_show()
1026 event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, in event_enable_read()
1029 struct trace_event_file *file; in event_enable_read() local
1034 file = event_file_data(filp); in event_enable_read()
1035 if (likely(file)) in event_enable_read()
1036 flags = file->flags; in event_enable_read()
1039 if (!file) in event_enable_read()
1056 event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, in event_enable_write()
1059 struct trace_event_file *file; in event_enable_write() local
1076 file = event_file_data(filp); in event_enable_write()
1077 if (likely(file)) in event_enable_write()
1078 ret = ftrace_event_enable_disable(file, val); in event_enable_write()
1092 system_enable_read(struct file *filp, char __user *ubuf, size_t cnt, in system_enable_read()
1099 struct trace_event_file *file; in system_enable_read() local
1106 list_for_each_entry(file, &tr->events, list) { in system_enable_read()
1107 call = file->event_call; in system_enable_read()
1119 set |= (1 << !!(file->flags & EVENT_FILE_FL_ENABLED)); in system_enable_read()
1138 system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, in system_enable_write()
1293 static int trace_format_open(struct inode *inode, struct file *file) in trace_format_open() argument
1300 ret = seq_open(file, &trace_format_seq_ops); in trace_format_open()
1304 m = file->private_data; in trace_format_open()
1305 m->private = file; in trace_format_open()
1311 event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) in event_id_read()
1326 event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, in event_filter_read()
1329 struct trace_event_file *file; in event_filter_read() local
1344 file = event_file_data(filp); in event_filter_read()
1345 if (file) in event_filter_read()
1346 print_event_filter(file, s); in event_filter_read()
1349 if (file) in event_filter_read()
1359 event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, in event_filter_write()
1362 struct trace_event_file *file; in event_filter_write() local
1374 file = event_file_data(filp); in event_filter_write()
1375 if (file) in event_filter_write()
1376 err = apply_event_filter(file, buf); in event_filter_write()
1390 static int subsystem_open(struct inode *inode, struct file *filp) in subsystem_open()
1440 static int system_tr_open(struct inode *inode, struct file *filp) in system_tr_open()
1462 static int subsystem_release(struct inode *inode, struct file *file) in subsystem_release() argument
1464 struct trace_subsystem_dir *dir = file->private_data; in subsystem_release()
1482 subsystem_filter_read(struct file *filp, char __user *ubuf, size_t cnt, in subsystem_filter_read()
1509 subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, in subsystem_filter_write()
1534 show_header(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) in show_header()
1575 ftrace_event_pid_write(struct file *filp, const char __user *ubuf, in ftrace_event_pid_write()
1582 struct trace_event_file *file; in ftrace_event_pid_write() local
1603 list_for_each_entry(file, &tr->events, list) { in ftrace_event_pid_write()
1604 set_bit(EVENT_FILE_FL_PID_FILTER_BIT, &file->flags); in ftrace_event_pid_write()
1654 static int ftrace_event_avail_open(struct inode *inode, struct file *file);
1655 static int ftrace_event_set_open(struct inode *inode, struct file *file);
1656 static int ftrace_event_set_pid_open(struct inode *inode, struct file *file);
1657 static int ftrace_event_release(struct inode *inode, struct file *file);
1760 ftrace_event_open(struct inode *inode, struct file *file, in ftrace_event_open() argument
1770 ret = seq_open(file, seq_ops); in ftrace_event_open()
1773 m = file->private_data; in ftrace_event_open()
1780 static int ftrace_event_release(struct inode *inode, struct file *file) in ftrace_event_release() argument
1786 return seq_release(inode, file); in ftrace_event_release()
1790 ftrace_event_avail_open(struct inode *inode, struct file *file) in ftrace_event_avail_open() argument
1795 return ftrace_event_open(inode, file, seq_ops); in ftrace_event_avail_open()
1799 ftrace_event_set_open(struct inode *inode, struct file *file) in ftrace_event_set_open() argument
1809 if ((file->f_mode & FMODE_WRITE) && in ftrace_event_set_open()
1810 (file->f_flags & O_TRUNC)) in ftrace_event_set_open()
1813 ret = ftrace_event_open(inode, file, seq_ops); in ftrace_event_set_open()
1820 ftrace_event_set_pid_open(struct inode *inode, struct file *file) in ftrace_event_set_pid_open() argument
1830 if ((file->f_mode & FMODE_WRITE) && in ftrace_event_set_pid_open()
1831 (file->f_flags & O_TRUNC)) in ftrace_event_set_pid_open()
1834 ret = ftrace_event_open(inode, file, seq_ops); in ftrace_event_set_pid_open()
1875 struct trace_event_file *file, struct dentry *parent) in event_subsystem_dir() argument
1886 file->system = dir; in event_subsystem_dir()
1922 file->system = dir; in event_subsystem_dir()
1949 event_create_dir(struct dentry *parent, struct trace_event_file *file) in event_create_dir() argument
1951 struct trace_event_call *call = file->event_call; in event_create_dir()
1952 struct trace_array *tr = file->tr; in event_create_dir()
1963 d_events = event_subsystem_dir(tr, call->class->system, file, parent); in event_create_dir()
1970 file->dir = tracefs_create_dir(name, d_events); in event_create_dir()
1971 if (!file->dir) { in event_create_dir()
1977 trace_create_file("enable", 0644, file->dir, file, in event_create_dir()
1982 trace_create_file("id", 0444, file->dir, in event_create_dir()
2006 trace_create_file("filter", 0644, file->dir, file, in event_create_dir()
2009 trace_create_file("trigger", 0644, file->dir, file, in event_create_dir()
2014 trace_create_file("hist", 0444, file->dir, file, in event_create_dir()
2017 trace_create_file("format", 0444, file->dir, call, in event_create_dir()
2025 struct trace_event_file *file; in remove_event_from_tracers() local
2028 do_for_each_event_file_safe(tr, file) { in remove_event_from_tracers()
2029 if (file->event_call != call) in remove_event_from_tracers()
2032 remove_event_file_dir(file); in remove_event_from_tracers()
2046 struct trace_event_file *file; in event_remove() local
2048 do_for_each_event_file(tr, file) { in event_remove()
2049 if (file->event_call != call) in event_remove()
2052 if (file->flags & EVENT_FILE_FL_WAS_ENABLED) in event_remove()
2055 ftrace_event_enable_disable(file, 0); in event_remove()
2247 struct trace_event_file *file; in trace_create_new_event() local
2249 file = kmem_cache_alloc(file_cachep, GFP_TRACE); in trace_create_new_event()
2250 if (!file) in trace_create_new_event()
2253 file->event_call = call; in trace_create_new_event()
2254 file->tr = tr; in trace_create_new_event()
2255 atomic_set(&file->sm_ref, 0); in trace_create_new_event()
2256 atomic_set(&file->tm_ref, 0); in trace_create_new_event()
2257 INIT_LIST_HEAD(&file->triggers); in trace_create_new_event()
2258 list_add(&file->list, &tr->events); in trace_create_new_event()
2260 return file; in trace_create_new_event()
2267 struct trace_event_file *file; in __trace_add_new_event() local
2269 file = trace_create_new_event(call, tr); in __trace_add_new_event()
2270 if (!file) in __trace_add_new_event()
2273 return event_create_dir(tr->event_dir, file); in __trace_add_new_event()
2285 struct trace_event_file *file; in __trace_early_add_new_event() local
2287 file = trace_create_new_event(call, tr); in __trace_early_add_new_event()
2288 if (!file) in __trace_early_add_new_event()
2328 struct trace_event_file *file; in probe_remove_event_call() local
2334 do_for_each_event_file(tr, file) { in probe_remove_event_call()
2335 if (file->event_call != call) in probe_remove_event_call()
2342 if (file->flags & EVENT_FILE_FL_ENABLED) in probe_remove_event_call()
2472 struct trace_event_file *file; in __find_event_file() local
2476 list_for_each_entry(file, &tr->events, list) { in __find_event_file()
2478 call = file->event_call; in __find_event_file()
2486 return file; in __find_event_file()
2495 struct trace_event_file *file; in find_event_file() local
2497 file = __find_event_file(tr, system, event); in find_event_file()
2498 if (!file || !file->event_call->class->reg || in find_event_file()
2499 file->event_call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) in find_event_file()
2502 return file; in find_event_file()
2512 struct trace_event_file *file; member
2521 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &data->file->flags); in update_event_probe()
2523 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &data->file->flags); in update_event_probe()
2562 if (edata->enable == !(edata->file->flags & EVENT_FILE_FL_SOFT_DISABLED)) in event_enable_count_probe()
2590 edata->file->event_call->class->system, in event_enable_print()
2591 trace_event_name(edata->file->event_call)); in event_enable_print()
2632 __ftrace_event_enable_disable(edata->file, 0, 1); in free_probe_data()
2633 module_put(edata->file->event_call->mod); in free_probe_data()
2696 struct trace_event_file *file; in event_enable_func() local
2721 file = find_event_file(tr, system, event); in event_enable_func()
2722 if (!file) in event_enable_func()
2745 data->file = file; in event_enable_func()
2766 ret = try_module_get(file->event_call->mod); in event_enable_func()
2772 ret = __ftrace_event_enable_disable(file, 1, 1); in event_enable_func()
2794 __ftrace_event_enable_disable(file, 0, 1); in event_enable_func()
2796 module_put(file->event_call->mod); in event_enable_func()
2838 struct trace_event_file *file; in __trace_early_add_event_dirs() local
2842 list_for_each_entry(file, &tr->events, list) { in __trace_early_add_event_dirs()
2843 ret = event_create_dir(tr->event_dir, file); in __trace_early_add_event_dirs()
2846 trace_event_name(file->event_call)); in __trace_early_add_event_dirs()
2878 struct trace_event_file *file, *next; in __trace_remove_event_dirs() local
2880 list_for_each_entry_safe(file, next, &tr->events, list) in __trace_remove_event_dirs()
2881 remove_event_file_dir(file); in __trace_remove_event_dirs()
3244 struct trace_event_file *file; in event_trace_self_tests() local
3256 list_for_each_entry(file, &tr->events, list) { in event_trace_self_tests()
3258 call = file->event_call; in event_trace_self_tests()
3282 if (file->flags & EVENT_FILE_FL_ENABLED) { in event_trace_self_tests()
3288 ftrace_event_enable_disable(file, 1); in event_trace_self_tests()
3290 ftrace_event_enable_disable(file, 0); in event_trace_self_tests()