fgraph: Add new fgraph_ops structure to enable function graph hooks
Currently the registering of function graph is to pass in a entry and return function. We need to have a way to associate those functions together where the entry can determine to run the return hook. Having a structure that contains both functions will facilitate the process of converting the code to be able to do such. This is similar to the way function hooks are enabled (it passes in ftrace_ops). Instead of passing in the functions to use, a single structure is passed in to the registering function. The unregister function is now passed in the fgraph_ops handle. When we allow more than one callback to the function graph hooks, this will let the system know which one to remove. Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
@@ -849,15 +849,19 @@ static void profile_graph_return(struct ftrace_graph_ret *trace)
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static struct fgraph_ops fprofiler_ops = {
|
||||
.entryfunc = &profile_graph_entry,
|
||||
.retfunc = &profile_graph_return,
|
||||
};
|
||||
|
||||
static int register_ftrace_profiler(void)
|
||||
{
|
||||
return register_ftrace_graph(&profile_graph_return,
|
||||
&profile_graph_entry);
|
||||
return register_ftrace_graph(&fprofiler_ops);
|
||||
}
|
||||
|
||||
static void unregister_ftrace_profiler(void)
|
||||
{
|
||||
unregister_ftrace_graph();
|
||||
unregister_ftrace_graph(&fprofiler_ops);
|
||||
}
|
||||
#else
|
||||
static struct ftrace_ops ftrace_profile_ops __read_mostly = {
|
||||
|
Reference in New Issue
Block a user