diff options
Diffstat (limited to 'tools/lib/api/fs/tracing_path.c')
-rw-r--r-- | tools/lib/api/fs/tracing_path.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 3b3e4f5fc50b..1e0bb0da5e4f 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c | |||
@@ -90,33 +90,39 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename) | |||
90 | 90 | ||
91 | switch (err) { | 91 | switch (err) { |
92 | case ENOENT: | 92 | case ENOENT: |
93 | if (debugfs_configured()) { | 93 | /* |
94 | * We will get here if we can't find the tracepoint, but one of | ||
95 | * debugfs or tracefs is configured, which means you probably | ||
96 | * want some tracepoint which wasn't compiled in your kernel. | ||
97 | * - jirka | ||
98 | */ | ||
99 | if (debugfs_configured() || tracefs_configured()) { | ||
94 | snprintf(buf, size, | 100 | snprintf(buf, size, |
95 | "Error:\tFile %s/%s not found.\n" | 101 | "Error:\tFile %s/%s not found.\n" |
96 | "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", | 102 | "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", |
97 | debugfs_mountpoint, filename); | 103 | tracing_events_path, filename); |
98 | break; | 104 | break; |
99 | } | 105 | } |
100 | snprintf(buf, size, "%s", | 106 | snprintf(buf, size, "%s", |
101 | "Error:\tUnable to find debugfs\n" | 107 | "Error:\tUnable to find debugfs/tracefs\n" |
102 | "Hint:\tWas your kernel compiled with debugfs support?\n" | 108 | "Hint:\tWas your kernel compiled with debugfs/tracefs support?\n" |
103 | "Hint:\tIs the debugfs filesystem mounted?\n" | 109 | "Hint:\tIs the debugfs/tracefs filesystem mounted?\n" |
104 | "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); | 110 | "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); |
105 | break; | 111 | break; |
106 | case EACCES: { | 112 | case EACCES: { |
107 | const char *mountpoint = debugfs_mountpoint; | 113 | const char *mountpoint = debugfs_find_mountpoint(); |
108 | 114 | ||
109 | if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { | 115 | if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { |
110 | const char *tracefs_mntpoint = tracefs_find_mountpoint(); | 116 | const char *tracefs_mntpoint = tracefs_find_mountpoint(); |
111 | 117 | ||
112 | if (tracefs_mntpoint) | 118 | if (tracefs_mntpoint) |
113 | mountpoint = tracefs_mntpoint; | 119 | mountpoint = tracefs_find_mountpoint(); |
114 | } | 120 | } |
115 | 121 | ||
116 | snprintf(buf, size, | 122 | snprintf(buf, size, |
117 | "Error:\tNo permissions to read %s/%s\n" | 123 | "Error:\tNo permissions to read %s/%s\n" |
118 | "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", | 124 | "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", |
119 | debugfs_mountpoint, filename, mountpoint); | 125 | tracing_events_path, filename, mountpoint); |
120 | } | 126 | } |
121 | break; | 127 | break; |
122 | default: | 128 | default: |
@@ -131,7 +137,7 @@ int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char * | |||
131 | { | 137 | { |
132 | char path[PATH_MAX]; | 138 | char path[PATH_MAX]; |
133 | 139 | ||
134 | snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); | 140 | snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*"); |
135 | 141 | ||
136 | return strerror_open(err, buf, size, path); | 142 | return strerror_open(err, buf, size, path); |
137 | } | 143 | } |