aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/api
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-02-02 14:35:02 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-02-07 07:51:30 -0500
commit5693c92660970851e95f769ff27397f5098a6296 (patch)
tree1524f86a36968a6e4372cf9a550519df8e074e16 /tools/lib/api
parent20f86fc1fde14c6d913ebf5f569ee85e058a7dbd (diff)
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: 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/20150202193552.546175764@goodmis.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/api')
-rw-r--r--tools/lib/api/fs/debugfs.c28
-rw-r--r--tools/lib/api/fs/debugfs.h1
2 files changed, 14 insertions, 15 deletions
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
index d2b18e887071..d21d4d6b4fd2 100644
--- a/tools/lib/api/fs/debugfs.c
+++ b/tools/lib/api/fs/debugfs.c
@@ -20,6 +20,20 @@ static const char * const debugfs_known_mountpoints[] = {
20 20
21static bool debugfs_found; 21static bool debugfs_found;
22 22
23/* verify that a mountpoint is actually a debugfs instance */
24
25static int debugfs_valid_mountpoint(const char *debugfs)
26{
27 struct statfs st_fs;
28
29 if (statfs(debugfs, &st_fs) < 0)
30 return -ENOENT;
31 else if ((long)st_fs.f_type != (long)DEBUGFS_MAGIC)
32 return -ENOENT;
33
34 return 0;
35}
36
23/* find the path to the mounted debugfs */ 37/* find the path to the mounted debugfs */
24const char *debugfs_find_mountpoint(void) 38const char *debugfs_find_mountpoint(void)
25{ 39{
@@ -60,20 +74,6 @@ const char *debugfs_find_mountpoint(void)
60 return debugfs_mountpoint; 74 return debugfs_mountpoint;
61} 75}
62 76
63/* verify that a mountpoint is actually a debugfs instance */
64
65int debugfs_valid_mountpoint(const char *debugfs)
66{
67 struct statfs st_fs;
68
69 if (statfs(debugfs, &st_fs) < 0)
70 return -ENOENT;
71 else if ((long)st_fs.f_type != (long)DEBUGFS_MAGIC)
72 return -ENOENT;
73
74 return 0;
75}
76
77/* mount the debugfs somewhere if it's not mounted */ 77/* mount the debugfs somewhere if it's not mounted */
78char *debugfs_mount(const char *mountpoint) 78char *debugfs_mount(const char *mountpoint)
79{ 79{
diff --git a/tools/lib/api/fs/debugfs.h b/tools/lib/api/fs/debugfs.h
index 0739881a9897..77bb36a95b07 100644
--- a/tools/lib/api/fs/debugfs.h
+++ b/tools/lib/api/fs/debugfs.h
@@ -21,7 +21,6 @@
21#endif 21#endif
22 22
23const char *debugfs_find_mountpoint(void); 23const char *debugfs_find_mountpoint(void);
24int debugfs_valid_mountpoint(const char *debugfs);
25char *debugfs_mount(const char *mountpoint); 24char *debugfs_mount(const char *mountpoint);
26 25
27extern char debugfs_mountpoint[]; 26extern char debugfs_mountpoint[];