aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2013-02-20 10:32:31 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-03-15 12:06:01 -0400
commit1355915ac626da30a0c02ccd4569c1e5ce2cbb82 (patch)
tree37a7cb0618572c4c45d0ec6949cdda6253694291 /tools/lib
parent85c66be101e1847f0eb46dcb48d5738572129694 (diff)
perf tools: Extract perf-specific stuff from debugfs.c
Move them to util.c and simplify code a bit. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1361374353-30385-6-git-send-email-bp@alien8.de Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/lk/debugfs.c15
-rw-r--r--tools/lib/lk/debugfs.h2
2 files changed, 0 insertions, 17 deletions
diff --git a/tools/lib/lk/debugfs.c b/tools/lib/lk/debugfs.c
index 9cda7a6f5917..099e7cd022e4 100644
--- a/tools/lib/lk/debugfs.c
+++ b/tools/lib/lk/debugfs.c
@@ -11,7 +11,6 @@
11#include "debugfs.h" 11#include "debugfs.h"
12 12
13char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; 13char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug";
14char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
15 14
16static const char * const debugfs_known_mountpoints[] = { 15static const char * const debugfs_known_mountpoints[] = {
17 "/sys/kernel/debug/", 16 "/sys/kernel/debug/",
@@ -75,14 +74,7 @@ int debugfs_valid_mountpoint(const char *debugfs)
75 return 0; 74 return 0;
76} 75}
77 76
78static void debugfs_set_tracing_events_path(const char *mountpoint)
79{
80 snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s",
81 mountpoint, "tracing/events");
82}
83
84/* mount the debugfs somewhere if it's not mounted */ 77/* mount the debugfs somewhere if it's not mounted */
85
86char *debugfs_mount(const char *mountpoint) 78char *debugfs_mount(const char *mountpoint)
87{ 79{
88 /* see if it's already mounted */ 80 /* see if it's already mounted */
@@ -105,12 +97,5 @@ char *debugfs_mount(const char *mountpoint)
105 debugfs_found = true; 97 debugfs_found = true;
106 strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint)); 98 strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
107out: 99out:
108 debugfs_set_tracing_events_path(debugfs_mountpoint);
109 return debugfs_mountpoint; 100 return debugfs_mountpoint;
110} 101}
111
112void debugfs_set_path(const char *mountpoint)
113{
114 snprintf(debugfs_mountpoint, sizeof(debugfs_mountpoint), "%s", mountpoint);
115 debugfs_set_tracing_events_path(mountpoint);
116}
diff --git a/tools/lib/lk/debugfs.h b/tools/lib/lk/debugfs.h
index bc5ad2df7c0a..935c59bdb442 100644
--- a/tools/lib/lk/debugfs.h
+++ b/tools/lib/lk/debugfs.h
@@ -23,9 +23,7 @@
23const char *debugfs_find_mountpoint(void); 23const char *debugfs_find_mountpoint(void);
24int debugfs_valid_mountpoint(const char *debugfs); 24int debugfs_valid_mountpoint(const char *debugfs);
25char *debugfs_mount(const char *mountpoint); 25char *debugfs_mount(const char *mountpoint);
26void debugfs_set_path(const char *mountpoint);
27 26
28extern char debugfs_mountpoint[]; 27extern char debugfs_mountpoint[];
29extern char tracing_events_path[];
30 28
31#endif /* __LK_DEBUGFS_H__ */ 29#endif /* __LK_DEBUGFS_H__ */