diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-05-17 13:42:39 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-05-17 13:50:38 -0400 |
commit | 7014e0e3bf9b0d0b6221eb7d2f8a1f690423dd73 (patch) | |
tree | 37da2c3997d4b2c03a4e1698481e8608925b11cd /tools/lib/api/fs/tracing_path.c | |
parent | 25a7d914274de38637c5199342eb90a297361386 (diff) |
tools lib api fs tracing_path: Introduce opendir() method
That takes care of using the right call to get the tracing_path
directory, the one that will end up calling tracing_path_set() to figure
out where tracefs is mounted.
One more step in doing just lazy reading of system structures to reduce
the number of operations done unconditionaly at 'perf' start.
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-42zzi0f274909bg9mxzl81bu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/api/fs/tracing_path.c')
-rw-r--r-- | tools/lib/api/fs/tracing_path.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 9cd282425929..9b451af0721c 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c | |||
@@ -101,6 +101,19 @@ void put_events_file(char *file) | |||
101 | free(file); | 101 | free(file); |
102 | } | 102 | } |
103 | 103 | ||
104 | DIR *tracing_events__opendir(void) | ||
105 | { | ||
106 | DIR *dir = NULL; | ||
107 | char *path = get_tracing_file("events"); | ||
108 | |||
109 | if (path) { | ||
110 | dir = opendir(path); | ||
111 | put_events_file(path); | ||
112 | } | ||
113 | |||
114 | return dir; | ||
115 | } | ||
116 | |||
104 | int tracing_path__strerror_open_tp(int err, char *buf, size_t size, | 117 | int tracing_path__strerror_open_tp(int err, char *buf, size_t size, |
105 | const char *sys, const char *name) | 118 | const char *sys, const char *name) |
106 | { | 119 | { |