diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-09-02 03:56:44 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-14 11:50:15 -0400 |
commit | 60a1133a5b39738671eff1e4d77bedc1ee3fa528 (patch) | |
tree | 646ab3b3dc8c42950b19f27e0b0f99bdfbf75833 /tools/lib/api/fs/tracefs.c | |
parent | 4605eab3487dc818b1f3cbee2cd139cca3564be7 (diff) |
tools lib api fs: Remove debugfs, tracefs and findfs objects
We have all the functionality in fs.c, let's remove unneeded
objects.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
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: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-15-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/api/fs/tracefs.c')
-rw-r--r-- | tools/lib/api/fs/tracefs.c | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/tools/lib/api/fs/tracefs.c b/tools/lib/api/fs/tracefs.c deleted file mode 100644 index e4aa9688b71e..000000000000 --- a/tools/lib/api/fs/tracefs.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | #include <errno.h> | ||
2 | #include <stdio.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <string.h> | ||
5 | #include <unistd.h> | ||
6 | #include <stdbool.h> | ||
7 | #include <sys/vfs.h> | ||
8 | #include <sys/types.h> | ||
9 | #include <sys/stat.h> | ||
10 | #include <sys/mount.h> | ||
11 | #include <linux/kernel.h> | ||
12 | |||
13 | #include "tracefs.h" | ||
14 | |||
15 | #ifndef TRACEFS_DEFAULT_PATH | ||
16 | #define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing" | ||
17 | #endif | ||
18 | |||
19 | char tracefs_mountpoint[PATH_MAX + 1] = TRACEFS_DEFAULT_PATH; | ||
20 | |||
21 | static const char * const tracefs_known_mountpoints[] = { | ||
22 | TRACEFS_DEFAULT_PATH, | ||
23 | "/sys/kernel/debug/tracing", | ||
24 | "/tracing", | ||
25 | "/trace", | ||
26 | 0, | ||
27 | }; | ||
28 | |||
29 | static bool tracefs_found; | ||
30 | |||
31 | bool tracefs_configured(void) | ||
32 | { | ||
33 | return tracefs_find_mountpoint() != NULL; | ||
34 | } | ||
35 | |||
36 | /* find the path to the mounted tracefs */ | ||
37 | const char *tracefs_find_mountpoint(void) | ||
38 | { | ||
39 | const char *ret; | ||
40 | |||
41 | if (tracefs_found) | ||
42 | return (const char *)tracefs_mountpoint; | ||
43 | |||
44 | ret = find_mountpoint("tracefs", (long) TRACEFS_MAGIC, | ||
45 | tracefs_mountpoint, PATH_MAX + 1, | ||
46 | tracefs_known_mountpoints); | ||
47 | |||
48 | if (ret) | ||
49 | tracefs_found = true; | ||
50 | |||
51 | return ret; | ||
52 | } | ||
53 | |||
54 | /* mount the tracefs somewhere if it's not mounted */ | ||
55 | char *tracefs_mount(const char *mountpoint) | ||
56 | { | ||
57 | /* see if it's already mounted */ | ||
58 | if (tracefs_find_mountpoint()) | ||
59 | goto out; | ||
60 | |||
61 | /* if not mounted and no argument */ | ||
62 | if (mountpoint == NULL) { | ||
63 | /* see if environment variable set */ | ||
64 | mountpoint = getenv(PERF_TRACEFS_ENVIRONMENT); | ||
65 | /* if no environment variable, use default */ | ||
66 | if (mountpoint == NULL) | ||
67 | mountpoint = TRACEFS_DEFAULT_PATH; | ||
68 | } | ||
69 | |||
70 | if (mount(NULL, mountpoint, "tracefs", 0, NULL) < 0) | ||
71 | return NULL; | ||
72 | |||
73 | /* save the mountpoint */ | ||
74 | tracefs_found = true; | ||
75 | strncpy(tracefs_mountpoint, mountpoint, sizeof(tracefs_mountpoint)); | ||
76 | out: | ||
77 | return tracefs_mountpoint; | ||
78 | } | ||