aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-03-12 15:07:59 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:36:02 -0400
commite67efb93f0e9130174293ffaa5975f87b301b531 (patch)
tree344cadb55d5d50e0ae0473a8404a6893d8a3183b
parent57d01ad09721fb7719c4c8c72b434398186f35a0 (diff)
ftrace: Clean up function probe methods
When a function probe is created, each function that the probe is attached to, a "callback" method is called. On release of the probe, each function entry calls the "free" method. First, "callback" is a confusing name and does not really match what it does. Callback sounds like it will be called when the probe triggers. But that's not the case. This is really an "init" function, so lets rename it as such. Secondly, both "init" and "free" do not pass enough information back to the handlers. Pass back the ops, ip and data for each time the method is called. We have the information, might as well use it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--include/linux/ftrace.h6
-rw-r--r--kernel/trace/ftrace.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index e5ca8ef50e9b..832422d706f4 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -259,8 +259,10 @@ struct ftrace_probe_ops {
259 void (*func)(unsigned long ip, 259 void (*func)(unsigned long ip,
260 unsigned long parent_ip, 260 unsigned long parent_ip,
261 void **data); 261 void **data);
262 int (*callback)(unsigned long ip, void **data); 262 int (*init)(struct ftrace_probe_ops *ops,
263 void (*free)(void **data); 263 unsigned long ip, void **data);
264 void (*free)(struct ftrace_probe_ops *ops,
265 unsigned long ip, void **data);
264 int (*print)(struct seq_file *m, 266 int (*print)(struct seq_file *m,
265 unsigned long ip, 267 unsigned long ip,
266 struct ftrace_probe_ops *ops, 268 struct ftrace_probe_ops *ops,
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index dab031fec85b..ff0ef41c6d93 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2984,7 +2984,7 @@ static void ftrace_free_entry_rcu(struct rcu_head *rhp)
2984 container_of(rhp, struct ftrace_func_probe, rcu); 2984 container_of(rhp, struct ftrace_func_probe, rcu);
2985 2985
2986 if (entry->ops->free) 2986 if (entry->ops->free)
2987 entry->ops->free(&entry->data); 2987 entry->ops->free(entry->ops, entry->ip, &entry->data);
2988 kfree(entry); 2988 kfree(entry);
2989} 2989}
2990 2990
@@ -3045,8 +3045,8 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
3045 * for each function we find. We call the callback 3045 * for each function we find. We call the callback
3046 * to give the caller an opportunity to do so. 3046 * to give the caller an opportunity to do so.
3047 */ 3047 */
3048 if (ops->callback) { 3048 if (ops->init) {
3049 if (ops->callback(rec->ip, &entry->data) < 0) { 3049 if (ops->init(ops, rec->ip, &entry->data) < 0) {
3050 /* caller does not like this func */ 3050 /* caller does not like this func */
3051 kfree(entry); 3051 kfree(entry);
3052 continue; 3052 continue;