Skip to content

Commit

Permalink
tools lib fs: Pass filename to debugfs__strerror_open
Browse files Browse the repository at this point in the history
It was hardcoded for one specific tracepoint, leftover from its initial
user: 'perf trace'.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-j1jicvwljy5qx1nah4mkmyke@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed Jan 22, 2015
1 parent e2726d9 commit 801c67b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tools/lib/api/fs/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ char *debugfs_mount(const char *mountpoint)
return debugfs_mountpoint;
}

int debugfs__strerror_open(int err, char *buf, size_t size)
int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename)
{
char sbuf[128];

Expand All @@ -114,9 +114,9 @@ int debugfs__strerror_open(int err, char *buf, size_t size)
break;
case EACCES:
snprintf(buf, size,
"Error:\tNo permissions to read %s/tracing/events/raw_syscalls\n"
"Error:\tNo permissions to read %s/%s\n"
"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
debugfs_mountpoint, debugfs_mountpoint);
debugfs_mountpoint, filename, debugfs_mountpoint);
break;
default:
snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf)));
Expand Down
2 changes: 1 addition & 1 deletion tools/lib/api/fs/debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ char *debugfs_mount(const char *mountpoint);

extern char debugfs_mountpoint[];

int debugfs__strerror_open(int err, char *buf, size_t size);
int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);

#endif /* __API_DEBUGFS_H__ */
5 changes: 3 additions & 2 deletions tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (trace->trace_syscalls &&
perf_evlist__add_syscall_newtp(evlist, trace__sys_enter,
trace__sys_exit))
goto out_error_tp;
goto out_error_raw_syscalls;

if (trace->trace_syscalls)
perf_evlist__add_vfs_getname(evlist);
Expand Down Expand Up @@ -2210,7 +2210,8 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
char errbuf[BUFSIZ];

out_error_tp:
debugfs__strerror_open(errno, errbuf, sizeof(errbuf));
out_error_raw_syscalls:
debugfs__strerror_open(errno, errbuf, sizeof(errbuf), "tracing/events/raw_syscalls");
goto out_error;

out_error_mmap:
Expand Down

0 comments on commit 801c67b

Please sign in to comment.