aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2013-11-05 09:14:46 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-05 13:15:07 -0500
commita9862418547e818aa5842840aecfa81d733b97e9 (patch)
tree7081a4bc090652b64d716031ad277a67bd6ea051 /tools/perf
parentcf38fadade52df937521dd70d4437df1a9354cd9 (diff)
perf fs: Add procfs support
Adding procfs support into fs class. The interface function: const char *procfs__mountpoint(void); provides existing mountpoint path for procfs. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1383660887-1734-3-git-send-email-jolsa@redhat.com [ Fixup namespace ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/fs.c16
-rw-r--r--tools/perf/util/fs.h1
-rw-r--r--tools/perf/util/include/linux/magic.h4
3 files changed, 19 insertions, 2 deletions
diff --git a/tools/perf/util/fs.c b/tools/perf/util/fs.c
index 77bac4e4c115..f5be1f26e724 100644
--- a/tools/perf/util/fs.c
+++ b/tools/perf/util/fs.c
@@ -9,6 +9,11 @@ static const char * const sysfs__fs_known_mountpoints[] = {
9 0, 9 0,
10}; 10};
11 11
12static const char * const procfs__known_mountpoints[] = {
13 "/proc",
14 0,
15};
16
12struct fs { 17struct fs {
13 const char *name; 18 const char *name;
14 const char * const *mounts; 19 const char * const *mounts;
@@ -18,7 +23,8 @@ struct fs {
18}; 23};
19 24
20enum { 25enum {
21 FS__SYSFS = 0, 26 FS__SYSFS = 0,
27 FS__PROCFS = 1,
22}; 28};
23 29
24static struct fs fs__entries[] = { 30static struct fs fs__entries[] = {
@@ -27,6 +33,11 @@ static struct fs fs__entries[] = {
27 .mounts = sysfs__fs_known_mountpoints, 33 .mounts = sysfs__fs_known_mountpoints,
28 .magic = SYSFS_MAGIC, 34 .magic = SYSFS_MAGIC,
29 }, 35 },
36 [FS__PROCFS] = {
37 .name = "proc",
38 .mounts = procfs__known_mountpoints,
39 .magic = PROC_SUPER_MAGIC,
40 },
30}; 41};
31 42
32static bool fs__read_mounts(struct fs *fs) 43static bool fs__read_mounts(struct fs *fs)
@@ -104,4 +115,5 @@ const char *name##__mountpoint(void) \
104 return fs__mountpoint(idx); \ 115 return fs__mountpoint(idx); \
105} 116}
106 117
107FS__MOUNTPOINT(sysfs, FS__SYSFS); 118FS__MOUNTPOINT(sysfs, FS__SYSFS);
119FS__MOUNTPOINT(procfs, FS__PROCFS);
diff --git a/tools/perf/util/fs.h b/tools/perf/util/fs.h
index a7561c83c33c..5e09ce1bab0e 100644
--- a/tools/perf/util/fs.h
+++ b/tools/perf/util/fs.h
@@ -2,5 +2,6 @@
2#define __PERF_FS 2#define __PERF_FS
3 3
4const char *sysfs__mountpoint(void); 4const char *sysfs__mountpoint(void);
5const char *procfs__mountpoint(void);
5 6
6#endif /* __PERF_FS */ 7#endif /* __PERF_FS */
diff --git a/tools/perf/util/include/linux/magic.h b/tools/perf/util/include/linux/magic.h
index 58b64ed4da12..07d63cf3e0f6 100644
--- a/tools/perf/util/include/linux/magic.h
+++ b/tools/perf/util/include/linux/magic.h
@@ -9,4 +9,8 @@
9#define SYSFS_MAGIC 0x62656572 9#define SYSFS_MAGIC 0x62656572
10#endif 10#endif
11 11
12#ifndef PROC_SUPER_MAGIC
13#define PROC_SUPER_MAGIC 0x9fa0
14#endif
15
12#endif 16#endif