tools lib api: Unexport 'tracing_path' variable

One should use tracing_path_mount() instead, so more things get done
lazily instead of at every 'perf' tool call startup.

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-fci4yll35idd9yuslp67vqc2@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 00a62703
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "tracing_path.h" #include "tracing_path.h"
static char tracing_mnt[PATH_MAX] = "/sys/kernel/debug"; static char tracing_mnt[PATH_MAX] = "/sys/kernel/debug";
char tracing_path[PATH_MAX] = "/sys/kernel/debug/tracing"; static char tracing_path[PATH_MAX] = "/sys/kernel/debug/tracing";
char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events"; char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
...@@ -75,7 +75,7 @@ char *get_tracing_file(const char *name) ...@@ -75,7 +75,7 @@ char *get_tracing_file(const char *name)
{ {
char *file; char *file;
if (asprintf(&file, "%s/%s", tracing_path, name) < 0) if (asprintf(&file, "%s/%s", tracing_path_mount(), name) < 0)
return NULL; return NULL;
return file; return file;
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <linux/types.h> #include <linux/types.h>
extern char tracing_path[];
extern char tracing_events_path[]; extern char tracing_events_path[];
void tracing_path_set(const char *mountpoint); void tracing_path_set(const char *mountpoint);
......
...@@ -238,7 +238,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) ...@@ -238,7 +238,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
(*argc)--; (*argc)--;
} else if (strstarts(cmd, CMD_DEBUGFS_DIR)) { } else if (strstarts(cmd, CMD_DEBUGFS_DIR)) {
tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR)); tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
fprintf(stderr, "dir: %s\n", tracing_path); fprintf(stderr, "dir: %s\n", tracing_path_mount());
if (envchanged) if (envchanged)
*envchanged = 1; *envchanged = 1;
} else if (!strcmp(cmd, "--list-cmds")) { } else if (!strcmp(cmd, "--list-cmds")) {
...@@ -463,9 +463,6 @@ int main(int argc, const char **argv) ...@@ -463,9 +463,6 @@ int main(int argc, const char **argv)
return err; return err;
set_buildid_dir(NULL); set_buildid_dir(NULL);
/* get debugfs/tracefs mount point from /proc/mounts */
tracing_path_mount();
/* /*
* "perf-xxxx" is the same as "perf xxxx", but we obviously: * "perf-xxxx" is the same as "perf xxxx", but we obviously:
* *
......
...@@ -84,8 +84,7 @@ int open_trace_file(const char *trace_file, bool readwrite) ...@@ -84,8 +84,7 @@ int open_trace_file(const char *trace_file, bool readwrite)
char buf[PATH_MAX]; char buf[PATH_MAX];
int ret; int ret;
ret = e_snprintf(buf, PATH_MAX, "%s/%s", ret = e_snprintf(buf, PATH_MAX, "%s/%s", tracing_path_mount(), trace_file);
tracing_path, trace_file);
if (ret >= 0) { if (ret >= 0) {
pr_debug("Opening %s write=%d\n", buf, readwrite); pr_debug("Opening %s write=%d\n", buf, readwrite);
if (readwrite && !probe_event_dry_run) if (readwrite && !probe_event_dry_run)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment