提交 a9edf607 编写于 作者: S Steven Rostedt (Red Hat) 提交者: Arnaldo Carvalho de Melo

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: NSteven Rostedt <rostedt@goodmis.org>
Acked-by: NJiri 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.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 4ef92c2e
...@@ -10,10 +10,14 @@ ...@@ -10,10 +10,14 @@
#include "debugfs.h" #include "debugfs.h"
char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; #ifndef DEBUGFS_DEFAULT_PATH
#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
#endif
char debugfs_mountpoint[PATH_MAX + 1] = DEBUGFS_DEFAULT_PATH;
static const char * const debugfs_known_mountpoints[] = { static const char * const debugfs_known_mountpoints[] = {
"/sys/kernel/debug", DEBUGFS_DEFAULT_PATH,
"/debug", "/debug",
0, 0,
}; };
...@@ -50,7 +54,7 @@ char *debugfs_mount(const char *mountpoint) ...@@ -50,7 +54,7 @@ char *debugfs_mount(const char *mountpoint)
mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT); mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT);
/* if no environment variable, use default */ /* if no environment variable, use default */
if (mountpoint == NULL) if (mountpoint == NULL)
mountpoint = "/sys/kernel/debug"; mountpoint = DEBUGFS_DEFAULT_PATH;
} }
if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0) if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册