Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e110e3d1 authored by Steven Rostedt's avatar Steven Rostedt
Browse files

ftrace: add pretty print function for traceon and traceoff hooks



This patch adds a pretty print version of traceon and traceoff
output for set_ftrace_filter.

  # echo 'sys_open:traceon:4' > set_ftrace_filter
  # cat set_ftrace_filter

 #### all functions enabled ####
 sys_open:traceon:count=4

Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
parent 809dcf29
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -267,14 +267,42 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data)
	tracing_off();
}

static int
ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
			 struct ftrace_hook_ops *ops, void *data);

static struct ftrace_hook_ops traceon_hook_ops = {
	.func			= ftrace_traceon,
	.print			= ftrace_trace_onoff_print,
};

static struct ftrace_hook_ops traceoff_hook_ops = {
	.func			= ftrace_traceoff,
	.print			= ftrace_trace_onoff_print,
};

static int
ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
			 struct ftrace_hook_ops *ops, void *data)
{
	char str[KSYM_SYMBOL_LEN];
	long count = (long)data;

	kallsyms_lookup(ip, NULL, NULL, NULL, str);
	seq_printf(m, "%s:", str);

	if (ops == &traceon_hook_ops)
		seq_printf(m, "traceon");
	else
		seq_printf(m, "traceoff");

	if (count != -1)
		seq_printf(m, ":count=%ld", count);
	seq_putc(m, '\n');

	return 0;
}

static int
ftrace_trace_onoff_unreg(char *glob, char *cmd, char *param)
{