Commit b6887d7916e44c1d8913084fb6aa5004d9473f1a
1 parent
6a24a244cd
Exists in
master
and in
7 other branches
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>
Showing 3 changed files with 58 additions and 58 deletions Side-by-side Diff
include/linux/ftrace.h
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | |
109 | 109 | struct seq_file; |
110 | 110 | |
111 | -struct ftrace_hook_ops { | |
111 | +struct ftrace_probe_ops { | |
112 | 112 | void (*func)(unsigned long ip, |
113 | 113 | unsigned long parent_ip, |
114 | 114 | void **data); |
115 | 115 | |
116 | 116 | |
117 | 117 | |
... | ... | @@ -116,19 +116,19 @@ |
116 | 116 | void (*free)(void **data); |
117 | 117 | int (*print)(struct seq_file *m, |
118 | 118 | unsigned long ip, |
119 | - struct ftrace_hook_ops *ops, | |
119 | + struct ftrace_probe_ops *ops, | |
120 | 120 | void *data); |
121 | 121 | }; |
122 | 122 | |
123 | 123 | extern int |
124 | -register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, | |
124 | +register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |
125 | 125 | void *data); |
126 | 126 | extern void |
127 | -unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops, | |
127 | +unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |
128 | 128 | void *data); |
129 | 129 | extern void |
130 | -unregister_ftrace_function_hook_func(char *glob, struct ftrace_hook_ops *ops); | |
131 | -extern void unregister_ftrace_function_hook_all(char *glob); | |
130 | +unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); | |
131 | +extern void unregister_ftrace_function_probe_all(char *glob); | |
132 | 132 | |
133 | 133 | enum { |
134 | 134 | FTRACE_FL_FREE = (1 << 0), |
kernel/trace/ftrace.c
... | ... | @@ -255,9 +255,9 @@ |
255 | 255 | |
256 | 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 | 259 | struct hlist_node node; |
260 | - struct ftrace_hook_ops *ops; | |
260 | + struct ftrace_probe_ops *ops; | |
261 | 261 | unsigned long flags; |
262 | 262 | unsigned long ip; |
263 | 263 | void *data; |
264 | 264 | |
... | ... | @@ -830,11 +830,11 @@ |
830 | 830 | |
831 | 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 | 834 | struct hlist_node *hnd = v; |
835 | 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 | 839 | if (rec->ops->print) |
840 | 840 | return rec->ops->print(m, rec->ip, rec->ops, rec->data); |
841 | 841 | |
... | ... | @@ -1351,9 +1351,9 @@ |
1351 | 1351 | device_initcall(ftrace_mod_cmd_init); |
1352 | 1352 | |
1353 | 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 | 1357 | struct hlist_head *hhd; |
1358 | 1358 | struct hlist_node *n; |
1359 | 1359 | unsigned long key; |
1360 | 1360 | |
1361 | 1361 | |
1362 | 1362 | |
1363 | 1363 | |
... | ... | @@ -1379,18 +1379,18 @@ |
1379 | 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 | 1391 | int i; |
1392 | 1392 | |
1393 | - if (ftrace_hook_registered) | |
1393 | + if (ftrace_probe_registered) | |
1394 | 1394 | return; |
1395 | 1395 | |
1396 | 1396 | for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) { |
1397 | 1397 | |
1398 | 1398 | |
1399 | 1399 | |
... | ... | @@ -1402,16 +1402,16 @@ |
1402 | 1402 | if (i == FTRACE_FUNC_HASHSIZE) |
1403 | 1403 | return; |
1404 | 1404 | |
1405 | - __register_ftrace_function(&trace_hook_ops); | |
1405 | + __register_ftrace_function(&trace_probe_ops); | |
1406 | 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 | 1412 | int i; |
1413 | 1413 | |
1414 | - if (!ftrace_hook_registered) | |
1414 | + if (!ftrace_probe_registered) | |
1415 | 1415 | return; |
1416 | 1416 | |
1417 | 1417 | for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) { |
1418 | 1418 | |
1419 | 1419 | |
... | ... | @@ -1421,16 +1421,16 @@ |
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | /* no more funcs left */ |
1424 | - __unregister_ftrace_function(&trace_hook_ops); | |
1424 | + __unregister_ftrace_function(&trace_probe_ops); | |
1425 | 1425 | ftrace_shutdown(0); |
1426 | - ftrace_hook_registered = 0; | |
1426 | + ftrace_probe_registered = 0; | |
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | |
1430 | 1430 | static void ftrace_free_entry_rcu(struct rcu_head *rhp) |
1431 | 1431 | { |
1432 | - struct ftrace_func_hook *entry = | |
1433 | - container_of(rhp, struct ftrace_func_hook, rcu); | |
1432 | + struct ftrace_func_probe *entry = | |
1433 | + container_of(rhp, struct ftrace_func_probe, rcu); | |
1434 | 1434 | |
1435 | 1435 | if (entry->ops->free) |
1436 | 1436 | entry->ops->free(&entry->data); |
1437 | 1437 | |
... | ... | @@ -1439,10 +1439,10 @@ |
1439 | 1439 | |
1440 | 1440 | |
1441 | 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 | 1443 | void *data) |
1444 | 1444 | { |
1445 | - struct ftrace_func_hook *entry; | |
1445 | + struct ftrace_func_probe *entry; | |
1446 | 1446 | struct ftrace_page *pg; |
1447 | 1447 | struct dyn_ftrace *rec; |
1448 | 1448 | int type, len, not; |
... | ... | @@ -1453,7 +1453,7 @@ |
1453 | 1453 | type = ftrace_setup_glob(glob, strlen(glob), &search, ¬); |
1454 | 1454 | len = strlen(search); |
1455 | 1455 | |
1456 | - /* we do not support '!' for function hooks */ | |
1456 | + /* we do not support '!' for function probes */ | |
1457 | 1457 | if (WARN_ON(not)) |
1458 | 1458 | return -EINVAL; |
1459 | 1459 | |
... | ... | @@ -1468,7 +1468,7 @@ |
1468 | 1468 | |
1469 | 1469 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); |
1470 | 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 | 1472 | if (!count) |
1473 | 1473 | count = -ENOMEM; |
1474 | 1474 | goto out_unlock; |
... | ... | @@ -1498,7 +1498,7 @@ |
1498 | 1498 | hlist_add_head_rcu(&entry->node, &ftrace_func_hash[key]); |
1499 | 1499 | |
1500 | 1500 | } while_for_each_ftrace_rec(); |
1501 | - __enable_ftrace_function_hook(); | |
1501 | + __enable_ftrace_function_probe(); | |
1502 | 1502 | |
1503 | 1503 | out_unlock: |
1504 | 1504 | mutex_unlock(&ftrace_lock); |
1505 | 1505 | |
1506 | 1506 | |
... | ... | @@ -1507,15 +1507,15 @@ |
1507 | 1507 | } |
1508 | 1508 | |
1509 | 1509 | enum { |
1510 | - HOOK_TEST_FUNC = 1, | |
1511 | - HOOK_TEST_DATA = 2 | |
1510 | + PROBE_TEST_FUNC = 1, | |
1511 | + PROBE_TEST_DATA = 2 | |
1512 | 1512 | }; |
1513 | 1513 | |
1514 | 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 | 1516 | void *data, int flags) |
1517 | 1517 | { |
1518 | - struct ftrace_func_hook *entry; | |
1518 | + struct ftrace_func_probe *entry; | |
1519 | 1519 | struct hlist_node *n, *tmp; |
1520 | 1520 | char str[KSYM_SYMBOL_LEN]; |
1521 | 1521 | int type = MATCH_FULL; |
... | ... | @@ -1530,7 +1530,7 @@ |
1530 | 1530 | type = ftrace_setup_glob(glob, strlen(glob), &search, ¬); |
1531 | 1531 | len = strlen(search); |
1532 | 1532 | |
1533 | - /* we do not support '!' for function hooks */ | |
1533 | + /* we do not support '!' for function probes */ | |
1534 | 1534 | if (WARN_ON(not)) |
1535 | 1535 | return; |
1536 | 1536 | } |
1537 | 1537 | |
... | ... | @@ -1542,10 +1542,10 @@ |
1542 | 1542 | hlist_for_each_entry_safe(entry, n, tmp, hhd, node) { |
1543 | 1543 | |
1544 | 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 | 1546 | continue; |
1547 | 1547 | |
1548 | - if ((flags & HOOK_TEST_DATA) && entry->data != data) | |
1548 | + if ((flags & PROBE_TEST_DATA) && entry->data != data) | |
1549 | 1549 | continue; |
1550 | 1550 | |
1551 | 1551 | /* do this last, since it is the most expensive */ |
1552 | 1552 | |
1553 | 1553 | |
1554 | 1554 | |
1555 | 1555 | |
1556 | 1556 | |
1557 | 1557 | |
... | ... | @@ -1560,27 +1560,27 @@ |
1560 | 1560 | call_rcu(&entry->rcu, ftrace_free_entry_rcu); |
1561 | 1561 | } |
1562 | 1562 | } |
1563 | - __disable_ftrace_function_hook(); | |
1563 | + __disable_ftrace_function_probe(); | |
1564 | 1564 | mutex_unlock(&ftrace_lock); |
1565 | 1565 | } |
1566 | 1566 | |
1567 | 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 | 1569 | void *data) |
1570 | 1570 | { |
1571 | - __unregister_ftrace_function_hook(glob, ops, data, | |
1572 | - HOOK_TEST_FUNC | HOOK_TEST_DATA); | |
1571 | + __unregister_ftrace_function_probe(glob, ops, data, | |
1572 | + PROBE_TEST_FUNC | PROBE_TEST_DATA); | |
1573 | 1573 | } |
1574 | 1574 | |
1575 | 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 | 1586 | static LIST_HEAD(ftrace_commands); |
kernel/trace/trace_functions.c
... | ... | @@ -269,21 +269,21 @@ |
269 | 269 | |
270 | 270 | static int |
271 | 271 | ftrace_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 | |
274 | -static struct ftrace_hook_ops traceon_hook_ops = { | |
274 | +static struct ftrace_probe_ops traceon_probe_ops = { | |
275 | 275 | .func = ftrace_traceon, |
276 | 276 | .print = ftrace_trace_onoff_print, |
277 | 277 | }; |
278 | 278 | |
279 | -static struct ftrace_hook_ops traceoff_hook_ops = { | |
279 | +static struct ftrace_probe_ops traceoff_probe_ops = { | |
280 | 280 | .func = ftrace_traceoff, |
281 | 281 | .print = ftrace_trace_onoff_print, |
282 | 282 | }; |
283 | 283 | |
284 | 284 | static int |
285 | 285 | ftrace_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 | 288 | char str[KSYM_SYMBOL_LEN]; |
289 | 289 | long count = (long)data; |
... | ... | @@ -291,7 +291,7 @@ |
291 | 291 | kallsyms_lookup(ip, NULL, NULL, NULL, str); |
292 | 292 | seq_printf(m, "%s:", str); |
293 | 293 | |
294 | - if (ops == &traceon_hook_ops) | |
294 | + if (ops == &traceon_probe_ops) | |
295 | 295 | seq_printf(m, "traceon"); |
296 | 296 | else |
297 | 297 | seq_printf(m, "traceoff"); |
298 | 298 | |
299 | 299 | |
300 | 300 | |
... | ... | @@ -306,15 +306,15 @@ |
306 | 306 | static int |
307 | 307 | ftrace_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 | 311 | /* we register both traceon and traceoff to this callback */ |
312 | 312 | if (strcmp(cmd, "traceon") == 0) |
313 | - ops = &traceon_hook_ops; | |
313 | + ops = &traceon_probe_ops; | |
314 | 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 | 319 | return 0; |
320 | 320 | } |
... | ... | @@ -322,7 +322,7 @@ |
322 | 322 | static int |
323 | 323 | ftrace_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 | 326 | void *count = (void *)-1; |
327 | 327 | char *number; |
328 | 328 | int ret; |
329 | 329 | |
... | ... | @@ -336,9 +336,9 @@ |
336 | 336 | |
337 | 337 | /* we register both traceon and traceoff to this callback */ |
338 | 338 | if (strcmp(cmd, "traceon") == 0) |
339 | - ops = &traceon_hook_ops; | |
339 | + ops = &traceon_probe_ops; | |
340 | 340 | else |
341 | - ops = &traceoff_hook_ops; | |
341 | + ops = &traceoff_probe_ops; | |
342 | 342 | |
343 | 343 | if (!param) |
344 | 344 | goto out_reg; |
... | ... | @@ -357,7 +357,7 @@ |
357 | 357 | return ret; |
358 | 358 | |
359 | 359 | out_reg: |
360 | - ret = register_ftrace_function_hook(glob, ops, count); | |
360 | + ret = register_ftrace_function_probe(glob, ops, count); | |
361 | 361 | |
362 | 362 | return ret; |
363 | 363 | } |