Lines Matching +full:trigger +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0
3 * trace_events_trigger - trace event triggers
22 if (data->cmd_ops->set_filter) in trigger_data_free()
23 data->cmd_ops->set_filter(NULL, data, NULL); in trigger_data_free()
32 * event_triggers_call - Call triggers associated with a trace event
38 * For each trigger associated with an event, invoke the trigger
39 * function registered with the associated trigger command. If rec is
40 * non-NULL, it means that the trigger requires further processing and
41 * shouldn't be unconditionally invoked. If rec is non-NULL and the
42 * trigger has a filter associated with it, rec will checked against
43 * the filter and if the record matches the trigger will be invoked.
44 * If the trigger is a 'post_trigger', meaning it shouldn't be invoked
45 * in any case until the current event is written, the trigger
47 * trigger is set in the return value.
50 * any trigger that should be deferred, ETT_NONE if nothing to defer.
55 * any trigger that should be deferred, ETT_NONE if nothing to defer.
66 if (list_empty(&file->triggers)) in event_triggers_call()
69 list_for_each_entry_rcu(data, &file->triggers, list) { in event_triggers_call()
70 if (data->paused) in event_triggers_call()
73 data->ops->trigger(data, buffer, rec, event); in event_triggers_call()
76 filter = rcu_dereference_sched(data->filter); in event_triggers_call()
79 if (event_command_post_trigger(data->cmd_ops)) { in event_triggers_call()
80 tt |= data->cmd_ops->trigger_type; in event_triggers_call()
83 data->ops->trigger(data, buffer, rec, event); in event_triggers_call()
91 unsigned long eflags = file->flags; in __trace_trigger_soft_disabled()
104 * event_triggers_post_call - Call 'post_triggers' for a trace event
106 * @tt: enum event_trigger_type containing a set bit for each trigger to invoke
108 * For each trigger associated with an event, invoke the trigger
109 * function registered with the associated trigger command, if the
121 list_for_each_entry_rcu(data, &file->triggers, list) { in event_triggers_post_call()
122 if (data->paused) in event_triggers_post_call()
124 if (data->cmd_ops->trigger_type & tt) in event_triggers_post_call()
125 data->ops->trigger(data, NULL, NULL, NULL); in event_triggers_post_call()
134 struct trace_event_file *event_file = event_file_data(m->private); in trigger_next()
140 return seq_list_next(t, &event_file->triggers, pos); in trigger_next()
147 list_for_each_entry_rcu(data, &file->triggers, list, in check_user_trigger()
149 if (data->flags & EVENT_TRIGGER_FL_PROBE) in check_user_trigger()
160 /* ->stop() is called even if ->start() fails */ in trigger_start()
162 event_file = event_file_file(m->private); in trigger_start()
164 return ERR_PTR(-ENODEV); in trigger_start()
166 if (list_empty(&event_file->triggers) || !check_user_trigger(event_file)) in trigger_start()
169 return seq_list_start(&event_file->triggers, *pos); in trigger_start()
187 seq_printf(m, " %s", p->name); in trigger_show()
194 data->ops->print(m, data); in trigger_show()
218 return -ENODEV; in event_trigger_regex_open()
221 if ((file->f_mode & FMODE_WRITE) && in event_trigger_regex_open()
222 (file->f_flags & O_TRUNC)) { in event_trigger_regex_open()
229 if (p->unreg_all) in event_trigger_regex_open()
230 p->unreg_all(event_file); in event_trigger_regex_open()
234 if (file->f_mode & FMODE_READ) { in event_trigger_regex_open()
237 struct seq_file *m = file->private_data; in event_trigger_regex_open()
238 m->private = file; in event_trigger_regex_open()
251 int ret = -EINVAL; in trigger_process_regex()
264 if (strcmp(p->name, command) == 0) { in trigger_process_regex()
265 ret = p->parse(p, file, buff, command, next); in trigger_process_regex()
287 return -EINVAL; in event_trigger_regex_write()
300 return -ENODEV; in event_trigger_regex_write()
319 if (file->f_mode & FMODE_READ) in event_trigger_regex_release()
366 if (strcmp(cmd->name, p->name) == 0) { in register_event_command()
367 ret = -EBUSY; in register_event_command()
371 list_add(&cmd->list, &trigger_commands); in register_event_command()
385 int ret = -ENODEV; in unregister_event_command()
389 if (strcmp(cmd->name, p->name) == 0) { in unregister_event_command()
391 list_del_init(&p->list); in unregister_event_command()
402 * event_trigger_print - Generic event_trigger_ops @print implementation
403 * @name: The name of the event trigger
405 * @data: Trigger-specific data
410 * Usually wrapped by a function that simply sets the @name of the
411 * trigger command and then invokes this.
416 event_trigger_print(const char *name, struct seq_file *m, in event_trigger_print() argument
421 seq_puts(m, name); in event_trigger_print()
423 if (count == -1) in event_trigger_print()
437 * event_trigger_init - Generic event_trigger_ops @init implementation
438 * @data: Trigger-specific data
440 * Common implementation of event trigger initialization.
442 * Usually used directly as the @init method in event trigger
449 data->ref++; in event_trigger_init()
454 * event_trigger_free - Generic event_trigger_ops @free implementation
455 * @data: Trigger-specific data
457 * Common implementation of event trigger de-initialization.
459 * Usually used directly as the @free method in event trigger
465 if (WARN_ON_ONCE(data->ref <= 0)) in event_trigger_free()
468 data->ref--; in event_trigger_free()
469 if (!data->ref) in event_trigger_free()
479 if (atomic_inc_return(&file->tm_ref) > 1) in trace_event_trigger_enable_disable()
481 set_bit(EVENT_FILE_FL_TRIGGER_MODE_BIT, &file->flags); in trace_event_trigger_enable_disable()
484 if (atomic_dec_return(&file->tm_ref) > 0) in trace_event_trigger_enable_disable()
486 clear_bit(EVENT_FILE_FL_TRIGGER_MODE_BIT, &file->flags); in trace_event_trigger_enable_disable()
494 * clear_event_triggers - Clear all triggers associated with a trace array
497 * For each trigger, the triggering event has its tm_ref decremented
500 * decremented via free()->trace_event_enable_disable(). That
501 * combination effectively reverses the soft-mode/trigger state added
502 * by trigger registration.
511 list_for_each_entry(file, &tr->events, list) { in clear_event_triggers()
513 list_for_each_entry_safe(data, n, &file->triggers, list) { in clear_event_triggers()
515 list_del_rcu(&data->list); in clear_event_triggers()
516 if (data->ops->free) in clear_event_triggers()
517 data->ops->free(data); in clear_event_triggers()
523 * update_cond_flag - Set or reset the TRIGGER_COND bit
527 * a post_trigger, trigger invocation needs to be deferred until after
539 list_for_each_entry(data, &file->triggers, list) { in update_cond_flag()
540 if (data->filter || event_command_post_trigger(data->cmd_ops) || in update_cond_flag()
541 event_command_needs_rec(data->cmd_ops)) { in update_cond_flag()
548 set_bit(EVENT_FILE_FL_TRIGGER_COND_BIT, &file->flags); in update_cond_flag()
550 clear_bit(EVENT_FILE_FL_TRIGGER_COND_BIT, &file->flags); in update_cond_flag()
554 * register_trigger - Generic event_command @reg implementation
555 * @glob: The raw string used to register the trigger
556 * @data: Trigger-specific data to associate with the trigger
559 * Common implementation for event trigger registration.
575 list_for_each_entry(test, &file->triggers, list) { in register_trigger()
576 if (test->cmd_ops->trigger_type == data->cmd_ops->trigger_type) { in register_trigger()
577 ret = -EEXIST; in register_trigger()
582 if (data->ops->init) { in register_trigger()
583 ret = data->ops->init(data); in register_trigger()
588 list_add_rcu(&data->list, &file->triggers); in register_trigger()
593 list_del_rcu(&data->list); in register_trigger()
601 * True if the trigger was found and unregistered, else false.
611 list_for_each_entry(iter, &file->triggers, list) { in try_unregister_trigger()
612 if (iter->cmd_ops->trigger_type == test->cmd_ops->trigger_type) { in try_unregister_trigger()
614 list_del_rcu(&data->list); in try_unregister_trigger()
622 if (data->ops->free) in try_unregister_trigger()
623 data->ops->free(data); in try_unregister_trigger()
632 * unregister_trigger - Generic event_command @unreg implementation
633 * @glob: The raw string used to register the trigger
634 * @test: Trigger-specific data used to find the trigger to remove
637 * Common implementation for event trigger unregistration.
650 * Event trigger parsing helper functions.
652 * These functions help make it easier to write an event trigger
654 * function responsible for parsing and registering a trigger command
655 * written to the 'trigger' file.
657 * A trigger command (or just 'trigger' for short) takes the form:
658 * [trigger] [if filter]
661 * event_command functions) refer to several components of a trigger
662 * command. Those same components are referenced by the event trigger
665 * cmd - the trigger command name
666 * glob - the trigger command name optionally prefaced with '!'
667 * param_and_filter - text following cmd and ':'
668 * param - text following cmd and ':' and stripped of filter
669 * filter - the optional filter text following (and including) 'if'
674 * echo 'traceon:5 if pid == 0' > trigger
675 * - 'traceon' is both cmd and glob
676 * - '5 if pid == 0' is the param_and_filter
677 * - '5' is the param
678 * - 'if pid == 0' is the filter
680 * echo 'enable_event:sys:event:n' > trigger
681 * - 'enable_event' is both cmd and glob
682 * - 'sys:event:n' is the param_and_filter
683 * - 'sys:event:n' is the param
684 * - there is no filter
686 * echo 'hist:keys=pid if prio > 50' > trigger
687 * - 'hist' is both cmd and glob
688 * - 'keys=pid if prio > 50' is the param_and_filter
689 * - 'keys=pid' is the param
690 * - 'if prio > 50' is the filter
692 * echo '!enable_event:sys:event:n' > trigger
693 * - 'enable_event' the cmd
694 * - '!enable_event' is the glob
695 * - 'sys:event:n' is the param_and_filter
696 * - 'sys:event:n' is the param
697 * - there is no filter
699 * echo 'traceoff' > trigger
700 * - 'traceoff' is both cmd and glob
701 * - there is no param_and_filter
702 * - there is no param
703 * - there is no filter
705 * There are a few different categories of event trigger covered by
708 * - triggers that don't require a parameter e.g. traceon
709 * - triggers that do require a parameter e.g. enable_event and hist
710 * - triggers that though they may not require a param may support an
711 * optional 'n' param (n = number of times the trigger should fire)
713 * - triggers that do not support an 'n' param e.g. hist
715 * These functions can be used or ignored as necessary - it all
716 * depends on the complexity of the trigger, and the granularity of
719 * won't need certain functions. For instance, the hist trigger
725 * event_trigger_check_remove - check whether an event trigger specifies remove
726 * @glob: The trigger command string, with optional remove(!) operator
728 * The event trigger callback implementations pass in 'glob' as a
729 * parameter. This is the command name either with or without a
731 * determines whether the command corresponds to a trigger removal or
732 * a trigger addition.
742 * event_trigger_empty_param - check whether the param is empty
743 * @param: The trigger param string
745 * The event trigger callback implementations pass in 'param' as a
747 * name minus the command name. This function can be called by a
759 * event_trigger_separate_filter - separate an event trigger from a filter
760 * @param_and_filter: String containing trigger and possibly filter
761 * @param: outparam, will be filled with a pointer to the trigger
765 * Given a param string of the form '[trigger] [if filter]', this
766 * function separates the filter from the trigger and returns the
767 * trigger in @param and the filter in @filter. Either the @param
768 * or the @filter may be set to NULL by this function - if not set to
769 * NULL, they will contain strings corresponding to the trigger and
773 * passed-in param: either the param is required, or it is not
775 * return -EINVAL. If @param_required is not set and there's a param
777 * trigger with :n (n = number of times the trigger should fire) and
793 ret = -EINVAL; in event_trigger_separate_filter()
828 * event_trigger_alloc - allocate and init event_trigger_data for a trigger
829 * @cmd_ops: The event_command operations for the trigger
832 * @private_data: User data to associate with the event trigger
851 trigger_ops = cmd_ops->get_trigger_ops(cmd, param); in event_trigger_alloc()
857 trigger_data->count = -1; in event_trigger_alloc()
858 trigger_data->ops = trigger_ops; in event_trigger_alloc()
859 trigger_data->cmd_ops = cmd_ops; in event_trigger_alloc()
860 trigger_data->private_data = private_data; in event_trigger_alloc()
862 INIT_LIST_HEAD(&trigger_data->list); in event_trigger_alloc()
863 INIT_LIST_HEAD(&trigger_data->named_list); in event_trigger_alloc()
864 RCU_INIT_POINTER(trigger_data->filter, NULL); in event_trigger_alloc()
870 * event_trigger_parse_num - parse and return the number param for a trigger
872 * @trigger_data: The trigger_data for the trigger
874 * Parse the :n (n = number of times the trigger should fire) param
889 return -EINVAL; in event_trigger_parse_num()
895 ret = kstrtoul(number, 0, &trigger_data->count); in event_trigger_parse_num()
902 * event_trigger_set_filter - set an event trigger's filter
903 * @cmd_ops: The event_command operations for the trigger
904 * @file: The event file for the trigger's event
906 * @trigger_data: The trigger_data for the trigger
908 * Set the filter for the trigger. If the filter is NULL, just return
918 if (param && cmd_ops->set_filter) in event_trigger_set_filter()
919 return cmd_ops->set_filter(param, trigger_data, file); in event_trigger_set_filter()
925 * event_trigger_reset_filter - reset an event trigger's filter
926 * @cmd_ops: The event_command operations for the trigger
927 * @trigger_data: The trigger_data for the trigger
929 * Reset the filter for the trigger to no filter.
934 if (cmd_ops->set_filter) in event_trigger_reset_filter()
935 cmd_ops->set_filter(NULL, trigger_data, NULL); in event_trigger_reset_filter()
939 * event_trigger_register - register an event trigger
940 * @cmd_ops: The event_command operations for the trigger
941 * @file: The event file for the trigger's event
942 * @glob: The trigger command string, with optional remove(!) operator
943 * @trigger_data: The trigger_data for the trigger
945 * Register an event trigger. The @cmd_ops are used to call the
946 * cmd_ops->reg() function which actually does the registration.
955 return cmd_ops->reg(glob, trigger_data, file); in event_trigger_register()
959 * event_trigger_unregister - unregister an event trigger
960 * @cmd_ops: The event_command operations for the trigger
961 * @file: The event file for the trigger's event
962 * @glob: The trigger command string, with optional remove(!) operator
963 * @trigger_data: The trigger_data for the trigger
965 * Unregister an event trigger. The @cmd_ops are used to call the
966 * cmd_ops->unreg() function which actually does the unregistration.
973 cmd_ops->unreg(glob, trigger_data, file); in event_trigger_unregister()
977 * End event trigger parsing helper functions.
981 * event_trigger_parse - Generic event_command @parse implementation
982 * @cmd_ops: The command ops, used for trigger registration
984 * @glob: The raw string used to register the trigger
985 * @cmd: The cmd portion of the string used to register the trigger
986 * @param_and_filter: The param and filter portion of the string used to register the trigger
988 * Common implementation for event command parsing and trigger
1012 ret = -ENOMEM; in event_trigger_parse()
1051 * set_trigger_filter - Generic event_command @set_filter implementation
1052 * @filter_str: The filter string for the trigger, NULL to remove filter
1053 * @trigger_data: Trigger-specific data
1072 int ret = -EINVAL; in set_trigger_filter()
1086 /* The filter is for the 'trigger' event, not the triggered event */ in set_trigger_filter()
1087 ret = create_event_filter(file->tr, file->event_call, in set_trigger_filter()
1092 kfree(filter->filter_string); in set_trigger_filter()
1093 filter->filter_string = NULL; in set_trigger_filter()
1098 * Which the calling code will do with data->filter. in set_trigger_filter()
1101 tmp = rcu_access_pointer(data->filter); in set_trigger_filter()
1103 rcu_assign_pointer(data->filter, filter); in set_trigger_filter()
1117 kfree(data->filter_str); in set_trigger_filter()
1118 data->filter_str = NULL; in set_trigger_filter()
1121 data->filter_str = kstrdup(filter_str, GFP_KERNEL); in set_trigger_filter()
1122 if (!data->filter_str) { in set_trigger_filter()
1123 free_event_filter(rcu_access_pointer(data->filter)); in set_trigger_filter()
1124 data->filter = NULL; in set_trigger_filter()
1125 ret = -ENOMEM; in set_trigger_filter()
1135 * find_named_trigger - Find the common named trigger associated with @name
1136 * @name: The name of the set of named triggers to find the common data for
1139 * trigger data. The first named trigger registered with a given name
1140 * owns the common trigger data that the others subsequently
1141 * registered with the same name will reference. This function
1142 * returns the common trigger data associated with that first
1145 * Return: the common trigger data for the given named trigger on
1148 struct event_trigger_data *find_named_trigger(const char *name) in find_named_trigger() argument
1152 if (!name) in find_named_trigger()
1156 if (data->named_data) in find_named_trigger()
1158 if (strcmp(data->name, name) == 0) in find_named_trigger()
1166 * is_named_trigger - determine if a given trigger is a named trigger
1167 * @test: The trigger data to test
1169 * Return: true if 'test' is a named trigger, false otherwise.
1184 * save_named_trigger - save the trigger in the named trigger list
1185 * @name: The name of the named trigger set
1186 * @data: The trigger data to save
1190 int save_named_trigger(const char *name, struct event_trigger_data *data) in save_named_trigger() argument
1192 data->name = kstrdup(name, GFP_KERNEL); in save_named_trigger()
1193 if (!data->name) in save_named_trigger()
1194 return -ENOMEM; in save_named_trigger()
1196 list_add(&data->named_list, &named_triggers); in save_named_trigger()
1202 * del_named_trigger - delete a trigger from the named trigger list
1203 * @data: The trigger data to delete
1207 kfree(data->name); in del_named_trigger()
1208 data->name = NULL; in del_named_trigger()
1210 list_del(&data->named_list); in del_named_trigger()
1218 if (strcmp(test->name, data->name) == 0) { in __pause_named_trigger()
1220 test->paused_tmp = test->paused; in __pause_named_trigger()
1221 test->paused = true; in __pause_named_trigger()
1223 test->paused = test->paused_tmp; in __pause_named_trigger()
1230 * pause_named_trigger - Pause all named triggers with the same name
1231 * @data: The trigger data of a named trigger to pause
1233 * Pauses a named trigger along with all other triggers having the
1234 * same name. Because named triggers share a common set of data,
1235 * pausing only one is meaningless, so pausing one named trigger needs
1236 * to pause all triggers with the same name.
1244 * unpause_named_trigger - Un-pause all named triggers with the same name
1245 * @data: The trigger data of a named trigger to unpause
1247 * Un-pauses a named trigger along with all other triggers having the
1248 * same name. Because named triggers share a common set of data,
1249 * unpausing only one is meaningless, so unpausing one named trigger
1250 * needs to unpause all triggers with the same name.
1258 * set_named_trigger_data - Associate common named trigger data
1259 * @data: The trigger data to associate
1260 * @named_data: The common named trigger to be associated
1263 * trigger data. The first named trigger registered with a given name
1264 * owns the common trigger data that the others subsequently
1265 * registered with the same name will reference. This function
1266 * associates the common trigger data from the first trigger with the
1267 * given trigger.
1272 data->named_data = named_data; in set_named_trigger_data()
1278 return data->named_data; in get_named_trigger_data()
1286 struct trace_event_file *file = data->private_data; in traceon_trigger()
1289 if (tracer_tracing_is_on(file->tr)) in traceon_trigger()
1292 tracer_tracing_on(file->tr); in traceon_trigger()
1307 struct trace_event_file *file = data->private_data; in traceon_count_trigger()
1310 if (tracer_tracing_is_on(file->tr)) in traceon_count_trigger()
1317 if (!data->count) in traceon_count_trigger()
1320 if (data->count != -1) in traceon_count_trigger()
1321 (data->count)--; in traceon_count_trigger()
1324 tracer_tracing_on(file->tr); in traceon_count_trigger()
1334 struct trace_event_file *file = data->private_data; in traceoff_trigger()
1337 if (!tracer_tracing_is_on(file->tr)) in traceoff_trigger()
1340 tracer_tracing_off(file->tr); in traceoff_trigger()
1355 struct trace_event_file *file = data->private_data; in traceoff_count_trigger()
1358 if (!tracer_tracing_is_on(file->tr)) in traceoff_count_trigger()
1365 if (!data->count) in traceoff_count_trigger()
1368 if (data->count != -1) in traceoff_count_trigger()
1369 (data->count)--; in traceoff_count_trigger()
1372 tracer_tracing_off(file->tr); in traceoff_count_trigger()
1380 return event_trigger_print("traceon", m, (void *)data->count, in traceon_trigger_print()
1381 data->filter_str); in traceon_trigger_print()
1387 return event_trigger_print("traceoff", m, (void *)data->count, in traceoff_trigger_print()
1388 data->filter_str); in traceoff_trigger_print()
1392 .trigger = traceon_trigger,
1399 .trigger = traceon_count_trigger,
1406 .trigger = traceoff_trigger,
1413 .trigger = traceoff_count_trigger,
1436 .name = "traceon",
1446 .name = "traceoff",
1462 struct trace_event_file *file = data->private_data; in snapshot_trigger()
1465 tracing_snapshot_instance(file->tr); in snapshot_trigger()
1475 if (!data->count) in snapshot_count_trigger()
1478 if (data->count != -1) in snapshot_count_trigger()
1479 (data->count)--; in snapshot_count_trigger()
1489 int ret = tracing_arm_snapshot(file->tr); in register_snapshot_trigger()
1496 tracing_disarm_snapshot(file->tr); in register_snapshot_trigger()
1505 tracing_disarm_snapshot(file->tr); in unregister_snapshot_trigger()
1511 return event_trigger_print("snapshot", m, (void *)data->count, in snapshot_trigger_print()
1512 data->filter_str); in snapshot_trigger_print()
1516 .trigger = snapshot_trigger,
1523 .trigger = snapshot_count_trigger,
1536 .name = "snapshot",
1581 struct trace_event_file *file = data->private_data; in stacktrace_trigger()
1584 __trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP); in stacktrace_trigger()
1594 if (!data->count) in stacktrace_count_trigger()
1597 if (data->count != -1) in stacktrace_count_trigger()
1598 (data->count)--; in stacktrace_count_trigger()
1606 return event_trigger_print("stacktrace", m, (void *)data->count, in stacktrace_trigger_print()
1607 data->filter_str); in stacktrace_trigger_print()
1611 .trigger = stacktrace_trigger,
1618 .trigger = stacktrace_count_trigger,
1631 .name = "stacktrace",
1665 struct enable_trigger_data *enable_data = data->private_data; in event_enable_trigger()
1667 if (enable_data->enable) in event_enable_trigger()
1668 clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &enable_data->file->flags); in event_enable_trigger()
1670 set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &enable_data->file->flags); in event_enable_trigger()
1678 struct enable_trigger_data *enable_data = data->private_data; in event_enable_count_trigger()
1680 if (!data->count) in event_enable_count_trigger()
1684 if (enable_data->enable == !(enable_data->file->flags & EVENT_FILE_FL_SOFT_DISABLED)) in event_enable_count_trigger()
1687 if (data->count != -1) in event_enable_count_trigger()
1688 (data->count)--; in event_enable_count_trigger()
1696 struct enable_trigger_data *enable_data = data->private_data; in event_enable_trigger_print()
1699 enable_data->hist ? in event_enable_trigger_print()
1700 (enable_data->enable ? ENABLE_HIST_STR : DISABLE_HIST_STR) : in event_enable_trigger_print()
1701 (enable_data->enable ? ENABLE_EVENT_STR : DISABLE_EVENT_STR), in event_enable_trigger_print()
1702 enable_data->file->event_call->class->system, in event_enable_trigger_print()
1703 trace_event_name(enable_data->file->event_call)); in event_enable_trigger_print()
1705 if (data->count == -1) in event_enable_trigger_print()
1708 seq_printf(m, ":count=%ld", data->count); in event_enable_trigger_print()
1710 if (data->filter_str) in event_enable_trigger_print()
1711 seq_printf(m, " if %s\n", data->filter_str); in event_enable_trigger_print()
1720 struct enable_trigger_data *enable_data = data->private_data; in event_enable_trigger_free()
1722 if (WARN_ON_ONCE(data->ref <= 0)) in event_enable_trigger_free()
1725 data->ref--; in event_enable_trigger_free()
1726 if (!data->ref) { in event_enable_trigger_free()
1728 trace_event_enable_disable(enable_data->file, 0, 1); in event_enable_trigger_free()
1729 trace_event_put_ref(enable_data->file->event_call); in event_enable_trigger_free()
1736 .trigger = event_enable_trigger,
1743 .trigger = event_enable_count_trigger,
1750 .trigger = event_enable_trigger,
1757 .trigger = event_enable_count_trigger,
1770 struct trace_array *tr = file->tr; in event_enable_trigger_parse()
1781 return -EINVAL; in event_enable_trigger_parse()
1789 return -EINVAL; in event_enable_trigger_parse()
1793 ret = -EINVAL; in event_enable_trigger_parse()
1807 ret = -ENOMEM; in event_enable_trigger_parse()
1813 enable_data->hist = hist; in event_enable_trigger_parse()
1814 enable_data->enable = enable; in event_enable_trigger_parse()
1815 enable_data->file = event_enable_file; in event_enable_trigger_parse()
1843 ret = trace_event_try_get_ref(event_enable_file->event_call); in event_enable_trigger_parse()
1845 ret = -EBUSY; in event_enable_trigger_parse()
1863 trace_event_put_ref(event_enable_file->event_call); in event_enable_trigger_parse()
1876 struct enable_trigger_data *enable_data = data->private_data; in event_enable_register_trigger()
1883 list_for_each_entry(test, &file->triggers, list) { in event_enable_register_trigger()
1884 test_enable_data = test->private_data; in event_enable_register_trigger()
1886 (test->cmd_ops->trigger_type == in event_enable_register_trigger()
1887 data->cmd_ops->trigger_type) && in event_enable_register_trigger()
1888 (test_enable_data->file == enable_data->file)) { in event_enable_register_trigger()
1889 ret = -EEXIST; in event_enable_register_trigger()
1894 if (data->ops->init) { in event_enable_register_trigger()
1895 ret = data->ops->init(data); in event_enable_register_trigger()
1900 list_add_rcu(&data->list, &file->triggers); in event_enable_register_trigger()
1905 list_del_rcu(&data->list); in event_enable_register_trigger()
1916 struct enable_trigger_data *test_enable_data = test->private_data; in event_enable_unregister_trigger()
1922 list_for_each_entry(iter, &file->triggers, list) { in event_enable_unregister_trigger()
1923 enable_data = iter->private_data; in event_enable_unregister_trigger()
1925 (iter->cmd_ops->trigger_type == in event_enable_unregister_trigger()
1926 test->cmd_ops->trigger_type) && in event_enable_unregister_trigger()
1927 (enable_data->file == test_enable_data->file)) { in event_enable_unregister_trigger()
1929 list_del_rcu(&data->list); in event_enable_unregister_trigger()
1936 if (data && data->ops->free) in event_enable_unregister_trigger()
1937 data->ops->free(data); in event_enable_unregister_trigger()
1963 .name = ENABLE_EVENT_STR,
1973 .name = DISABLE_EVENT_STR,