summaryrefslogtreecommitdiff
path: root/tools/lib/api/fs/fs.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-09-02 10:56:40 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-09-04 18:01:00 +0300
commitc495afb4988dcbb8bae11b8f1bbb7e11f172672b (patch)
tree4713244446ae1ce0ac9ad172bc0f10e6410ac370 /tools/lib/api/fs/fs.c
parent8ccfabdb873df2e18b235bfaf2722f7528d220f1 (diff)
downloadlinux-c495afb4988dcbb8bae11b8f1bbb7e11f172672b.tar.xz
tools lib api fs: Add tracefs into fs.c object
Adding tracefs support into fs.c framework. It'll replace the tracefs object functionality in following patches. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Raphael Beamonte <raphael.beamonte@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1441180605-24737-11-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/api/fs/fs.c')
-rw-r--r--tools/lib/api/fs/fs.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 798052cbc7c0..ef16d2a83a27 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -28,6 +28,10 @@
#define DEBUGFS_MAGIC 0x64626720
#endif
+#ifndef TRACEFS_MAGIC
+#define TRACEFS_MAGIC 0x74726163
+#endif
+
static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
@@ -48,6 +52,19 @@ static const char * const debugfs__known_mountpoints[] = {
0,
};
+
+#ifndef TRACEFS_DEFAULT_PATH
+#define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing"
+#endif
+
+static const char * const tracefs__known_mountpoints[] = {
+ TRACEFS_DEFAULT_PATH,
+ "/sys/kernel/debug/tracing",
+ "/tracing",
+ "/trace",
+ 0,
+};
+
struct fs {
const char *name;
const char * const *mounts;
@@ -60,8 +77,13 @@ enum {
FS__SYSFS = 0,
FS__PROCFS = 1,
FS__DEBUGFS = 2,
+ FS__TRACEFS = 3,
};
+#ifndef TRACEFS_MAGIC
+#define TRACEFS_MAGIC 0x74726163
+#endif
+
static struct fs fs__entries[] = {
[FS__SYSFS] = {
.name = "sysfs",
@@ -78,6 +100,11 @@ static struct fs fs__entries[] = {
.mounts = debugfs__known_mountpoints,
.magic = DEBUGFS_MAGIC,
},
+ [FS__TRACEFS] = {
+ .name = "tracefs",
+ .mounts = tracefs__known_mountpoints,
+ .magic = TRACEFS_MAGIC,
+ },
};
static bool fs__read_mounts(struct fs *fs)
@@ -197,6 +224,7 @@ const char *name##__mountpoint(void) \
FS__MOUNTPOINT(sysfs, FS__SYSFS);
FS__MOUNTPOINT(procfs, FS__PROCFS);
FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
+FS__MOUNTPOINT(tracefs, FS__TRACEFS);
int filename__read_int(const char *filename, int *value)
{