Commit 29a15481 authored by Tom Zanussi's avatar Tom Zanussi Committed by Steven Rostedt (VMware)

tracing: Change trace_boot to use kprobe_event interface

Have trace_boot_add_kprobe_event() use the kprobe_event interface.

Also, rename kprobe_event_run_cmd() to kprobe_event_run_command() now
that trace_boot's version is gone.

Link: http://lkml.kernel.org/r/af5429d11291ab1e9a85a0ff944af3b2bcf193c7.1580323897.git.zanussi@kernel.orgAcked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarTom Zanussi <zanussi@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 2a588dd1
...@@ -88,37 +88,32 @@ trace_boot_enable_events(struct trace_array *tr, struct xbc_node *node) ...@@ -88,37 +88,32 @@ trace_boot_enable_events(struct trace_array *tr, struct xbc_node *node)
} }
#ifdef CONFIG_KPROBE_EVENTS #ifdef CONFIG_KPROBE_EVENTS
extern int trace_kprobe_run_command(const char *command);
static int __init static int __init
trace_boot_add_kprobe_event(struct xbc_node *node, const char *event) trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
{ {
struct dynevent_cmd cmd;
struct xbc_node *anode; struct xbc_node *anode;
char buf[MAX_BUF_LEN]; char buf[MAX_BUF_LEN];
const char *val; const char *val;
char *p; int ret;
int len;
len = snprintf(buf, ARRAY_SIZE(buf) - 1, "p:kprobes/%s ", event); kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
if (len >= ARRAY_SIZE(buf)) {
pr_err("Event name is too long: %s\n", event); ret = kprobe_event_gen_cmd_start(&cmd, event, NULL);
return -E2BIG; if (ret)
} return ret;
p = buf + len;
len = ARRAY_SIZE(buf) - len;
xbc_node_for_each_array_value(node, "probes", anode, val) { xbc_node_for_each_array_value(node, "probes", anode, val) {
if (strlcpy(p, val, len) >= len) { ret = kprobe_event_add_field(&cmd, val);
pr_err("Probe definition is too long: %s\n", val); if (ret)
return -E2BIG; return ret;
} }
if (trace_kprobe_run_command(buf) < 0) {
ret = kprobe_event_gen_cmd_end(&cmd);
if (ret)
pr_err("Failed to add probe: %s\n", buf); pr_err("Failed to add probe: %s\n", buf);
return -EINVAL;
}
}
return 0; return ret;
} }
#else #else
static inline int __init static inline int __init
......
...@@ -901,12 +901,7 @@ static int create_or_delete_trace_kprobe(int argc, char **argv) ...@@ -901,12 +901,7 @@ static int create_or_delete_trace_kprobe(int argc, char **argv)
return ret == -ECANCELED ? -EINVAL : ret; return ret == -ECANCELED ? -EINVAL : ret;
} }
int trace_kprobe_run_command(const char *command) static int trace_kprobe_run_command(struct dynevent_cmd *cmd)
{
return trace_run_command(command, create_or_delete_trace_kprobe);
}
static int trace_kprobe_run_cmd(struct dynevent_cmd *cmd)
{ {
return trace_run_command(cmd->buf, create_or_delete_trace_kprobe); return trace_run_command(cmd->buf, create_or_delete_trace_kprobe);
} }
...@@ -923,7 +918,7 @@ static int trace_kprobe_run_cmd(struct dynevent_cmd *cmd) ...@@ -923,7 +918,7 @@ static int trace_kprobe_run_cmd(struct dynevent_cmd *cmd)
void kprobe_event_cmd_init(struct dynevent_cmd *cmd, char *buf, int maxlen) void kprobe_event_cmd_init(struct dynevent_cmd *cmd, char *buf, int maxlen)
{ {
dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_KPROBE, dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_KPROBE,
trace_kprobe_run_cmd); trace_kprobe_run_command);
} }
EXPORT_SYMBOL_GPL(kprobe_event_cmd_init); EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment