aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r--tools/perf/util/machine.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a53cd0b8c151..27c2a5efe450 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
717} 717}
718 718
719static int map_groups__set_modules_path_dir(struct map_groups *mg, 719static int map_groups__set_modules_path_dir(struct map_groups *mg,
720 const char *dir_name) 720 const char *dir_name, int depth)
721{ 721{
722 struct dirent *dent; 722 struct dirent *dent;
723 DIR *dir = opendir(dir_name); 723 DIR *dir = opendir(dir_name);
@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
742 !strcmp(dent->d_name, "..")) 742 !strcmp(dent->d_name, ".."))
743 continue; 743 continue;
744 744
745 ret = map_groups__set_modules_path_dir(mg, path); 745 /* Do not follow top-level source and build symlinks */
746 if (depth == 0) {
747 if (!strcmp(dent->d_name, "source") ||
748 !strcmp(dent->d_name, "build"))
749 continue;
750 }
751
752 ret = map_groups__set_modules_path_dir(mg, path,
753 depth + 1);
746 if (ret < 0) 754 if (ret < 0)
747 goto out; 755 goto out;
748 } else { 756 } else {
@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
786 if (!version) 794 if (!version)
787 return -1; 795 return -1;
788 796
789 snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel", 797 snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
790 machine->root_dir, version); 798 machine->root_dir, version);
791 free(version); 799 free(version);
792 800
793 return map_groups__set_modules_path_dir(&machine->kmaps, modules_path); 801 return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
794} 802}
795 803
796static int machine__create_module(void *arg, const char *name, u64 start) 804static int machine__create_module(void *arg, const char *name, u64 start)