forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
1e837945a8
commit
fdeb1aca28
|
@ -125,38 +125,31 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_HIST_TRIGGERS
|
#ifdef CONFIG_HIST_TRIGGERS
|
||||||
extern int synth_event_run_command(const char *command);
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
trace_boot_add_synth_event(struct xbc_node *node, const char *event)
|
trace_boot_add_synth_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], *q;
|
char buf[MAX_BUF_LEN];
|
||||||
const char *p;
|
const char *p;
|
||||||
int len, delta, ret;
|
int ret;
|
||||||
|
|
||||||
len = ARRAY_SIZE(buf);
|
synth_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
|
||||||
delta = snprintf(buf, len, "%s", event);
|
|
||||||
if (delta >= len) {
|
ret = synth_event_gen_cmd_start(&cmd, event, NULL);
|
||||||
pr_err("Event name is too long: %s\n", event);
|
if (ret)
|
||||||
return -E2BIG;
|
return ret;
|
||||||
}
|
|
||||||
len -= delta; q = buf + delta;
|
|
||||||
|
|
||||||
xbc_node_for_each_array_value(node, "fields", anode, p) {
|
xbc_node_for_each_array_value(node, "fields", anode, p) {
|
||||||
delta = snprintf(q, len, " %s;", p);
|
ret = synth_event_add_field_str(&cmd, p);
|
||||||
if (delta >= len) {
|
if (ret)
|
||||||
pr_err("fields string is too long: %s\n", p);
|
return ret;
|
||||||
return -E2BIG;
|
|
||||||
}
|
|
||||||
len -= delta; q += delta;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = synth_event_run_command(buf);
|
ret = synth_event_gen_cmd_end(&cmd);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("Failed to add synthetic event: %s\n", buf);
|
pr_err("Failed to add synthetic event: %s\n", buf);
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1755,12 +1755,7 @@ static int create_or_delete_synth_event(int argc, char **argv)
|
||||||
return ret == -ECANCELED ? -EINVAL : ret;
|
return ret == -ECANCELED ? -EINVAL : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int synth_event_run_command(const char *command)
|
static int synth_event_run_command(struct dynevent_cmd *cmd)
|
||||||
{
|
|
||||||
return trace_run_command(command, create_or_delete_synth_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int synth_event_run_cmd(struct dynevent_cmd *cmd)
|
|
||||||
{
|
{
|
||||||
struct synth_event *se;
|
struct synth_event *se;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1790,7 +1785,7 @@ static int synth_event_run_cmd(struct dynevent_cmd *cmd)
|
||||||
void synth_event_cmd_init(struct dynevent_cmd *cmd, char *buf, int maxlen)
|
void synth_event_cmd_init(struct dynevent_cmd *cmd, char *buf, int maxlen)
|
||||||
{
|
{
|
||||||
dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_SYNTH,
|
dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_SYNTH,
|
||||||
synth_event_run_cmd);
|
synth_event_run_command);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(synth_event_cmd_init);
|
EXPORT_SYMBOL_GPL(synth_event_cmd_init);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user