Lines Matching defs:file
72 #define do_for_each_event_file(tr, file) \
74 list_for_each_entry(file, &tr->events, list)
76 #define do_for_each_event_file_safe(tr, file) \
79 list_for_each_entry_safe(file, ___n, &tr->events, list)
687 struct trace_event_file *file = data;
694 file);
698 file);
724 struct trace_event_file *file;
729 do_for_each_event_file(tr, file) {
731 if (!(file->flags & EVENT_FILE_FL_ENABLED))
736 set_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags);
739 clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags);
746 struct trace_event_file *file;
751 do_for_each_event_file(tr, file) {
752 if (!(file->flags & EVENT_FILE_FL_ENABLED))
757 set_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags);
761 &file->flags);
766 static int __ftrace_event_enable_disable(struct trace_event_file *file,
769 struct trace_event_call *call = file->event_call;
770 struct trace_array *tr = file->tr;
771 bool soft_mode = atomic_read(&file->sm_ref) != 0;
791 if (atomic_dec_return(&file->sm_ref) > 0)
793 disable = file->flags & EVENT_FILE_FL_SOFT_DISABLED;
800 if (disable && (file->flags & EVENT_FILE_FL_ENABLED)) {
801 clear_bit(EVENT_FILE_FL_ENABLED_BIT, &file->flags);
802 if (file->flags & EVENT_FILE_FL_RECORDED_CMD) {
804 clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags);
807 if (file->flags & EVENT_FILE_FL_RECORDED_TGID) {
809 clear_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags);
812 ret = call->class->reg(call, TRACE_REG_UNREGISTER, file);
818 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags);
820 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags);
832 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags);
834 if (atomic_inc_return(&file->sm_ref) > 1)
841 if (!(file->flags & EVENT_FILE_FL_ENABLED)) {
846 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags);
851 set_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags);
857 set_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags);
860 ret = call->class->reg(call, TRACE_REG_REGISTER, file);
870 set_bit(EVENT_FILE_FL_ENABLED_BIT, &file->flags);
873 set_bit(EVENT_FILE_FL_WAS_ENABLED_BIT, &file->flags);
881 int trace_event_enable_disable(struct trace_event_file *file,
884 return __ftrace_event_enable_disable(file, enable, soft_disable);
887 static int ftrace_event_enable_disable(struct trace_event_file *file,
890 return __ftrace_event_enable_disable(file, enable, 0);
1009 struct trace_event_file *file;
1012 list_for_each_entry(file, &tr->events, list) {
1013 ftrace_event_enable_disable(file, 0);
1161 struct trace_event_file *file;
1176 list_for_each_entry(file, &tr->events, list) {
1177 clear_bit(EVENT_FILE_FL_PID_FILTER_BIT, &file->flags);
1268 void event_file_get(struct trace_event_file *file)
1270 refcount_inc(&file->ref);
1273 void event_file_put(struct trace_event_file *file)
1275 if (WARN_ON_ONCE(!refcount_read(&file->ref))) {
1276 if (file->flags & EVENT_FILE_FL_FREED)
1277 kmem_cache_free(file_cachep, file);
1281 if (refcount_dec_and_test(&file->ref)) {
1283 if (WARN_ON_ONCE(!(file->flags & EVENT_FILE_FL_FREED)))
1285 kmem_cache_free(file_cachep, file);
1289 static void remove_event_file_dir(struct trace_event_file *file)
1291 eventfs_remove_dir(file->ei);
1292 list_del(&file->list);
1293 remove_subsystem(file->system);
1294 free_event_filter(file->filter);
1295 file->flags |= EVENT_FILE_FL_FREED;
1296 event_file_put(file);
1307 struct trace_event_file *file;
1326 list_for_each_entry(file, &tr->events, list) {
1328 call = file->event_call;
1353 ret = ftrace_event_enable_disable(file, set);
1495 ftrace_event_write(struct file *file, const char __user *ubuf,
1499 struct seq_file *m = file->private_data;
1537 struct trace_event_file *file = v;
1543 list_for_each_entry_continue(file, &tr->events, list) {
1544 call = file->event_call;
1551 return file;
1559 struct trace_event_file *file;
1565 file = list_entry(&tr->events, struct trace_event_file, list);
1567 file = t_next(m, file, &l);
1568 if (!file)
1571 return file;
1582 struct trace_event_file *file;
1591 struct trace_event_file *file;
1597 file = iter->file;
1598 list_for_each_entry_continue(file, &tr->events, list) {
1599 if (file->flags & EVENT_FILE_FL_ENABLED) {
1600 iter->file = file;
1638 iter->file = list_entry(&tr->events, struct trace_event_file, list);
1650 struct trace_event_file *file = v;
1651 struct trace_event_call *call = file->event_call;
1673 return t_show(m, iter->file);
1694 return t_show(m, iter->file);
1776 event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
1779 struct trace_event_file *file;
1784 file = event_file_file(filp);
1785 if (likely(file))
1786 flags = file->flags;
1789 if (!file)
1796 if (atomic_read(&file->sm_ref) != 0)
1805 event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
1808 struct trace_event_file *file;
1821 file = event_file_file(filp);
1822 if (!file)
1824 ret = tracing_update_buffers(file->tr);
1827 ret = ftrace_event_enable_disable(file, val);
1851 struct trace_event_file *file;
1856 list_for_each_entry(file, &tr->events, list) {
1857 call = file->event_call;
1870 set |= (1 << !!(file->flags & EVENT_FILE_FL_ENABLED));
1883 system_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
1905 system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
1952 struct trace_event_file *file = event_file_data(m->private);
1953 struct trace_event_call *call = file->event_call;
1985 struct trace_event_file *file = event_file_data(m->private);
1986 struct trace_event_call *call = file->event_call;
2041 struct trace_event_file *file;
2047 file = event_file_file(m->private);
2048 if (!file)
2069 static int trace_format_open(struct inode *inode, struct file *file)
2076 ret = seq_open(file, &trace_format_seq_ops);
2080 m = file->private_data;
2081 m->private = file;
2088 event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
2104 event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
2107 struct trace_event_file *file;
2122 file = event_file_file(filp);
2123 if (file)
2124 print_event_filter(file, s);
2127 if (file)
2137 event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
2140 struct trace_event_file *file;
2152 file = event_file_file(filp);
2153 if (file) {
2154 if (file->flags & EVENT_FILE_FL_FREED)
2157 err = apply_event_filter(file, buf);
2172 static int subsystem_open(struct inode *inode, struct file *filp)
2221 static int system_tr_open(struct inode *inode, struct file *filp)
2243 static int subsystem_release(struct inode *inode, struct file *file)
2245 struct trace_subsystem_dir *dir = file->private_data;
2263 subsystem_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
2290 subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
2315 show_header_page_file(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
2340 show_header_event_file(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
2412 event_pid_write(struct file *filp, const char __user *ubuf,
2420 struct trace_event_file *file;
2453 list_for_each_entry(file, &tr->events, list) {
2454 set_bit(EVENT_FILE_FL_PID_FILTER_BIT, &file->flags);
2477 ftrace_event_pid_write(struct file *filp, const char __user *ubuf,
2484 ftrace_event_npid_write(struct file *filp, const char __user *ubuf,
2490 static int ftrace_event_avail_open(struct inode *inode, struct file *file);
2491 static int ftrace_event_set_open(struct inode *inode, struct file *file);
2492 static int ftrace_event_set_pid_open(struct inode *inode, struct file *file);
2493 static int ftrace_event_set_npid_open(struct inode *inode, struct file *file);
2494 static int ftrace_event_release(struct inode *inode, struct file *file);
2624 ftrace_event_open(struct inode *inode, struct file *file,
2634 ret = seq_open(file, seq_ops);
2637 m = file->private_data;
2644 static int ftrace_event_release(struct inode *inode, struct file *file)
2650 return seq_release(inode, file);
2654 ftrace_event_avail_open(struct inode *inode, struct file *file)
2659 return ftrace_event_open(inode, file, seq_ops);
2663 ftrace_event_set_open(struct inode *inode, struct file *file)
2673 if ((file->f_mode & FMODE_WRITE) &&
2674 (file->f_flags & O_TRUNC))
2677 ret = ftrace_event_open(inode, file, seq_ops);
2684 ftrace_event_set_pid_open(struct inode *inode, struct file *file)
2694 if ((file->f_mode & FMODE_WRITE) &&
2695 (file->f_flags & O_TRUNC))
2698 ret = ftrace_event_open(inode, file, seq_ops);
2705 ftrace_event_set_npid_open(struct inode *inode, struct file *file)
2715 if ((file->f_mode & FMODE_WRITE) &&
2716 (file->f_flags & O_TRUNC))
2719 ret = ftrace_event_open(inode, file, seq_ops);
2774 struct trace_event_file *file, struct eventfs_inode *parent)
2796 file->system = dir;
2839 file->system = dir;
2895 struct trace_event_file *file = *data;
2896 struct trace_event_call *call = file->event_call;
2907 * event that can have a "trigger" file.
2967 /* The file is incremented on creation and freeing the enable file decrements it */
2970 struct trace_event_file *file = data;
2972 event_file_put(file);
2976 event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
2978 struct trace_event_call *call = file->event_call;
2979 struct trace_array *tr = file->tr;
3037 e_events = event_subsystem_dir(tr, call->class->system, file, parent);
3044 ei = eventfs_create_dir(name, e_events, event_entries, nr_entries, file);
3050 file->ei = ei;
3058 /* Gets decremented on freeing of the "enable" file */
3059 event_file_get(file);
3066 struct trace_event_file *file;
3069 do_for_each_event_file_safe(tr, file) {
3070 if (file->event_call != call)
3073 remove_event_file_dir(file);
3087 struct trace_event_file *file;
3089 do_for_each_event_file(tr, file) {
3090 if (file->event_call != call)
3093 if (file->flags & EVENT_FILE_FL_WAS_ENABLED)
3096 ftrace_event_enable_disable(file, 0);
3489 struct trace_event_file *file;
3495 file = kmem_cache_alloc(file_cachep, GFP_TRACE);
3496 if (!file)
3506 file->flags |= EVENT_FILE_FL_PID_FILTER;
3508 file->event_call = call;
3509 file->tr = tr;
3510 atomic_set(&file->sm_ref, 0);
3511 atomic_set(&file->tm_ref, 0);
3512 INIT_LIST_HEAD(&file->triggers);
3513 list_add(&file->list, &tr->events);
3514 refcount_set(&file->ref, 1);
3516 return file;
3559 struct trace_event_file *file;
3561 file = trace_create_new_event(call, tr);
3568 if (!file)
3571 if (IS_ERR(file))
3572 return PTR_ERR(file);
3575 return event_create_dir(tr->event_dir, file);
3580 static void trace_early_triggers(struct trace_event_file *file, const char *name)
3589 ret = trigger_process_regex(file, bootup_triggers[i].trigger);
3607 struct trace_event_file *file;
3610 file = trace_create_new_event(call, tr);
3617 if (!file)
3620 if (IS_ERR(file))
3621 return PTR_ERR(file);
3627 trace_early_triggers(file, trace_event_name(call));
3665 struct trace_event_file *file;
3671 do_for_each_event_file(tr, file) {
3672 if (file->event_call != call)
3679 if (file->flags & EVENT_FILE_FL_ENABLED)
3682 if (file->flags & EVENT_FILE_FL_WAS_ENABLED)
3852 /* Returns any file that matches the system and event */
3856 struct trace_event_file *file;
3860 list_for_each_entry(file, &tr->events, list) {
3862 call = file->event_call;
3870 return file;
3879 struct trace_event_file *file;
3881 file = __find_event_file(tr, system, event);
3882 if (!file || !file->event_call->class->reg ||
3883 file->event_call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)
3886 return file;
3890 * trace_get_event_file - Find and return a trace event file
3895 * Return a trace event file given the trace instance name, trace
3904 * To release the file, call trace_put_event_file(), which will call
3914 struct trace_event_file *file = NULL;
3929 file = find_event_file(tr, system, event);
3930 if (!file) {
3936 ret = trace_event_try_get_ref(file->event_call);
3942 return file;
3947 * trace_put_event_file - Release a file from trace_get_event_file()
3948 * @file: The trace event file
3950 * If a file was retrieved using trace_get_event_file(), this should
3955 void trace_put_event_file(struct trace_event_file *file)
3958 trace_event_put_ref(file->event_call);
3961 trace_array_put(file->tr);
3972 struct trace_event_file *file;
3981 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &data->file->flags);
3983 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &data->file->flags);
4022 if (edata->enable == !(edata->file->flags & EVENT_FILE_FL_SOFT_DISABLED))
4050 edata->file->event_call->class->system,
4051 trace_event_name(edata->file->event_call));
4092 __ftrace_event_enable_disable(edata->file, 0, 1);
4093 trace_event_put_ref(edata->file->event_call);
4156 struct trace_event_file *file;
4181 file = find_event_file(tr, system, event);
4182 if (!file)
4211 ret = trace_event_try_get_ref(file->event_call);
4215 ret = __ftrace_event_enable_disable(file, 1, 1);
4226 data->file = file;
4244 __ftrace_event_enable_disable(file, 0, 1);
4246 trace_event_put_ref(file->event_call);
4285 struct trace_event_file *file;
4289 list_for_each_entry(file, &tr->events, list) {
4290 ret = event_create_dir(tr->event_dir, file);
4293 trace_event_name(file->event_call));
4325 struct trace_event_file *file, *next;
4327 list_for_each_entry_safe(file, next, &tr->events, list)
4328 remove_event_file_dir(file);
4462 * The top trace array already had its file descriptors created.
4567 * are created. Create the file entries now, and attach them
4568 * to the actual file dentries later.
4714 struct trace_event_file *file;
4726 list_for_each_entry(file, &tr->events, list) {
4728 call = file->event_call;
4752 if (file->flags & EVENT_FILE_FL_ENABLED) {
4758 ftrace_event_enable_disable(file, 1);
4760 ftrace_event_enable_disable(file, 0);