summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorTom Zanussi <zanussi@kernel.org>2020-01-29 12:59:30 -0600
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-01-30 09:46:28 -0500
commit29a15481054681fa2d450b60a6feea8e6ca6f511 (patch)
tree2a727c6a9bc24049f148bfe0fa8211251fd38d8f /kernel
parent2a588dd1d5d649a183a2ff6fa1b80e870cf821d8 (diff)
downloadlinux-29a15481054681fa2d450b60a6feea8e6ca6f511.tar.bz2
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.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')
-rw-r--r--kernel/trace/trace_boot.c35
-rw-r--r--kernel/trace/trace_kprobe.c9
2 files changed, 17 insertions, 27 deletions
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index 4d37bf5c3742..2298a70cdda6 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -88,37 +88,32 @@ trace_boot_enable_events(struct trace_array *tr, struct xbc_node *node)
}
#ifdef CONFIG_KPROBE_EVENTS
-extern int trace_kprobe_run_command(const char *command);
-
static int __init
trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
{
+ struct dynevent_cmd cmd;
struct xbc_node *anode;
char buf[MAX_BUF_LEN];
const char *val;
- char *p;
- int len;
+ int ret;
- len = snprintf(buf, ARRAY_SIZE(buf) - 1, "p:kprobes/%s ", event);
- if (len >= ARRAY_SIZE(buf)) {
- pr_err("Event name is too long: %s\n", event);
- return -E2BIG;
- }
- p = buf + len;
- len = ARRAY_SIZE(buf) - len;
+ kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
+
+ ret = kprobe_event_gen_cmd_start(&cmd, event, NULL);
+ if (ret)
+ return ret;
xbc_node_for_each_array_value(node, "probes", anode, val) {
- if (strlcpy(p, val, len) >= len) {
- pr_err("Probe definition is too long: %s\n", val);
- return -E2BIG;
- }
- if (trace_kprobe_run_command(buf) < 0) {
- pr_err("Failed to add probe: %s\n", buf);
- return -EINVAL;
- }
+ ret = kprobe_event_add_field(&cmd, val);
+ if (ret)
+ return ret;
}
- return 0;
+ ret = kprobe_event_gen_cmd_end(&cmd);
+ if (ret)
+ pr_err("Failed to add probe: %s\n", buf);
+
+ return ret;
}
#else
static inline int __init
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index f43548b466d0..307abb724a71 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -901,12 +901,7 @@ static int create_or_delete_trace_kprobe(int argc, char **argv)
return ret == -ECANCELED ? -EINVAL : ret;
}
-int trace_kprobe_run_command(const char *command)
-{
- return trace_run_command(command, create_or_delete_trace_kprobe);
-}
-
-static int trace_kprobe_run_cmd(struct dynevent_cmd *cmd)
+static int trace_kprobe_run_command(struct dynevent_cmd *cmd)
{
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)
void kprobe_event_cmd_init(struct dynevent_cmd *cmd, char *buf, int maxlen)
{
dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_KPROBE,
- trace_kprobe_run_cmd);
+ trace_kprobe_run_command);
}
EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);