diff options
author | Tom Zanussi <zanussi@kernel.org> | 2020-01-29 12:59:26 -0600 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2020-01-31 12:59:26 -0500 |
commit | fdeb1aca2861472b38779be44141757483300827 (patch) | |
tree | 9055ab74c0ccafa0e2775d679789b83648fc1618 /kernel/trace/trace_boot.c | |
parent | 1e837945a8854227f3f4e4d2d7abff64ed320830 (diff) |
tracing: Change trace_boot to use synth_event interface
Have trace_boot_add_synth_event() use the synth_event interface.
Also, rename synth_event_run_cmd() to synth_event_run_command() now
that trace_boot's version is gone.
Link: http://lkml.kernel.org/r/94f1fa0e31846d0bddca916b8663404b20559e34.1580323897.git.zanussi@kernel.org
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_boot.c')
-rw-r--r-- | kernel/trace/trace_boot.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index 2298a70cdda6..06d7feb5255f 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c @@ -125,38 +125,31 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event) #endif #ifdef CONFIG_HIST_TRIGGERS -extern int synth_event_run_command(const char *command); - static int __init trace_boot_add_synth_event(struct xbc_node *node, const char *event) { + struct dynevent_cmd cmd; struct xbc_node *anode; - char buf[MAX_BUF_LEN], *q; + char buf[MAX_BUF_LEN]; const char *p; - int len, delta, ret; + int ret; - len = ARRAY_SIZE(buf); - delta = snprintf(buf, len, "%s", event); - if (delta >= len) { - pr_err("Event name is too long: %s\n", event); - return -E2BIG; - } - len -= delta; q = buf + delta; + synth_event_cmd_init(&cmd, buf, MAX_BUF_LEN); + + ret = synth_event_gen_cmd_start(&cmd, event, NULL); + if (ret) + return ret; xbc_node_for_each_array_value(node, "fields", anode, p) { - delta = snprintf(q, len, " %s;", p); - if (delta >= len) { - pr_err("fields string is too long: %s\n", p); - return -E2BIG; - } - len -= delta; q += delta; + ret = synth_event_add_field_str(&cmd, p); + if (ret) + return ret; } - ret = synth_event_run_command(buf); + ret = synth_event_gen_cmd_end(&cmd); if (ret < 0) pr_err("Failed to add synthetic event: %s\n", buf); - return ret; } #else |