diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-02-17 12:32:04 -0500 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-02-17 12:32:04 -0500 |
commit | b6887d7916e44c1d8913084fb6aa5004d9473f1a (patch) | |
tree | 3446baa5592ce9ce17abb51ffdf3d89e6b52ef9b /kernel/trace/ftrace.c | |
parent | 6a24a244cd3a02d5b290293c32fcf2c6e92b4235 (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>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 78 |
1 files changed, 39 insertions, 39 deletions
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 | ||
256 | static struct hlist_head ftrace_func_hash[FTRACE_FUNC_HASHSIZE] __read_mostly; | 256 | static struct hlist_head ftrace_func_hash[FTRACE_FUNC_HASHSIZE] __read_mostly; |
257 | 257 | ||
258 | struct ftrace_func_hook { | 258 | struct 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 | ||
831 | static int t_hash_show(struct seq_file *m, void *v) | 831 | static 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) | |||
1351 | device_initcall(ftrace_mod_cmd_init); | 1351 | device_initcall(ftrace_mod_cmd_init); |
1352 | 1352 | ||
1353 | static void | 1353 | static void |
1354 | function_trace_hook_call(unsigned long ip, unsigned long parent_ip) | 1354 | function_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 | ||
1382 | static struct ftrace_ops trace_hook_ops __read_mostly = | 1382 | static 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 | ||
1387 | static int ftrace_hook_registered; | 1387 | static int ftrace_probe_registered; |
1388 | 1388 | ||
1389 | static void __enable_ftrace_function_hook(void) | 1389 | static 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 | ||
1410 | static void __disable_ftrace_function_hook(void) | 1410 | static 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 | ||
1430 | static void ftrace_free_entry_rcu(struct rcu_head *rhp) | 1430 | static 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 | ||
1441 | int | 1441 | int |
1442 | register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, | 1442 | register_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, ¬); | 1453 | type = ftrace_setup_glob(glob, strlen(glob), &search, ¬); |
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 | ||
1509 | enum { | 1509 | enum { |
1510 | HOOK_TEST_FUNC = 1, | 1510 | PROBE_TEST_FUNC = 1, |
1511 | HOOK_TEST_DATA = 2 | 1511 | PROBE_TEST_DATA = 2 |
1512 | }; | 1512 | }; |
1513 | 1513 | ||
1514 | static void | 1514 | static 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, ¬); | 1530 | type = ftrace_setup_glob(glob, strlen(glob), &search, ¬); |
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 | ||
1567 | void | 1567 | void |
1568 | unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, | 1568 | unregister_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 | ||
1575 | void | 1575 | void |
1576 | unregister_ftrace_function_hook_func(char *glob, struct ftrace_hook_ops *ops) | 1576 | unregister_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 | ||
1581 | void unregister_ftrace_function_hook_all(char *glob) | 1581 | void 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 | ||
1586 | static LIST_HEAD(ftrace_commands); | 1586 | static LIST_HEAD(ftrace_commands); |