]> Pileus Git - ~andy/linux/commitdiff
ftrace: Clean up function probe methods
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Tue, 12 Mar 2013 19:07:59 +0000 (15:07 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Mar 2013 04:36:02 +0000 (00:36 -0400)
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>
include/linux/ftrace.h
kernel/trace/ftrace.c

index e5ca8ef50e9bf674e46fa58d7fff5f0424ab5bad..832422d706f41073420defb07c11cf914f3660b6 100644 (file)
@@ -259,8 +259,10 @@ struct ftrace_probe_ops {
        void                    (*func)(unsigned long ip,
                                        unsigned long parent_ip,
                                        void **data);
-       int                     (*callback)(unsigned long ip, void **data);
-       void                    (*free)(void **data);
+       int                     (*init)(struct ftrace_probe_ops *ops,
+                                       unsigned long ip, void **data);
+       void                    (*free)(struct ftrace_probe_ops *ops,
+                                       unsigned long ip, void **data);
        int                     (*print)(struct seq_file *m,
                                         unsigned long ip,
                                         struct ftrace_probe_ops *ops,
index dab031fec85b2e621f543c6770402f93e16bf515..ff0ef41c6d936d934bdd3accc935decd16c90f28 100644 (file)
@@ -2984,7 +2984,7 @@ static void ftrace_free_entry_rcu(struct rcu_head *rhp)
                container_of(rhp, struct ftrace_func_probe, rcu);
 
        if (entry->ops->free)
-               entry->ops->free(&entry->data);
+               entry->ops->free(entry->ops, entry->ip, &entry->data);
        kfree(entry);
 }
 
@@ -3045,8 +3045,8 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
                 * for each function we find. We call the callback
                 * to give the caller an opportunity to do so.
                 */
-               if (ops->callback) {
-                       if (ops->callback(rec->ip, &entry->data) < 0) {
+               if (ops->init) {
+                       if (ops->init(ops, rec->ip, &entry->data) < 0) {
                                /* caller does not like this func */
                                kfree(entry);
                                continue;