aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-02-17 12:32:04 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-02-17 12:32:04 -0500
commitb6887d7916e44c1d8913084fb6aa5004d9473f1a (patch)
tree3446baa5592ce9ce17abb51ffdf3d89e6b52ef9b
parent6a24a244cd3a02d5b290293c32fcf2c6e92b4235 (diff)
ftrace: rename _hook to _probe
Impact: clean up Ingo Molnar did not like the _hook naming convention used by the select function tracer. Luis Claudio R. Goncalves suggested using the "_probe" extension. This patch implements the change of calling the functions and variables "_hook" and replacing them with "_probe". Signed-off-by: Steven Rostedt <srostedt@redhat.com>
-rw-r--r--include/linux/ftrace.h12
-rw-r--r--kernel/trace/ftrace.c78
-rw-r--r--kernel/trace/trace_functions.c26
3 files changed, 58 insertions, 58 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 63281228ce3e..9d224c43e634 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -108,7 +108,7 @@ struct ftrace_func_command {
108 108
109struct seq_file; 109struct seq_file;
110 110
111struct ftrace_hook_ops { 111struct ftrace_probe_ops {
112 void (*func)(unsigned long ip, 112 void (*func)(unsigned long ip,
113 unsigned long parent_ip, 113 unsigned long parent_ip,
114 void **data); 114 void **data);
@@ -116,19 +116,19 @@ struct ftrace_hook_ops {
116 void (*free)(void **data); 116 void (*free)(void **data);
117 int (*print)(struct seq_file *m, 117 int (*print)(struct seq_file *m,
118 unsigned long ip, 118 unsigned long ip,
119 struct ftrace_hook_ops *ops, 119 struct ftrace_probe_ops *ops,
120 void *data); 120 void *data);
121}; 121};
122 122
123extern int 123extern int
124register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, 124register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
125 void *data); 125 void *data);
126extern void 126extern void
127unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, 127unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
128 void *data); 128 void *data);
129extern void 129extern void
130unregister_ftrace_function_hook_func(char *glob, struct ftrace_hook_ops *ops); 130unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
131extern void unregister_ftrace_function_hook_all(char *glob); 131extern void unregister_ftrace_function_probe_all(char *glob);
132 132
133enum { 133enum {
134 FTRACE_FL_FREE = (1 << 0), 134 FTRACE_FL_FREE = (1 << 0),
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index af9d95c0e4de..330a059f6ed7 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -255,9 +255,9 @@ static struct pid * const ftrace_swapper_pid = &init_struct_pid;
255 255
256static struct hlist_head ftrace_func_hash[FTRACE_FUNC_HASHSIZE] __read_mostly; 256static struct hlist_head ftrace_func_hash[FTRACE_FUNC_HASHSIZE] __read_mostly;
257 257
258struct ftrace_func_hook { 258struct ftrace_func_probe {
259 struct hlist_node node; 259 struct hlist_node node;
260 struct ftrace_hook_ops *ops; 260 struct ftrace_probe_ops *ops;
261 unsigned long flags; 261 unsigned long flags;
262 unsigned long ip; 262 unsigned long ip;
263 void *data; 263 void *data;
@@ -830,11 +830,11 @@ static void *t_hash_start(struct seq_file *m, loff_t *pos)
830 830
831static int t_hash_show(struct seq_file *m, void *v) 831static int t_hash_show(struct seq_file *m, void *v)
832{ 832{
833 struct ftrace_func_hook *rec; 833 struct ftrace_func_probe *rec;
834 struct hlist_node *hnd = v; 834 struct hlist_node *hnd = v;
835 char str[KSYM_SYMBOL_LEN]; 835 char str[KSYM_SYMBOL_LEN];
836 836
837 rec = hlist_entry(hnd, struct ftrace_func_hook, node); 837 rec = hlist_entry(hnd, struct ftrace_func_probe, node);
838 838
839 if (rec->ops->print) 839 if (rec->ops->print)
840 return rec->ops->print(m, rec->ip, rec->ops, rec->data); 840 return rec->ops->print(m, rec->ip, rec->ops, rec->data);
@@ -1351,9 +1351,9 @@ static int __init ftrace_mod_cmd_init(void)
1351device_initcall(ftrace_mod_cmd_init); 1351device_initcall(ftrace_mod_cmd_init);
1352 1352
1353static void 1353static void
1354function_trace_hook_call(unsigned long ip, unsigned long parent_ip) 1354function_trace_probe_call(unsigned long ip, unsigned long parent_ip)
1355{ 1355{
1356 struct ftrace_func_hook *entry; 1356 struct ftrace_func_probe *entry;
1357 struct hlist_head *hhd; 1357 struct hlist_head *hhd;
1358 struct hlist_node *n; 1358 struct hlist_node *n;
1359 unsigned long key; 1359 unsigned long key;
@@ -1379,18 +1379,18 @@ function_trace_hook_call(unsigned long ip, unsigned long parent_ip)
1379 ftrace_preempt_enable(resched); 1379 ftrace_preempt_enable(resched);
1380} 1380}
1381 1381
1382static struct ftrace_ops trace_hook_ops __read_mostly = 1382static struct ftrace_ops trace_probe_ops __read_mostly =
1383{ 1383{
1384 .func = function_trace_hook_call, 1384 .func = function_trace_probe_call,
1385}; 1385};
1386 1386
1387static int ftrace_hook_registered; 1387static int ftrace_probe_registered;
1388 1388
1389static void __enable_ftrace_function_hook(void) 1389static void __enable_ftrace_function_probe(void)
1390{ 1390{
1391 int i; 1391 int i;
1392 1392
1393 if (ftrace_hook_registered) 1393 if (ftrace_probe_registered)
1394 return; 1394 return;
1395 1395
1396 for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) { 1396 for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) {
@@ -1402,16 +1402,16 @@ static void __enable_ftrace_function_hook(void)
1402 if (i == FTRACE_FUNC_HASHSIZE) 1402 if (i == FTRACE_FUNC_HASHSIZE)
1403 return; 1403 return;
1404 1404
1405 __register_ftrace_function(&trace_hook_ops); 1405 __register_ftrace_function(&trace_probe_ops);
1406 ftrace_startup(0); 1406 ftrace_startup(0);
1407 ftrace_hook_registered = 1; 1407 ftrace_probe_registered = 1;
1408} 1408}
1409 1409
1410static void __disable_ftrace_function_hook(void) 1410static void __disable_ftrace_function_probe(void)
1411{ 1411{
1412 int i; 1412 int i;
1413 1413
1414 if (!ftrace_hook_registered) 1414 if (!ftrace_probe_registered)
1415 return; 1415 return;
1416 1416
1417 for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) { 1417 for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) {
@@ -1421,16 +1421,16 @@ static void __disable_ftrace_function_hook(void)
1421 } 1421 }
1422 1422
1423 /* no more funcs left */ 1423 /* no more funcs left */
1424 __unregister_ftrace_function(&trace_hook_ops); 1424 __unregister_ftrace_function(&trace_probe_ops);
1425 ftrace_shutdown(0); 1425 ftrace_shutdown(0);
1426 ftrace_hook_registered = 0; 1426 ftrace_probe_registered = 0;
1427} 1427}
1428 1428
1429 1429
1430static void ftrace_free_entry_rcu(struct rcu_head *rhp) 1430static void ftrace_free_entry_rcu(struct rcu_head *rhp)
1431{ 1431{
1432 struct ftrace_func_hook *entry = 1432 struct ftrace_func_probe *entry =
1433 container_of(rhp, struct ftrace_func_hook, rcu); 1433 container_of(rhp, struct ftrace_func_probe, rcu);
1434 1434
1435 if (entry->ops->free) 1435 if (entry->ops->free)
1436 entry->ops->free(&entry->data); 1436 entry->ops->free(&entry->data);
@@ -1439,10 +1439,10 @@ static void ftrace_free_entry_rcu(struct rcu_head *rhp)
1439 1439
1440 1440
1441int 1441int
1442register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, 1442register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
1443 void *data) 1443 void *data)
1444{ 1444{
1445 struct ftrace_func_hook *entry; 1445 struct ftrace_func_probe *entry;
1446 struct ftrace_page *pg; 1446 struct ftrace_page *pg;
1447 struct dyn_ftrace *rec; 1447 struct dyn_ftrace *rec;
1448 int type, len, not; 1448 int type, len, not;
@@ -1453,7 +1453,7 @@ register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
1453 type = ftrace_setup_glob(glob, strlen(glob), &search, &not); 1453 type = ftrace_setup_glob(glob, strlen(glob), &search, &not);
1454 len = strlen(search); 1454 len = strlen(search);
1455 1455
1456 /* we do not support '!' for function hooks */ 1456 /* we do not support '!' for function probes */
1457 if (WARN_ON(not)) 1457 if (WARN_ON(not))
1458 return -EINVAL; 1458 return -EINVAL;
1459 1459
@@ -1468,7 +1468,7 @@ register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
1468 1468
1469 entry = kmalloc(sizeof(*entry), GFP_KERNEL); 1469 entry = kmalloc(sizeof(*entry), GFP_KERNEL);
1470 if (!entry) { 1470 if (!entry) {
1471 /* If we did not hook to any, then return error */ 1471 /* If we did not process any, then return error */
1472 if (!count) 1472 if (!count)
1473 count = -ENOMEM; 1473 count = -ENOMEM;
1474 goto out_unlock; 1474 goto out_unlock;
@@ -1498,7 +1498,7 @@ register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
1498 hlist_add_head_rcu(&entry->node, &ftrace_func_hash[key]); 1498 hlist_add_head_rcu(&entry->node, &ftrace_func_hash[key]);
1499 1499
1500 } while_for_each_ftrace_rec(); 1500 } while_for_each_ftrace_rec();
1501 __enable_ftrace_function_hook(); 1501 __enable_ftrace_function_probe();
1502 1502
1503 out_unlock: 1503 out_unlock:
1504 mutex_unlock(&ftrace_lock); 1504 mutex_unlock(&ftrace_lock);
@@ -1507,15 +1507,15 @@ register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
1507} 1507}
1508 1508
1509enum { 1509enum {
1510 HOOK_TEST_FUNC = 1, 1510 PROBE_TEST_FUNC = 1,
1511 HOOK_TEST_DATA = 2 1511 PROBE_TEST_DATA = 2
1512}; 1512};
1513 1513
1514static void 1514static void
1515__unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, 1515__unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
1516 void *data, int flags) 1516 void *data, int flags)
1517{ 1517{
1518 struct ftrace_func_hook *entry; 1518 struct ftrace_func_probe *entry;
1519 struct hlist_node *n, *tmp; 1519 struct hlist_node *n, *tmp;
1520 char str[KSYM_SYMBOL_LEN]; 1520 char str[KSYM_SYMBOL_LEN];
1521 int type = MATCH_FULL; 1521 int type = MATCH_FULL;
@@ -1530,7 +1530,7 @@ __unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
1530 type = ftrace_setup_glob(glob, strlen(glob), &search, &not); 1530 type = ftrace_setup_glob(glob, strlen(glob), &search, &not);
1531 len = strlen(search); 1531 len = strlen(search);
1532 1532
1533 /* we do not support '!' for function hooks */ 1533 /* we do not support '!' for function probes */
1534 if (WARN_ON(not)) 1534 if (WARN_ON(not))
1535 return; 1535 return;
1536 } 1536 }
@@ -1542,10 +1542,10 @@ __unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
1542 hlist_for_each_entry_safe(entry, n, tmp, hhd, node) { 1542 hlist_for_each_entry_safe(entry, n, tmp, hhd, node) {
1543 1543
1544 /* break up if statements for readability */ 1544 /* break up if statements for readability */
1545 if ((flags & HOOK_TEST_FUNC) && entry->ops != ops) 1545 if ((flags & PROBE_TEST_FUNC) && entry->ops != ops)
1546 continue; 1546 continue;
1547 1547
1548 if ((flags & HOOK_TEST_DATA) && entry->data != data) 1548 if ((flags & PROBE_TEST_DATA) && entry->data != data)
1549 continue; 1549 continue;
1550 1550
1551 /* do this last, since it is the most expensive */ 1551 /* do this last, since it is the most expensive */
@@ -1560,27 +1560,27 @@ __unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
1560 call_rcu(&entry->rcu, ftrace_free_entry_rcu); 1560 call_rcu(&entry->rcu, ftrace_free_entry_rcu);
1561 } 1561 }
1562 } 1562 }
1563 __disable_ftrace_function_hook(); 1563 __disable_ftrace_function_probe();
1564 mutex_unlock(&ftrace_lock); 1564 mutex_unlock(&ftrace_lock);
1565} 1565}
1566 1566
1567void 1567void
1568unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, 1568unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
1569 void *data) 1569 void *data)
1570{ 1570{
1571 __unregister_ftrace_function_hook(glob, ops, data, 1571 __unregister_ftrace_function_probe(glob, ops, data,
1572 HOOK_TEST_FUNC | HOOK_TEST_DATA); 1572 PROBE_TEST_FUNC | PROBE_TEST_DATA);
1573} 1573}
1574 1574
1575void 1575void
1576unregister_ftrace_function_hook_func(char *glob, struct ftrace_hook_ops *ops) 1576unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops)
1577{ 1577{
1578 __unregister_ftrace_function_hook(glob, ops, NULL, HOOK_TEST_FUNC); 1578 __unregister_ftrace_function_probe(glob, ops, NULL, PROBE_TEST_FUNC);
1579} 1579}
1580 1580
1581void unregister_ftrace_function_hook_all(char *glob) 1581void unregister_ftrace_function_probe_all(char *glob)
1582{ 1582{
1583 __unregister_ftrace_function_hook(glob, NULL, NULL, 0); 1583 __unregister_ftrace_function_probe(glob, NULL, NULL, 0);
1584} 1584}
1585 1585
1586static LIST_HEAD(ftrace_commands); 1586static LIST_HEAD(ftrace_commands);
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 021a574c5988..6ea73ed03bfa 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -269,21 +269,21 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data)
269 269
270static int 270static int
271ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip, 271ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
272 struct ftrace_hook_ops *ops, void *data); 272 struct ftrace_probe_ops *ops, void *data);
273 273
274static struct ftrace_hook_ops traceon_hook_ops = { 274static struct ftrace_probe_ops traceon_probe_ops = {
275 .func = ftrace_traceon, 275 .func = ftrace_traceon,
276 .print = ftrace_trace_onoff_print, 276 .print = ftrace_trace_onoff_print,
277}; 277};
278 278
279static struct ftrace_hook_ops traceoff_hook_ops = { 279static struct ftrace_probe_ops traceoff_probe_ops = {
280 .func = ftrace_traceoff, 280 .func = ftrace_traceoff,
281 .print = ftrace_trace_onoff_print, 281 .print = ftrace_trace_onoff_print,
282}; 282};
283 283
284static int 284static int
285ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip, 285ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
286 struct ftrace_hook_ops *ops, void *data) 286 struct ftrace_probe_ops *ops, void *data)
287{ 287{
288 char str[KSYM_SYMBOL_LEN]; 288 char str[KSYM_SYMBOL_LEN];
289 long count = (long)data; 289 long count = (long)data;
@@ -291,7 +291,7 @@ ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
291 kallsyms_lookup(ip, NULL, NULL, NULL, str); 291 kallsyms_lookup(ip, NULL, NULL, NULL, str);
292 seq_printf(m, "%s:", str); 292 seq_printf(m, "%s:", str);
293 293
294 if (ops == &traceon_hook_ops) 294 if (ops == &traceon_probe_ops)
295 seq_printf(m, "traceon"); 295 seq_printf(m, "traceon");
296 else 296 else
297 seq_printf(m, "traceoff"); 297 seq_printf(m, "traceoff");
@@ -306,15 +306,15 @@ ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
306static int 306static int
307ftrace_trace_onoff_unreg(char *glob, char *cmd, char *param) 307ftrace_trace_onoff_unreg(char *glob, char *cmd, char *param)
308{ 308{
309 struct ftrace_hook_ops *ops; 309 struct ftrace_probe_ops *ops;
310 310
311 /* we register both traceon and traceoff to this callback */ 311 /* we register both traceon and traceoff to this callback */
312 if (strcmp(cmd, "traceon") == 0) 312 if (strcmp(cmd, "traceon") == 0)
313 ops = &traceon_hook_ops; 313 ops = &traceon_probe_ops;
314 else 314 else
315 ops = &traceoff_hook_ops; 315 ops = &traceoff_probe_ops;
316 316
317 unregister_ftrace_function_hook_func(glob, ops); 317 unregister_ftrace_function_probe_func(glob, ops);
318 318
319 return 0; 319 return 0;
320} 320}
@@ -322,7 +322,7 @@ ftrace_trace_onoff_unreg(char *glob, char *cmd, char *param)
322static int 322static int
323ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable) 323ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable)
324{ 324{
325 struct ftrace_hook_ops *ops; 325 struct ftrace_probe_ops *ops;
326 void *count = (void *)-1; 326 void *count = (void *)-1;
327 char *number; 327 char *number;
328 int ret; 328 int ret;
@@ -336,9 +336,9 @@ ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable)
336 336
337 /* we register both traceon and traceoff to this callback */ 337 /* we register both traceon and traceoff to this callback */
338 if (strcmp(cmd, "traceon") == 0) 338 if (strcmp(cmd, "traceon") == 0)
339 ops = &traceon_hook_ops; 339 ops = &traceon_probe_ops;
340 else 340 else
341 ops = &traceoff_hook_ops; 341 ops = &traceoff_probe_ops;
342 342
343 if (!param) 343 if (!param)
344 goto out_reg; 344 goto out_reg;
@@ -357,7 +357,7 @@ ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable)
357 return ret; 357 return ret;
358 358
359 out_reg: 359 out_reg:
360 ret = register_ftrace_function_hook(glob, ops, count); 360 ret = register_ftrace_function_probe(glob, ops, count);
361 361
362 return ret; 362 return ret;
363} 363}