diff options
-rw-r--r-- | tools/lib/api/fs/debugfs.c | 8 | ||||
-rw-r--r-- | tools/lib/api/fs/debugfs.h | 1 | ||||
-rw-r--r-- | tools/lib/api/fs/findfs.h | 2 | ||||
-rw-r--r-- | tools/lib/api/fs/tracefs.c | 8 | ||||
-rw-r--r-- | tools/lib/api/fs/tracefs.h | 1 |
5 files changed, 20 insertions, 0 deletions
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c index 07d74b03d828..8305b3e9d48e 100644 --- a/tools/lib/api/fs/debugfs.c +++ b/tools/lib/api/fs/debugfs.c | |||
@@ -3,8 +3,11 @@ | |||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <unistd.h> | ||
6 | #include <stdbool.h> | 7 | #include <stdbool.h> |
7 | #include <sys/vfs.h> | 8 | #include <sys/vfs.h> |
9 | #include <sys/types.h> | ||
10 | #include <sys/stat.h> | ||
8 | #include <sys/mount.h> | 11 | #include <sys/mount.h> |
9 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
10 | 13 | ||
@@ -24,6 +27,11 @@ static const char * const debugfs_known_mountpoints[] = { | |||
24 | 27 | ||
25 | static bool debugfs_found; | 28 | static bool debugfs_found; |
26 | 29 | ||
30 | bool debugfs_configured(void) | ||
31 | { | ||
32 | return debugfs_find_mountpoint() != NULL; | ||
33 | } | ||
34 | |||
27 | /* find the path to the mounted debugfs */ | 35 | /* find the path to the mounted debugfs */ |
28 | const char *debugfs_find_mountpoint(void) | 36 | const char *debugfs_find_mountpoint(void) |
29 | { | 37 | { |
diff --git a/tools/lib/api/fs/debugfs.h b/tools/lib/api/fs/debugfs.h index 1074ac81358e..455023698d2b 100644 --- a/tools/lib/api/fs/debugfs.h +++ b/tools/lib/api/fs/debugfs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR" | 11 | #define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR" |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | bool debugfs_configured(void); | ||
14 | const char *debugfs_find_mountpoint(void); | 15 | const char *debugfs_find_mountpoint(void); |
15 | char *debugfs_mount(const char *mountpoint); | 16 | char *debugfs_mount(const char *mountpoint); |
16 | 17 | ||
diff --git a/tools/lib/api/fs/findfs.h b/tools/lib/api/fs/findfs.h index 9e7d876791e1..b6f5d05acc42 100644 --- a/tools/lib/api/fs/findfs.h +++ b/tools/lib/api/fs/findfs.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __API_FINDFS_H__ | 1 | #ifndef __API_FINDFS_H__ |
2 | #define __API_FINDFS_H__ | 2 | #define __API_FINDFS_H__ |
3 | 3 | ||
4 | #include <stdbool.h> | ||
5 | |||
4 | #define _STR(x) #x | 6 | #define _STR(x) #x |
5 | #define STR(x) _STR(x) | 7 | #define STR(x) _STR(x) |
6 | 8 | ||
diff --git a/tools/lib/api/fs/tracefs.c b/tools/lib/api/fs/tracefs.c index ef40d15821e9..e4aa9688b71e 100644 --- a/tools/lib/api/fs/tracefs.c +++ b/tools/lib/api/fs/tracefs.c | |||
@@ -2,8 +2,11 @@ | |||
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <unistd.h> | ||
5 | #include <stdbool.h> | 6 | #include <stdbool.h> |
6 | #include <sys/vfs.h> | 7 | #include <sys/vfs.h> |
8 | #include <sys/types.h> | ||
9 | #include <sys/stat.h> | ||
7 | #include <sys/mount.h> | 10 | #include <sys/mount.h> |
8 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
9 | 12 | ||
@@ -25,6 +28,11 @@ static const char * const tracefs_known_mountpoints[] = { | |||
25 | 28 | ||
26 | static bool tracefs_found; | 29 | static bool tracefs_found; |
27 | 30 | ||
31 | bool tracefs_configured(void) | ||
32 | { | ||
33 | return tracefs_find_mountpoint() != NULL; | ||
34 | } | ||
35 | |||
28 | /* find the path to the mounted tracefs */ | 36 | /* find the path to the mounted tracefs */ |
29 | const char *tracefs_find_mountpoint(void) | 37 | const char *tracefs_find_mountpoint(void) |
30 | { | 38 | { |
diff --git a/tools/lib/api/fs/tracefs.h b/tools/lib/api/fs/tracefs.h index e6f7f5183c87..da780ac49acb 100644 --- a/tools/lib/api/fs/tracefs.h +++ b/tools/lib/api/fs/tracefs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR" | 11 | #define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR" |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | bool tracefs_configured(void); | ||
14 | const char *tracefs_find_mountpoint(void); | 15 | const char *tracefs_find_mountpoint(void); |
15 | int tracefs_valid_mountpoint(const char *debugfs); | 16 | int tracefs_valid_mountpoint(const char *debugfs); |
16 | char *tracefs_mount(const char *mountpoint); | 17 | char *tracefs_mount(const char *mountpoint); |