Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
2015-09-04 9:48 GMT-04:00 Jiri Olsa : > it's not fs per say, it's 'combination,choice' of debugfs and tracefs > that provides 'path' for tracing ;-) Ok then! Makes sense :) Thanks 2015-09-02 3:56 GMT-04:00 Jiri Olsa : > Moving debugfs__strerror_open out of api/fs/debugfs.c, > because it's not debugfs specific. It'll be changed to > consider tracefs mount as well in following patches. > > Renaming it into tracing_path__strerror_open_tp to fit > into the namespace. No functional change is intended. > > Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) Reviewed-by: Raphaël Beamonte -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
On Fri, Sep 04, 2015 at 09:41:59AM -0400, Raphaël Beamonte wrote: > 2015-09-02 9:12 GMT-04:00 Arnaldo Carvalho de Melo : > > Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu: > > Humm, here I think that "_path" may look excessive... But tracing_path__ > > better > > than debugfs__, so its progress, applying, if we get a better name, we > > can change this later. > > > > - Arnaldo > > I agree that "tracing_path" seems a bit heavy. > Why not using tracefs here like for the previous changes? it's not fs per say, it's 'combination,choice' of debugfs and tracefs that provides 'path' for tracing ;-) jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
2015-09-02 9:12 GMT-04:00 Arnaldo Carvalho de Melo : > Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu: > Humm, here I think that "_path" may look excessive... But tracing_path__ > better > than debugfs__, so its progress, applying, if we get a better name, we > can change this later. > > - Arnaldo I agree that "tracing_path" seems a bit heavy. Why not using tracefs here like for the previous changes? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
On Wed, 02 Sep, at 09:56:35AM, Jiri Olsa wrote: > Moving debugfs__strerror_open out of api/fs/debugfs.c, > because it's not debugfs specific. It'll be changed to > consider tracefs mount as well in following patches. > > Renaming it into tracing_path__strerror_open_tp to fit > into the namespace. No functional change is intended. > > Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) Reviewed-by: Matt Fleming -- Matt Fleming, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
On Wed, 02 Sep, at 09:56:35AM, Jiri Olsa wrote: > Moving debugfs__strerror_open out of api/fs/debugfs.c, > because it's not debugfs specific. It'll be changed to > consider tracefs mount as well in following patches. > > Renaming it into tracing_path__strerror_open_tp to fit > into the namespace. No functional change is intended. > > Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org > Signed-off-by: Jiri Olsa> --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) Reviewed-by: Matt Fleming -- Matt Fleming, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
On Fri, Sep 04, 2015 at 09:41:59AM -0400, Raphaël Beamonte wrote: > 2015-09-02 9:12 GMT-04:00 Arnaldo Carvalho de Melo: > > Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu: > > Humm, here I think that "_path" may look excessive... But tracing_path__ > > better > > than debugfs__, so its progress, applying, if we get a better name, we > > can change this later. > > > > - Arnaldo > > I agree that "tracing_path" seems a bit heavy. > Why not using tracefs here like for the previous changes? it's not fs per say, it's 'combination,choice' of debugfs and tracefs that provides 'path' for tracing ;-) jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
2015-09-02 9:12 GMT-04:00 Arnaldo Carvalho de Melo: > Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu: > Humm, here I think that "_path" may look excessive... But tracing_path__ > better > than debugfs__, so its progress, applying, if we get a better name, we > can change this later. > > - Arnaldo I agree that "tracing_path" seems a bit heavy. Why not using tracefs here like for the previous changes? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
2015-09-04 9:48 GMT-04:00 Jiri Olsa: > it's not fs per say, it's 'combination,choice' of debugfs and tracefs > that provides 'path' for tracing ;-) Ok then! Makes sense :) Thanks 2015-09-02 3:56 GMT-04:00 Jiri Olsa : > Moving debugfs__strerror_open out of api/fs/debugfs.c, > because it's not debugfs specific. It'll be changed to > consider tracefs mount as well in following patches. > > Renaming it into tracing_path__strerror_open_tp to fit > into the namespace. No functional change is intended. > > Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) Reviewed-by: Raphaël Beamonte -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu: > Moving debugfs__strerror_open out of api/fs/debugfs.c, > because it's not debugfs specific. It'll be changed to > consider tracefs mount as well in following patches. > > Renaming it into tracing_path__strerror_open_tp to fit > into the namespace. No functional change is intended. Humm, here I think that "_path" may look excessive... But tracing_path__ better than debugfs__, so its progress, applying, if we get a better name, we can change this later. - Arnaldo > Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) > > diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c > index eb7cf4d18f8a..c707cfb32782 100644 > --- a/tools/lib/api/fs/debugfs.c > +++ b/tools/lib/api/fs/debugfs.c > @@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint) > out: > return debugfs_mountpoint; > } > - > -int debugfs__strerror_open(int err, char *buf, size_t size, const char > *filename) > -{ > - char sbuf[128]; > - > - switch (err) { > - case ENOENT: > - if (debugfs_found) { > - snprintf(buf, size, > - "Error:\tFile %s/%s not found.\n" > - "Hint:\tPerhaps this kernel misses some > CONFIG_ setting to enable this feature?.\n", > - debugfs_mountpoint, filename); > - break; > - } > - snprintf(buf, size, "%s", > - "Error:\tUnable to find debugfs\n" > - "Hint:\tWas your kernel compiled with debugfs > support?\n" > - "Hint:\tIs the debugfs filesystem mounted?\n" > - "Hint:\tTry 'sudo mount -t debugfs nodev > /sys/kernel/debug'"); > - break; > - case EACCES: { > - const char *mountpoint = debugfs_mountpoint; > - > - if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, > "tracing/", 8) == 0) { > - const char *tracefs_mntpoint = > tracefs_find_mountpoint(); > - > - if (tracefs_mntpoint) > - mountpoint = tracefs_mntpoint; > - } > - > - snprintf(buf, size, > - "Error:\tNo permissions to read %s/%s\n" > - "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", > - debugfs_mountpoint, filename, mountpoint); > - } > - break; > - default: > - snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf))); > - break; > - } > - > - return 0; > -} > - > -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char > *sys, const char *name) > -{ > - char path[PATH_MAX]; > - > - snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); > - > - return debugfs__strerror_open(err, buf, size, path); > -} > diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c > index 1fd6e1f99234..3b3e4f5fc50b 100644 > --- a/tools/lib/api/fs/tracing_path.c > +++ b/tools/lib/api/fs/tracing_path.c > @@ -5,6 +5,8 @@ > #include > #include > #include > +#include > +#include > #include "debugfs.h" > #include "tracefs.h" > > @@ -81,3 +83,55 @@ void put_tracing_file(char *file) > { > free(file); > } > + > +static int strerror_open(int err, char *buf, size_t size, const char > *filename) > +{ > + char sbuf[128]; > + > + switch (err) { > + case ENOENT: > + if (debugfs_configured()) { > + snprintf(buf, size, > + "Error:\tFile %s/%s not found.\n" > + "Hint:\tPerhaps this kernel misses some > CONFIG_ setting to enable this feature?.\n", > + debugfs_mountpoint, filename); > + break; > + } > + snprintf(buf, size, "%s", > + "Error:\tUnable to find debugfs\n" > + "Hint:\tWas your kernel compiled with debugfs > support?\n" > + "Hint:\tIs the debugfs filesystem mounted?\n" > + "Hint:\tTry 'sudo mount -t debugfs nodev > /sys/kernel/debug'"); > + break; > + case EACCES: { > + const char *mountpoint = debugfs_mountpoint; > + > + if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, > "tracing/", 8) == 0) { > + const char *tracefs_mntpoint = > tracefs_find_mountpoint(); > + > + if (tracefs_mntpoint) > +
[PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Moving debugfs__strerror_open out of api/fs/debugfs.c, because it's not debugfs specific. It'll be changed to consider tracefs mount as well in following patches. Renaming it into tracing_path__strerror_open_tp to fit into the namespace. No functional change is intended. Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org Signed-off-by: Jiri Olsa --- tools/lib/api/fs/debugfs.c | 52 --- tools/lib/api/fs/tracing_path.c | 54 + tools/lib/api/fs/tracing_path.h | 3 +++ tools/perf/builtin-trace.c | 5 ++-- 4 files changed, 60 insertions(+), 54 deletions(-) diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c index eb7cf4d18f8a..c707cfb32782 100644 --- a/tools/lib/api/fs/debugfs.c +++ b/tools/lib/api/fs/debugfs.c @@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint) out: return debugfs_mountpoint; } - -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename) -{ - char sbuf[128]; - - switch (err) { - case ENOENT: - if (debugfs_found) { - snprintf(buf, size, -"Error:\tFile %s/%s not found.\n" -"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", -debugfs_mountpoint, filename); - break; - } - snprintf(buf, size, "%s", -"Error:\tUnable to find debugfs\n" -"Hint:\tWas your kernel compiled with debugfs support?\n" -"Hint:\tIs the debugfs filesystem mounted?\n" -"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); - break; - case EACCES: { - const char *mountpoint = debugfs_mountpoint; - - if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { - const char *tracefs_mntpoint = tracefs_find_mountpoint(); - - if (tracefs_mntpoint) - mountpoint = tracefs_mntpoint; - } - - snprintf(buf, size, -"Error:\tNo permissions to read %s/%s\n" -"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", -debugfs_mountpoint, filename, mountpoint); - } - break; - default: - snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf))); - break; - } - - return 0; -} - -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name) -{ - char path[PATH_MAX]; - - snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); - - return debugfs__strerror_open(err, buf, size, path); -} diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 1fd6e1f99234..3b3e4f5fc50b 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "debugfs.h" #include "tracefs.h" @@ -81,3 +83,55 @@ void put_tracing_file(char *file) { free(file); } + +static int strerror_open(int err, char *buf, size_t size, const char *filename) +{ + char sbuf[128]; + + switch (err) { + case ENOENT: + if (debugfs_configured()) { + snprintf(buf, size, +"Error:\tFile %s/%s not found.\n" +"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", +debugfs_mountpoint, filename); + break; + } + snprintf(buf, size, "%s", +"Error:\tUnable to find debugfs\n" +"Hint:\tWas your kernel compiled with debugfs support?\n" +"Hint:\tIs the debugfs filesystem mounted?\n" +"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); + break; + case EACCES: { + const char *mountpoint = debugfs_mountpoint; + + if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { + const char *tracefs_mntpoint = tracefs_find_mountpoint(); + + if (tracefs_mntpoint) + mountpoint = tracefs_mntpoint; + } + + snprintf(buf, size, +"Error:\tNo permissions to read %s/%s\n" +"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", +debugfs_mountpoint, filename, mountpoint); + } + break; + default: +
[PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Moving debugfs__strerror_open out of api/fs/debugfs.c, because it's not debugfs specific. It'll be changed to consider tracefs mount as well in following patches. Renaming it into tracing_path__strerror_open_tp to fit into the namespace. No functional change is intended. Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org Signed-off-by: Jiri Olsa--- tools/lib/api/fs/debugfs.c | 52 --- tools/lib/api/fs/tracing_path.c | 54 + tools/lib/api/fs/tracing_path.h | 3 +++ tools/perf/builtin-trace.c | 5 ++-- 4 files changed, 60 insertions(+), 54 deletions(-) diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c index eb7cf4d18f8a..c707cfb32782 100644 --- a/tools/lib/api/fs/debugfs.c +++ b/tools/lib/api/fs/debugfs.c @@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint) out: return debugfs_mountpoint; } - -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename) -{ - char sbuf[128]; - - switch (err) { - case ENOENT: - if (debugfs_found) { - snprintf(buf, size, -"Error:\tFile %s/%s not found.\n" -"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", -debugfs_mountpoint, filename); - break; - } - snprintf(buf, size, "%s", -"Error:\tUnable to find debugfs\n" -"Hint:\tWas your kernel compiled with debugfs support?\n" -"Hint:\tIs the debugfs filesystem mounted?\n" -"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); - break; - case EACCES: { - const char *mountpoint = debugfs_mountpoint; - - if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { - const char *tracefs_mntpoint = tracefs_find_mountpoint(); - - if (tracefs_mntpoint) - mountpoint = tracefs_mntpoint; - } - - snprintf(buf, size, -"Error:\tNo permissions to read %s/%s\n" -"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", -debugfs_mountpoint, filename, mountpoint); - } - break; - default: - snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf))); - break; - } - - return 0; -} - -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name) -{ - char path[PATH_MAX]; - - snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); - - return debugfs__strerror_open(err, buf, size, path); -} diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 1fd6e1f99234..3b3e4f5fc50b 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "debugfs.h" #include "tracefs.h" @@ -81,3 +83,55 @@ void put_tracing_file(char *file) { free(file); } + +static int strerror_open(int err, char *buf, size_t size, const char *filename) +{ + char sbuf[128]; + + switch (err) { + case ENOENT: + if (debugfs_configured()) { + snprintf(buf, size, +"Error:\tFile %s/%s not found.\n" +"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", +debugfs_mountpoint, filename); + break; + } + snprintf(buf, size, "%s", +"Error:\tUnable to find debugfs\n" +"Hint:\tWas your kernel compiled with debugfs support?\n" +"Hint:\tIs the debugfs filesystem mounted?\n" +"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); + break; + case EACCES: { + const char *mountpoint = debugfs_mountpoint; + + if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { + const char *tracefs_mntpoint = tracefs_find_mountpoint(); + + if (tracefs_mntpoint) + mountpoint = tracefs_mntpoint; + } + + snprintf(buf, size, +"Error:\tNo permissions to read %s/%s\n" +"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", +debugfs_mountpoint, filename, mountpoint); + } + break; + default: +
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu: > Moving debugfs__strerror_open out of api/fs/debugfs.c, > because it's not debugfs specific. It'll be changed to > consider tracefs mount as well in following patches. > > Renaming it into tracing_path__strerror_open_tp to fit > into the namespace. No functional change is intended. Humm, here I think that "_path" may look excessive... But tracing_path__ better than debugfs__, so its progress, applying, if we get a better name, we can change this later. - Arnaldo > Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org > Signed-off-by: Jiri Olsa> --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) > > diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c > index eb7cf4d18f8a..c707cfb32782 100644 > --- a/tools/lib/api/fs/debugfs.c > +++ b/tools/lib/api/fs/debugfs.c > @@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint) > out: > return debugfs_mountpoint; > } > - > -int debugfs__strerror_open(int err, char *buf, size_t size, const char > *filename) > -{ > - char sbuf[128]; > - > - switch (err) { > - case ENOENT: > - if (debugfs_found) { > - snprintf(buf, size, > - "Error:\tFile %s/%s not found.\n" > - "Hint:\tPerhaps this kernel misses some > CONFIG_ setting to enable this feature?.\n", > - debugfs_mountpoint, filename); > - break; > - } > - snprintf(buf, size, "%s", > - "Error:\tUnable to find debugfs\n" > - "Hint:\tWas your kernel compiled with debugfs > support?\n" > - "Hint:\tIs the debugfs filesystem mounted?\n" > - "Hint:\tTry 'sudo mount -t debugfs nodev > /sys/kernel/debug'"); > - break; > - case EACCES: { > - const char *mountpoint = debugfs_mountpoint; > - > - if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, > "tracing/", 8) == 0) { > - const char *tracefs_mntpoint = > tracefs_find_mountpoint(); > - > - if (tracefs_mntpoint) > - mountpoint = tracefs_mntpoint; > - } > - > - snprintf(buf, size, > - "Error:\tNo permissions to read %s/%s\n" > - "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", > - debugfs_mountpoint, filename, mountpoint); > - } > - break; > - default: > - snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf))); > - break; > - } > - > - return 0; > -} > - > -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char > *sys, const char *name) > -{ > - char path[PATH_MAX]; > - > - snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); > - > - return debugfs__strerror_open(err, buf, size, path); > -} > diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c > index 1fd6e1f99234..3b3e4f5fc50b 100644 > --- a/tools/lib/api/fs/tracing_path.c > +++ b/tools/lib/api/fs/tracing_path.c > @@ -5,6 +5,8 @@ > #include > #include > #include > +#include > +#include > #include "debugfs.h" > #include "tracefs.h" > > @@ -81,3 +83,55 @@ void put_tracing_file(char *file) > { > free(file); > } > + > +static int strerror_open(int err, char *buf, size_t size, const char > *filename) > +{ > + char sbuf[128]; > + > + switch (err) { > + case ENOENT: > + if (debugfs_configured()) { > + snprintf(buf, size, > + "Error:\tFile %s/%s not found.\n" > + "Hint:\tPerhaps this kernel misses some > CONFIG_ setting to enable this feature?.\n", > + debugfs_mountpoint, filename); > + break; > + } > + snprintf(buf, size, "%s", > + "Error:\tUnable to find debugfs\n" > + "Hint:\tWas your kernel compiled with debugfs > support?\n" > + "Hint:\tIs the debugfs filesystem mounted?\n" > + "Hint:\tTry 'sudo mount -t debugfs nodev > /sys/kernel/debug'"); > + break; > + case EACCES: { > + const char *mountpoint = debugfs_mountpoint; > + > + if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, > "tracing/", 8) == 0) { > + const char *tracefs_mntpoint = > tracefs_find_mountpoint(); > + > + if