Skip to content

Commit

Permalink
tools lib api debugfs: Add DEBUGFS_DEFAULT_PATH macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Rostedt (Red Hat) authored and Arnaldo Carvalho de Melo committed Feb 7, 2015
1 parent 4ef92c2 commit a9edf60
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/lib/api/fs/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@

#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[] = {
"/sys/kernel/debug",
DEBUGFS_DEFAULT_PATH,
"/debug",
0,
};
Expand Down Expand Up @@ -50,7 +54,7 @@ char *debugfs_mount(const char *mountpoint)
mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT);
/* if no environment variable, use default */
if (mountpoint == NULL)
mountpoint = "/sys/kernel/debug";
mountpoint = DEBUGFS_DEFAULT_PATH;
}

if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
Expand Down

0 comments on commit a9edf60

Please sign in to comment.