Commit 5693c926 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Arnaldo Carvalho de Melo

perf tools: Do not check debugfs MAGIC for tracing files

It's rather strange to be checking the debugfs MAGIC number for the
tracing directory. A system admin may want to have a custom set of
events to trace and it should be allowed to let the admin make a temp
file (even for tracing virtual boxes, this is useful).

Also with the coming tracefs, the files may not even be under debugfs,
so checking the debugfs MAGIC number is pointless.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Acked-by: default avatarJiri 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/20150202193552.546175764@goodmis.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 20f86fc1
...@@ -20,6 +20,20 @@ static const char * const debugfs_known_mountpoints[] = { ...@@ -20,6 +20,20 @@ static const char * const debugfs_known_mountpoints[] = {
static bool debugfs_found; static bool debugfs_found;
/* verify that a mountpoint is actually a debugfs instance */
static int debugfs_valid_mountpoint(const char *debugfs)
{
struct statfs st_fs;
if (statfs(debugfs, &st_fs) < 0)
return -ENOENT;
else if ((long)st_fs.f_type != (long)DEBUGFS_MAGIC)
return -ENOENT;
return 0;
}
/* find the path to the mounted debugfs */ /* find the path to the mounted debugfs */
const char *debugfs_find_mountpoint(void) const char *debugfs_find_mountpoint(void)
{ {
...@@ -60,20 +74,6 @@ const char *debugfs_find_mountpoint(void) ...@@ -60,20 +74,6 @@ const char *debugfs_find_mountpoint(void)
return debugfs_mountpoint; return debugfs_mountpoint;
} }
/* verify that a mountpoint is actually a debugfs instance */
int debugfs_valid_mountpoint(const char *debugfs)
{
struct statfs st_fs;
if (statfs(debugfs, &st_fs) < 0)
return -ENOENT;
else if ((long)st_fs.f_type != (long)DEBUGFS_MAGIC)
return -ENOENT;
return 0;
}
/* mount the debugfs somewhere if it's not mounted */ /* mount the debugfs somewhere if it's not mounted */
char *debugfs_mount(const char *mountpoint) char *debugfs_mount(const char *mountpoint)
{ {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#endif #endif
const char *debugfs_find_mountpoint(void); const char *debugfs_find_mountpoint(void);
int debugfs_valid_mountpoint(const char *debugfs);
char *debugfs_mount(const char *mountpoint); char *debugfs_mount(const char *mountpoint);
extern char debugfs_mountpoint[]; extern char debugfs_mountpoint[];
......
...@@ -175,9 +175,6 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config) ...@@ -175,9 +175,6 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
char evt_path[MAXPATHLEN]; char evt_path[MAXPATHLEN];
char dir_path[MAXPATHLEN]; char dir_path[MAXPATHLEN];
if (debugfs_valid_mountpoint(tracing_events_path))
return NULL;
sys_dir = opendir(tracing_events_path); sys_dir = opendir(tracing_events_path);
if (!sys_dir) if (!sys_dir)
return NULL; return NULL;
...@@ -473,12 +470,6 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx, ...@@ -473,12 +470,6 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx,
int parse_events_add_tracepoint(struct list_head *list, int *idx, int parse_events_add_tracepoint(struct list_head *list, int *idx,
char *sys, char *event) char *sys, char *event)
{ {
int ret;
ret = debugfs_valid_mountpoint(tracing_events_path);
if (ret)
return ret;
if (strpbrk(sys, "*?")) if (strpbrk(sys, "*?"))
return add_tracepoint_multi_sys(list, idx, sys, event); return add_tracepoint_multi_sys(list, idx, sys, event);
else else
...@@ -1109,13 +1100,6 @@ void print_tracepoint_events(const char *subsys_glob, const char *event_glob, ...@@ -1109,13 +1100,6 @@ void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
char evt_path[MAXPATHLEN]; char evt_path[MAXPATHLEN];
char dir_path[MAXPATHLEN]; char dir_path[MAXPATHLEN];
char sbuf[STRERR_BUFSIZE];
if (debugfs_valid_mountpoint(tracing_events_path)) {
printf(" [ Tracepoints not available: %s ]\n",
strerror_r(errno, sbuf, sizeof(sbuf)));
return;
}
sys_dir = opendir(tracing_events_path); sys_dir = opendir(tracing_events_path);
if (!sys_dir) if (!sys_dir)
...@@ -1163,9 +1147,6 @@ int is_valid_tracepoint(const char *event_string) ...@@ -1163,9 +1147,6 @@ int is_valid_tracepoint(const char *event_string)
char evt_path[MAXPATHLEN]; char evt_path[MAXPATHLEN];
char dir_path[MAXPATHLEN]; char dir_path[MAXPATHLEN];
if (debugfs_valid_mountpoint(tracing_events_path))
return 0;
sys_dir = opendir(tracing_events_path); sys_dir = opendir(tracing_events_path);
if (!sys_dir) if (!sys_dir)
return 0; return 0;
......
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