diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-02-02 14:35:05 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-02-07 07:56:32 -0500 |
commit | a9edf60749a9483341facfa7c28bcf8afb3c8311 (patch) | |
tree | 2df8eea85646c7555ad0003fcbbc3e30b9c130ce /tools/lib | |
parent | 4ef92c2ecd96ebad171e554020c83ce9fdb343ae (diff) |
tools lib api debugfs: Add DEBUGFS_DEFAULT_PATH macro
Instead of hard coding "/sys/kernel/debug" everywhere, create a macro to
hold where the default path exists.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150202193553.032117017@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/api/fs/debugfs.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c index 91e1668348ce..07d74b03d828 100644 --- a/tools/lib/api/fs/debugfs.c +++ b/tools/lib/api/fs/debugfs.c | |||
@@ -10,10 +10,14 @@ | |||
10 | 10 | ||
11 | #include "debugfs.h" | 11 | #include "debugfs.h" |
12 | 12 | ||
13 | char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; | 13 | #ifndef DEBUGFS_DEFAULT_PATH |
14 | #define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug" | ||
15 | #endif | ||
16 | |||
17 | char debugfs_mountpoint[PATH_MAX + 1] = DEBUGFS_DEFAULT_PATH; | ||
14 | 18 | ||
15 | static const char * const debugfs_known_mountpoints[] = { | 19 | static const char * const debugfs_known_mountpoints[] = { |
16 | "/sys/kernel/debug", | 20 | DEBUGFS_DEFAULT_PATH, |
17 | "/debug", | 21 | "/debug", |
18 | 0, | 22 | 0, |
19 | }; | 23 | }; |
@@ -50,7 +54,7 @@ char *debugfs_mount(const char *mountpoint) | |||
50 | mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT); | 54 | mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT); |
51 | /* if no environment variable, use default */ | 55 | /* if no environment variable, use default */ |
52 | if (mountpoint == NULL) | 56 | if (mountpoint == NULL) |
53 | mountpoint = "/sys/kernel/debug"; | 57 | mountpoint = DEBUGFS_DEFAULT_PATH; |
54 | } | 58 | } |
55 | 59 | ||
56 | if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0) | 60 | if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0) |