diff options
Diffstat (limited to 'kernel/gcov/fs.c')
-rw-r--r-- | kernel/gcov/fs.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c index 7a7d2ee96d42..15ff01a76379 100644 --- a/kernel/gcov/fs.c +++ b/kernel/gcov/fs.c | |||
@@ -75,7 +75,7 @@ static int __init gcov_persist_setup(char *str) | |||
75 | unsigned long val; | 75 | unsigned long val; |
76 | 76 | ||
77 | if (kstrtoul(str, 0, &val)) { | 77 | if (kstrtoul(str, 0, &val)) { |
78 | pr_warning("invalid gcov_persist parameter '%s'\n", str); | 78 | pr_warn("invalid gcov_persist parameter '%s'\n", str); |
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | gcov_persist = val; | 81 | gcov_persist = val; |
@@ -242,7 +242,7 @@ static struct gcov_node *get_node_by_name(const char *name) | |||
242 | 242 | ||
243 | list_for_each_entry(node, &all_head, all) { | 243 | list_for_each_entry(node, &all_head, all) { |
244 | info = get_node_info(node); | 244 | info = get_node_info(node); |
245 | if (info && (strcmp(info->filename, name) == 0)) | 245 | if (info && (strcmp(gcov_info_filename(info), name) == 0)) |
246 | return node; | 246 | return node; |
247 | } | 247 | } |
248 | 248 | ||
@@ -279,7 +279,7 @@ static ssize_t gcov_seq_write(struct file *file, const char __user *addr, | |||
279 | seq = file->private_data; | 279 | seq = file->private_data; |
280 | info = gcov_iter_get_info(seq->private); | 280 | info = gcov_iter_get_info(seq->private); |
281 | mutex_lock(&node_lock); | 281 | mutex_lock(&node_lock); |
282 | node = get_node_by_name(info->filename); | 282 | node = get_node_by_name(gcov_info_filename(info)); |
283 | if (node) { | 283 | if (node) { |
284 | /* Reset counts or remove node for unloaded modules. */ | 284 | /* Reset counts or remove node for unloaded modules. */ |
285 | if (node->num_loaded == 0) | 285 | if (node->num_loaded == 0) |
@@ -365,7 +365,7 @@ static const char *deskew(const char *basename) | |||
365 | */ | 365 | */ |
366 | static void add_links(struct gcov_node *node, struct dentry *parent) | 366 | static void add_links(struct gcov_node *node, struct dentry *parent) |
367 | { | 367 | { |
368 | char *basename; | 368 | const char *basename; |
369 | char *target; | 369 | char *target; |
370 | int num; | 370 | int num; |
371 | int i; | 371 | int i; |
@@ -376,14 +376,14 @@ static void add_links(struct gcov_node *node, struct dentry *parent) | |||
376 | if (!node->links) | 376 | if (!node->links) |
377 | return; | 377 | return; |
378 | for (i = 0; i < num; i++) { | 378 | for (i = 0; i < num; i++) { |
379 | target = get_link_target(get_node_info(node)->filename, | 379 | target = get_link_target( |
380 | &gcov_link[i]); | 380 | gcov_info_filename(get_node_info(node)), |
381 | &gcov_link[i]); | ||
381 | if (!target) | 382 | if (!target) |
382 | goto out_err; | 383 | goto out_err; |
383 | basename = strrchr(target, '/'); | 384 | basename = kbasename(target); |
384 | if (!basename) | 385 | if (basename == target) |
385 | goto out_err; | 386 | goto out_err; |
386 | basename++; | ||
387 | node->links[i] = debugfs_create_symlink(deskew(basename), | 387 | node->links[i] = debugfs_create_symlink(deskew(basename), |
388 | parent, target); | 388 | parent, target); |
389 | if (!node->links[i]) | 389 | if (!node->links[i]) |
@@ -450,7 +450,7 @@ static struct gcov_node *new_node(struct gcov_node *parent, | |||
450 | } else | 450 | } else |
451 | node->dentry = debugfs_create_dir(node->name, parent->dentry); | 451 | node->dentry = debugfs_create_dir(node->name, parent->dentry); |
452 | if (!node->dentry) { | 452 | if (!node->dentry) { |
453 | pr_warning("could not create file\n"); | 453 | pr_warn("could not create file\n"); |
454 | kfree(node); | 454 | kfree(node); |
455 | return NULL; | 455 | return NULL; |
456 | } | 456 | } |
@@ -463,7 +463,7 @@ static struct gcov_node *new_node(struct gcov_node *parent, | |||
463 | 463 | ||
464 | err_nomem: | 464 | err_nomem: |
465 | kfree(node); | 465 | kfree(node); |
466 | pr_warning("out of memory\n"); | 466 | pr_warn("out of memory\n"); |
467 | return NULL; | 467 | return NULL; |
468 | } | 468 | } |
469 | 469 | ||
@@ -576,7 +576,7 @@ static void add_node(struct gcov_info *info) | |||
576 | struct gcov_node *parent; | 576 | struct gcov_node *parent; |
577 | struct gcov_node *node; | 577 | struct gcov_node *node; |
578 | 578 | ||
579 | filename = kstrdup(info->filename, GFP_KERNEL); | 579 | filename = kstrdup(gcov_info_filename(info), GFP_KERNEL); |
580 | if (!filename) | 580 | if (!filename) |
581 | return; | 581 | return; |
582 | parent = &root_node; | 582 | parent = &root_node; |
@@ -630,8 +630,8 @@ static void add_info(struct gcov_node *node, struct gcov_info *info) | |||
630 | */ | 630 | */ |
631 | loaded_info = kcalloc(num + 1, sizeof(struct gcov_info *), GFP_KERNEL); | 631 | loaded_info = kcalloc(num + 1, sizeof(struct gcov_info *), GFP_KERNEL); |
632 | if (!loaded_info) { | 632 | if (!loaded_info) { |
633 | pr_warning("could not add '%s' (out of memory)\n", | 633 | pr_warn("could not add '%s' (out of memory)\n", |
634 | info->filename); | 634 | gcov_info_filename(info)); |
635 | return; | 635 | return; |
636 | } | 636 | } |
637 | memcpy(loaded_info, node->loaded_info, | 637 | memcpy(loaded_info, node->loaded_info, |
@@ -644,8 +644,9 @@ static void add_info(struct gcov_node *node, struct gcov_info *info) | |||
644 | * data set replaces the copy of the last one. | 644 | * data set replaces the copy of the last one. |
645 | */ | 645 | */ |
646 | if (!gcov_info_is_compatible(node->unloaded_info, info)) { | 646 | if (!gcov_info_is_compatible(node->unloaded_info, info)) { |
647 | pr_warning("discarding saved data for %s " | 647 | pr_warn("discarding saved data for %s " |
648 | "(incompatible version)\n", info->filename); | 648 | "(incompatible version)\n", |
649 | gcov_info_filename(info)); | ||
649 | gcov_info_free(node->unloaded_info); | 650 | gcov_info_free(node->unloaded_info); |
650 | node->unloaded_info = NULL; | 651 | node->unloaded_info = NULL; |
651 | } | 652 | } |
@@ -655,8 +656,8 @@ static void add_info(struct gcov_node *node, struct gcov_info *info) | |||
655 | * The initial one takes precedence. | 656 | * The initial one takes precedence. |
656 | */ | 657 | */ |
657 | if (!gcov_info_is_compatible(node->loaded_info[0], info)) { | 658 | if (!gcov_info_is_compatible(node->loaded_info[0], info)) { |
658 | pr_warning("could not add '%s' (incompatible " | 659 | pr_warn("could not add '%s' (incompatible " |
659 | "version)\n", info->filename); | 660 | "version)\n", gcov_info_filename(info)); |
660 | kfree(loaded_info); | 661 | kfree(loaded_info); |
661 | return; | 662 | return; |
662 | } | 663 | } |
@@ -691,8 +692,9 @@ static void save_info(struct gcov_node *node, struct gcov_info *info) | |||
691 | else { | 692 | else { |
692 | node->unloaded_info = gcov_info_dup(info); | 693 | node->unloaded_info = gcov_info_dup(info); |
693 | if (!node->unloaded_info) { | 694 | if (!node->unloaded_info) { |
694 | pr_warning("could not save data for '%s' " | 695 | pr_warn("could not save data for '%s' " |
695 | "(out of memory)\n", info->filename); | 696 | "(out of memory)\n", |
697 | gcov_info_filename(info)); | ||
696 | } | 698 | } |
697 | } | 699 | } |
698 | } | 700 | } |
@@ -707,8 +709,8 @@ static void remove_info(struct gcov_node *node, struct gcov_info *info) | |||
707 | 709 | ||
708 | i = get_info_index(node, info); | 710 | i = get_info_index(node, info); |
709 | if (i < 0) { | 711 | if (i < 0) { |
710 | pr_warning("could not remove '%s' (not found)\n", | 712 | pr_warn("could not remove '%s' (not found)\n", |
711 | info->filename); | 713 | gcov_info_filename(info)); |
712 | return; | 714 | return; |
713 | } | 715 | } |
714 | if (gcov_persist) | 716 | if (gcov_persist) |
@@ -735,7 +737,7 @@ void gcov_event(enum gcov_action action, struct gcov_info *info) | |||
735 | struct gcov_node *node; | 737 | struct gcov_node *node; |
736 | 738 | ||
737 | mutex_lock(&node_lock); | 739 | mutex_lock(&node_lock); |
738 | node = get_node_by_name(info->filename); | 740 | node = get_node_by_name(gcov_info_filename(info)); |
739 | switch (action) { | 741 | switch (action) { |
740 | case GCOV_ADD: | 742 | case GCOV_ADD: |
741 | if (node) | 743 | if (node) |
@@ -747,8 +749,8 @@ void gcov_event(enum gcov_action action, struct gcov_info *info) | |||
747 | if (node) | 749 | if (node) |
748 | remove_info(node, info); | 750 | remove_info(node, info); |
749 | else { | 751 | else { |
750 | pr_warning("could not remove '%s' (not found)\n", | 752 | pr_warn("could not remove '%s' (not found)\n", |
751 | info->filename); | 753 | gcov_info_filename(info)); |
752 | } | 754 | } |
753 | break; | 755 | break; |
754 | } | 756 | } |