diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-05-17 20:27:29 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-05-17 20:49:36 +0300 |
commit | 25a7d914274de38637c5199342eb90a297361386 (patch) | |
tree | 58d563fe50180ff95dd71b2be4081aa750348e05 /tools/perf/tests/parse-events.c | |
parent | c02cab228e44aacf161642b63779971f8e39993b (diff) | |
download | linux-25a7d914274de38637c5199342eb90a297361386.tar.xz |
perf parse-events: Use get/put_events_file()
Instead of accessing the trace_events_path variable directly, that may
not have been properly initialized wrt detecting where tracefs is
mounted.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-id7hzn1ydgkxbumeve5wapqz@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/parse-events.c')
-rw-r--r-- | tools/perf/tests/parse-events.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 6829dd416a99..6d57d7082637 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1328,7 +1328,7 @@ static int count_tracepoints(void) TEST_ASSERT_VAL("Can't open events dir", events_dir); while ((events_ent = readdir(events_dir))) { - char sys_path[PATH_MAX]; + char *sys_path; struct dirent *sys_ent; DIR *sys_dir; @@ -1339,8 +1339,8 @@ static int count_tracepoints(void) || !strcmp(events_ent->d_name, "header_page")) continue; - scnprintf(sys_path, PATH_MAX, "%s/%s", - tracing_events_path, events_ent->d_name); + sys_path = get_events_file(events_ent->d_name); + TEST_ASSERT_VAL("Can't get sys path", sys_path); sys_dir = opendir(sys_path); TEST_ASSERT_VAL("Can't open sys dir", sys_dir); @@ -1356,6 +1356,7 @@ static int count_tracepoints(void) } closedir(sys_dir); + put_events_file(sys_path); } closedir(events_dir); |