aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-events.c
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2009-11-08 10:03:07 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-08 12:01:35 -0500
commit549104f22b3cd4761145eb5fba6ee4d59822da61 (patch)
tree2966d464ffe82e391fad654d8e91ecf7a40f4367 /tools/perf/util/parse-events.c
parentafe61f677866ffc484e69c4ecca2d316d564d78b (diff)
perf tools: Modify perf routines to use new debugfs routines
modify perf.c get_debugfs_mntpnt() to use the util/debugfs.c debugfs_find_mountpoint() modify util/parse-events.c to use debugfs_valid_mountpoint(). Signed-off-by: Clark Williams <williams@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20091101155720.624cc87e@torg> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r--tools/perf/util/parse-events.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 31baa5a60365..097938a96d74 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -7,6 +7,7 @@
7#include "string.h" 7#include "string.h"
8#include "cache.h" 8#include "cache.h"
9#include "header.h" 9#include "header.h"
10#include "debugfs.h"
10 11
11int nr_counters; 12int nr_counters;
12 13
@@ -149,16 +150,6 @@ static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir)
149 150
150#define MAX_EVENT_LENGTH 512 151#define MAX_EVENT_LENGTH 512
151 152
152int valid_debugfs_mount(const char *debugfs)
153{
154 struct statfs st_fs;
155
156 if (statfs(debugfs, &st_fs) < 0)
157 return -ENOENT;
158 else if (st_fs.f_type != (long) DEBUGFS_MAGIC)
159 return -ENOENT;
160 return 0;
161}
162 153
163struct tracepoint_path *tracepoint_id_to_path(u64 config) 154struct tracepoint_path *tracepoint_id_to_path(u64 config)
164{ 155{
@@ -171,7 +162,7 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
171 char evt_path[MAXPATHLEN]; 162 char evt_path[MAXPATHLEN];
172 char dir_path[MAXPATHLEN]; 163 char dir_path[MAXPATHLEN];
173 164
174 if (valid_debugfs_mount(debugfs_path)) 165 if (debugfs_valid_mountpoint(debugfs_path))
175 return NULL; 166 return NULL;
176 167
177 sys_dir = opendir(debugfs_path); 168 sys_dir = opendir(debugfs_path);
@@ -510,7 +501,7 @@ static enum event_result parse_tracepoint_event(const char **strp,
510 char sys_name[MAX_EVENT_LENGTH]; 501 char sys_name[MAX_EVENT_LENGTH];
511 unsigned int sys_length, evt_length; 502 unsigned int sys_length, evt_length;
512 503
513 if (valid_debugfs_mount(debugfs_path)) 504 if (debugfs_valid_mountpoint(debugfs_path))
514 return 0; 505 return 0;
515 506
516 evt_name = strchr(*strp, ':'); 507 evt_name = strchr(*strp, ':');
@@ -788,7 +779,7 @@ static void print_tracepoint_events(void)
788 char evt_path[MAXPATHLEN]; 779 char evt_path[MAXPATHLEN];
789 char dir_path[MAXPATHLEN]; 780 char dir_path[MAXPATHLEN];
790 781
791 if (valid_debugfs_mount(debugfs_path)) 782 if (debugfs_valid_mountpoint(debugfs_path))
792 return; 783 return;
793 784
794 sys_dir = opendir(debugfs_path); 785 sys_dir = opendir(debugfs_path);