Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1217380 > unrolled thread
| Started by | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| First post | 2015-09-02 10:00 +0200 |
| Last post | 2015-09-08 16:40 +0200 |
| Articles | 20 on this page of 57 — 8 participants |
Back to article view | Back to linux.kernel
[PATCH 00/15] perf tools: Cleanup filesystem api Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 01/15] perf tools: Fix parse_events_add_pmu caller Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 01/15] perf tools: Fix parse_events_add_pmu caller Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:10 +0200
Re: [PATCH 01/15] perf tools: Fix parse_events_add_pmu caller Jiri Olsa <jolsa@redhat.com> - 2015-09-02 15:40 +0200
[tip:perf/urgent] perf tools: Fix parse_events_add_pmu caller tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-05 16:10 +0200
[PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:20 +0200
Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Jiri Olsa <jolsa@redhat.com> - 2015-09-02 15:50 +0200
Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 16:20 +0200
[tip:perf/core] tools lib api fs: Make tracing_path_strerror_open message generic tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-15 09:00 +0200
[PATCH 02/15] perf tools: Remove mountpoint arg from perf_debugfs_mount Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[tip:perf/core] perf tools: Remove mountpoint arg from perf_debugfs_mount tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
[PATCH 11/15] tools lib api: Add mount support for fs Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 16:20 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 16:30 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-04 16:30 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 17:00 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 17:10 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 17:20 +0200
[tip:perf/core] tools lib api fs: Add FSTYPE__mount() method tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
[PATCH 14/15] tools lib api: Remove debugfs, tracefs and findfs objects Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[tip:perf/core] tools lib api fs: Remove debugfs, tracefs and findfs objects tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-15 09:10 +0200
Re: [tip:perf/core] tools lib api fs: Remove debugfs, tracefs and findfs objects Vinson Lee <vlee@twopensource.com> - 2015-09-22 02:30 +0200
[PATCH 13/15] tools lib api: Replace debugfs/tracefs objects interface with fs.c Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[tip:perf/core] tools lib api fs: Replace debugfs/ tracefs objects interface with fs.c tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-15 09:00 +0200
[PATCH 08/15] tools lib api: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[tip:perf/core] tools lib api fs: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
[PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:40 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-02 15:50 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 16:20 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 19:00 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-04 09:10 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-04 18:50 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-04 19:50 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:50 +0200
[tip:perf/core] tools lib api fs: Add FSTYPE__configured() method tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
[PATCH 09/15] tools lib api: Add debugfs into fs.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[tip:perf/core] tools lib api fs: Add debugfs into fs.c object tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
[PATCH 10/15] tools lib api: Add tracefs into fs.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[tip:perf/core] tools lib api fs: Add tracefs into fs.c object tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
[PATCH 15/15] perf tools: Switch to tracing_path interface on appropriate places Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[tip:perf/core] perf tools: Switch to tracing_path interface on appropriate places tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-15 09:10 +0200
[PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c Matt Fleming <matt@codeblueprint.co.uk> - 2015-09-04 13:40 +0200
Re: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 15:30 +0200
[tip:perf/core] tools lib api fs: Move tracing_path interface into api/fs/tracing_path.c tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
[PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:10 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:20 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Matt Fleming <matt@codeblueprint.co.uk> - 2015-09-04 13:40 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Jiri Olsa <jolsa@redhat.com> - 2015-09-04 15:50 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 16:00 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 15:50 +0200
[tip:perf/core] tools lib api fs: Move debugfs__strerror_open into tracing_path.c object tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
Re: [PATCH 00/15] perf tools: Cleanup filesystem api Jiri Olsa <jolsa@redhat.com> - 2015-09-02 10:10 +0200
[PATCH 03/15] perf tools: Move tracing_path stuff under same namespace Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:10 +0200
[tip:perf/core] perf tools: Move tracing_path stuff under same namespace tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-08 16:40 +0200
Page 1 of 3 [1] 2 3 Next page →
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 00/15] perf tools: Cleanup filesystem api |
| Message-ID | <q4b7z-7ff-3@gated-at.bofh.it> |
hi,
this patchset moves all filesystem we use under
api/fs/fs.c framework and adds new tracing_path
object to get tracing area (path).
It unifies the way we use debugfs/tracefs paths
and removes some redundant code.
It's base for the tracepoint parsing error reporting
I posted recently.
jirka
---
Jiri Olsa (15):
perf tools: Fix parse_events_add_pmu caller
perf tools: Remove mountpoint arg from perf_debugfs_mount
perf tools: Move tracing_path stuff under same namespace
perf tools: Move tracing_path interface into api/fs/tracing_path.c
tools lib api: Move debugfs__strerror_open into tracing_path.c object
tools lib api: Make tracing_path_strerror_open message generic
tools lib api: Add STR and PATH_MAX macros to fs object
tools lib api: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c
tools lib api: Add debugfs into fs.c object
tools lib api: Add tracefs into fs.c object
tools lib api: Add mount support for fs
tools lib api: Add configured support for fs
tools lib api: Replace debugfs/tracefs objects interface with fs.c
tools lib api: Remove debugfs, tracefs and findfs objects
perf tools: Switch to tracing_path interface on appropriate places
tools/lib/api/fs/Build | 4 +--
tools/lib/api/fs/debugfs.c | 129 -----------------------------------------------------------------------------------
tools/lib/api/fs/debugfs.h | 23 ---------------
tools/lib/api/fs/findfs.c | 63 -----------------------------------------
tools/lib/api/fs/findfs.h | 23 ---------------
tools/lib/api/fs/fs.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
tools/lib/api/fs/fs.h | 26 ++++++++++++-----
tools/lib/api/fs/tracefs.c | 78 --------------------------------------------------
tools/lib/api/fs/tracefs.h | 21 --------------
tools/lib/api/fs/tracing_path.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/lib/api/fs/tracing_path.h | 16 +++++++++++
tools/perf/builtin-kvm.c | 1 -
tools/perf/builtin-probe.c | 1 -
tools/perf/builtin-trace.c | 5 ++--
tools/perf/perf.c | 12 ++++----
tools/perf/tests/openat-syscall-all-cpus.c | 10 +++----
tools/perf/tests/openat-syscall.c | 10 +++----
tools/perf/tests/parse-events.c | 19 ++-----------
tools/perf/util/evsel.c | 2 +-
tools/perf/util/parse-events.c | 2 +-
tools/perf/util/parse-events.y | 2 +-
tools/perf/util/probe-event.c | 5 ++--
tools/perf/util/probe-file.c | 15 ++--------
tools/perf/util/trace-event-info.c | 2 +-
tools/perf/util/trace-event.c | 1 +
tools/perf/util/util.c | 70 ---------------------------------------------
tools/perf/util/util.h | 9 +-----
27 files changed, 310 insertions(+), 493 deletions(-)
delete mode 100644 tools/lib/api/fs/debugfs.c
delete mode 100644 tools/lib/api/fs/debugfs.h
delete mode 100644 tools/lib/api/fs/findfs.c
delete mode 100644 tools/lib/api/fs/findfs.h
delete mode 100644 tools/lib/api/fs/tracefs.c
delete mode 100644 tools/lib/api/fs/tracefs.h
create mode 100644 tools/lib/api/fs/tracing_path.c
create mode 100644 tools/lib/api/fs/tracing_path.h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 01/15] perf tools: Fix parse_events_add_pmu caller |
| Message-ID | <q4b7z-7ff-7@gated-at.bofh.it> |
| In reply to | #1217380 |
Following commit changed parse_events_add_pmu interface: 36adec85a86f perf tools: Change parse_events_add_pmu interface but forgot to change one caller. Because of lessen compilation rules for the bison parser, the compiler did not warn on that. Link: http://lkml.kernel.org/n/tip-fda5a524tfapmpb85bmaigo2@git.kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- tools/perf/util/parse-events.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 591905a02b92..9cd70819c795 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -255,7 +255,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc list_add_tail(&term->list, head); ALLOC_LIST(list); - ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); + ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); parse_events__free_terms(head); $$ = list; } -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-09-02 15:10 +0200 |
| Subject | Re: [PATCH 01/15] perf tools: Fix parse_events_add_pmu caller |
| Message-ID | <q4fXA-5Wu-17@gated-at.bofh.it> |
| In reply to | #1217381 |
Em Wed, Sep 02, 2015 at 09:56:31AM +0200, Jiri Olsa escreveu: > Following commit changed parse_events_add_pmu interface: > 36adec85a86f perf tools: Change parse_events_add_pmu interface > > but forgot to change one caller. Because of lessen compilation > rules for the bison parser, the compiler did not warn on that. Humm, wonder what can be done to improve this situation... No ideas? Applying to perf/urgent, Thanks, - Arnaldo > Link: http://lkml.kernel.org/n/tip-fda5a524tfapmpb85bmaigo2@git.kernel.org > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- > tools/perf/util/parse-events.y | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y > index 591905a02b92..9cd70819c795 100644 > --- a/tools/perf/util/parse-events.y > +++ b/tools/perf/util/parse-events.y > @@ -255,7 +255,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc > list_add_tail(&term->list, head); > > ALLOC_LIST(list); > - ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); > + ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); > parse_events__free_terms(head); > $$ = list; > } > -- > 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-09-02 15:40 +0200 |
| Subject | Re: [PATCH 01/15] perf tools: Fix parse_events_add_pmu caller |
| Message-ID | <q4gqC-6uo-13@gated-at.bofh.it> |
| In reply to | #1217591 |
On Wed, Sep 02, 2015 at 10:00:53AM -0300, Arnaldo Carvalho de Melo wrote: > Em Wed, Sep 02, 2015 at 09:56:31AM +0200, Jiri Olsa escreveu: > > Following commit changed parse_events_add_pmu interface: > > 36adec85a86f perf tools: Change parse_events_add_pmu interface > > > > but forgot to change one caller. Because of lessen compilation > > rules for the bison parser, the compiler did not warn on that. > > Humm, wonder what can be done to improve this situation... No ideas? not really.. :-\ it's generated code, that will fail to compile or spit other loads of warnings if we enable them moving most of the code out of parse-event.y to other objects helps, but thats pretty much what we do now > > Applying to perf/urgent, thanks, jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Date | 2015-09-05 16:10 +0200 |
| Subject | [tip:perf/urgent] perf tools: Fix parse_events_add_pmu caller |
| Message-ID | <q5mki-2Hy-19@gated-at.bofh.it> |
| In reply to | #1217381 |
Commit-ID: 5ad4da4302712fba10624d28cb6c269fee592b69
Gitweb: http://git.kernel.org/tip/5ad4da4302712fba10624d28cb6c269fee592b69
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 2 Sep 2015 09:56:31 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 2 Sep 2015 09:58:57 -0300
perf tools: Fix parse_events_add_pmu caller
Following commit changed parse_events_add_pmu interface:
36adec85a86f perf tools: Change parse_events_add_pmu interface
but forgot to change one caller. Because of lessen compilation rules for
the bison parser, the compiler did not warn on that.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
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: Steven Rostedt <rostedt@goodmis.org>
Fixes: 36adec85a86f ("perf tools: Change parse_events_add_pmu interface")
Link: http://lkml.kernel.org/r/1441180605-24737-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/parse-events.y | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 591905a..9cd7081 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -255,7 +255,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
list_add_tail(&term->list, head);
ALLOC_LIST(list);
- ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head));
+ ABORT_ON(parse_events_add_pmu(data, list, "cpu", head));
parse_events__free_terms(head);
$$ = list;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic |
| Message-ID | <q4b7B-7ff-25@gated-at.bofh.it> |
| In reply to | #1217380 |
Making tracing_path__strerror_open_tp message generic by mentioning
both debugfs/tracefs words in error message plus the tracing_path
instead of debugfs_mountpoint.
Link: http://lkml.kernel.org/n/tip-5y7nboe2xe619hp649ry58z6@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/api/fs/tracing_path.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 3b3e4f5fc50b..b0ee3b3acef0 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -90,33 +90,33 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
switch (err) {
case ENOENT:
- if (debugfs_configured()) {
+ if (debugfs_configured() || tracefs_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);
+ tracing_events_path, 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"
+ "Error:\tUnable to find debugfs/tracefs\n"
+ "Hint:\tWas your kernel compiled with debugfs/tracefs support?\n"
+ "Hint:\tIs the debugfs/tracefs filesystem mounted?\n"
"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
break;
case EACCES: {
- const char *mountpoint = debugfs_mountpoint;
+ const char *mountpoint = debugfs_find_mountpoint();
- if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
+ if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
const char *tracefs_mntpoint = tracefs_find_mountpoint();
if (tracefs_mntpoint)
- mountpoint = tracefs_mntpoint;
+ mountpoint = tracefs_find_mountpoint();
}
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);
+ tracing_events_path, filename, mountpoint);
}
break;
default:
@@ -131,7 +131,7 @@ int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *
{
char path[PATH_MAX];
- snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
+ snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*");
return strerror_open(err, buf, size, path);
}
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-09-02 15:20 +0200 |
| Subject | Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic |
| Message-ID | <q4g7g-683-9@gated-at.bofh.it> |
| In reply to | #1217384 |
Em Wed, Sep 02, 2015 at 09:56:36AM +0200, Jiri Olsa escreveu:
> Making tracing_path__strerror_open_tp message generic by mentioning
What means "making message generic"? What is the current behaviour you
think is problematic. what is the new behaviour ad why do you think it
is better?
The test for ENOENT became confusing, i.e. since this was a test for
"tracefs", if debugfs_configured() returned true, i.e. debugfs _was_
found in the system, then, the message makes sense, even if probably
could be made better, i.e. isn't true that if CONFIG_DEBUGFS is
configured and furthermore, debugfs_configure() returns true, then it
should be something like CONFIG_TRACEFS that needs enabling?
I applied all patches before this one, BTW.
- Arnaldo
> both debugfs/tracefs words in error message plus the tracing_path
> instead of debugfs_mountpoint.
>
> Link: http://lkml.kernel.org/n/tip-5y7nboe2xe619hp649ry58z6@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/lib/api/fs/tracing_path.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> index 3b3e4f5fc50b..b0ee3b3acef0 100644
> --- a/tools/lib/api/fs/tracing_path.c
> +++ b/tools/lib/api/fs/tracing_path.c
> @@ -90,33 +90,33 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
>
> switch (err) {
> case ENOENT:
> - if (debugfs_configured()) {
> + if (debugfs_configured() || tracefs_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);
> + tracing_events_path, filename);
Humm
> 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"
> + "Error:\tUnable to find debugfs/tracefs\n"
> + "Hint:\tWas your kernel compiled with debugfs/tracefs support?\n"
> + "Hint:\tIs the debugfs/tracefs filesystem mounted?\n"
> "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
> break;
> case EACCES: {
> - const char *mountpoint = debugfs_mountpoint;
> + const char *mountpoint = debugfs_find_mountpoint();
>
> - if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
> + if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
> const char *tracefs_mntpoint = tracefs_find_mountpoint();
>
> if (tracefs_mntpoint)
> - mountpoint = tracefs_mntpoint;
> + mountpoint = tracefs_find_mountpoint();
> }
>
> 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);
> + tracing_events_path, filename, mountpoint);
> }
> break;
> default:
> @@ -131,7 +131,7 @@ int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *
> {
> char path[PATH_MAX];
>
> - snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
> + snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*");
>
> return strerror_open(err, buf, size, path);
> }
> --
> 2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-09-02 15:50 +0200 |
| Subject | Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic |
| Message-ID | <q4gAi-6FJ-3@gated-at.bofh.it> |
| In reply to | #1217595 |
On Wed, Sep 02, 2015 at 10:18:44AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 02, 2015 at 09:56:36AM +0200, Jiri Olsa escreveu:
> > Making tracing_path__strerror_open_tp message generic by mentioning
>
> What means "making message generic"? What is the current behaviour you
> think is problematic. what is the new behaviour ad why do you think it
> is better?
>
> The test for ENOENT became confusing, i.e. since this was a test for
> "tracefs", if debugfs_configured() returned true, i.e. debugfs _was_
> found in the system, then, the message makes sense, even if probably
> could be made better, i.e. isn't true that if CONFIG_DEBUGFS is
> configured and furthermore, debugfs_configure() returns true, then it
> should be something like CONFIG_TRACEFS that needs enabling?
>
> I applied all patches before this one, BTW.
>
> - Arnaldo
>
> > both debugfs/tracefs words in error message plus the tracing_path
> > instead of debugfs_mountpoint.
> >
> > Link: http://lkml.kernel.org/n/tip-5y7nboe2xe619hp649ry58z6@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/lib/api/fs/tracing_path.c | 20 ++++++++++----------
> > 1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> > index 3b3e4f5fc50b..b0ee3b3acef0 100644
> > --- a/tools/lib/api/fs/tracing_path.c
> > +++ b/tools/lib/api/fs/tracing_path.c
> > @@ -90,33 +90,33 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
> >
> > switch (err) {
> > case ENOENT:
> > - if (debugfs_configured()) {
> > + if (debugfs_configured() || tracefs_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);
> > + tracing_events_path, filename);
>
> Humm
we will get here if we can't find the tracepoint, but one of
debugfs or tracefs is configured, which means you probably
want some tracepoint which wasn't compiled in your kernel
before it did not take into account we could have tracefs configured
thats what other changes in here are about, to consider tracefs mount
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-09-02 16:20 +0200 |
| Subject | Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic |
| Message-ID | <q4h3j-7tc-9@gated-at.bofh.it> |
| In reply to | #1217610 |
Em Wed, Sep 02, 2015 at 03:44:50PM +0200, Jiri Olsa escreveu:
> On Wed, Sep 02, 2015 at 10:18:44AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Sep 02, 2015 at 09:56:36AM +0200, Jiri Olsa escreveu:
> > > Making tracing_path__strerror_open_tp message generic by mentioning
> >
> > What means "making message generic"? What is the current behaviour you
> > think is problematic. what is the new behaviour ad why do you think it
> > is better?
> >
> > The test for ENOENT became confusing, i.e. since this was a test for
> > "tracefs", if debugfs_configured() returned true, i.e. debugfs _was_
> > found in the system, then, the message makes sense, even if probably
> > could be made better, i.e. isn't true that if CONFIG_DEBUGFS is
> > configured and furthermore, debugfs_configure() returns true, then it
> > should be something like CONFIG_TRACEFS that needs enabling?
> >
> > I applied all patches before this one, BTW.
> >
> > - Arnaldo
> >
> > > both debugfs/tracefs words in error message plus the tracing_path
> > > instead of debugfs_mountpoint.
> > >
> > > Link: http://lkml.kernel.org/n/tip-5y7nboe2xe619hp649ry58z6@git.kernel.org
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > > ---
> > > tools/lib/api/fs/tracing_path.c | 20 ++++++++++----------
> > > 1 file changed, 10 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> > > index 3b3e4f5fc50b..b0ee3b3acef0 100644
> > > --- a/tools/lib/api/fs/tracing_path.c
> > > +++ b/tools/lib/api/fs/tracing_path.c
> > > @@ -90,33 +90,33 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
> > >
> > > switch (err) {
> > > case ENOENT:
> > > - if (debugfs_configured()) {
> > > + if (debugfs_configured() || tracefs_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);
> > > + tracing_events_path, filename);
> >
> > Humm
>
> we will get here if we can't find the tracepoint, but one of
> debugfs or tracefs is configured, which means you probably
> want some tracepoint which wasn't compiled in your kernel
>
> before it did not take into account we could have tracefs configured
> thats what other changes in here are about, to consider tracefs mount
Ok, that helps, will add the above as an comment.
Somehow I was seeing this as not finding the mountpoints :-\
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Date | 2015-09-15 09:00 +0200 |
| Subject | [tip:perf/core] tools lib api fs: Make tracing_path_strerror_open message generic |
| Message-ID | <q8SnF-5Cp-25@gated-at.bofh.it> |
| In reply to | #1217384 |
Commit-ID: 4f234f06d608635a1cff936131285a91af213b37
Gitweb: http://git.kernel.org/tip/4f234f06d608635a1cff936131285a91af213b37
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 2 Sep 2015 09:56:36 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 14 Sep 2015 12:50:14 -0300
tools lib api fs: Make tracing_path_strerror_open message generic
Making tracing_path__strerror_open_tp message generic by mentioning both
debugfs/tracefs words in error message plus the tracing_path instead of
debugfs_mountpoint.
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-7-git-send-email-jolsa@kernel.org
[ Add comment for the ENOENT case out of this patch discussion thread ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/api/fs/tracing_path.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 3b3e4f5..1e0bb0d 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)
switch (err) {
case ENOENT:
- if (debugfs_configured()) {
+ /*
+ * We will get here if we can't find the tracepoint, but one of
+ * debugfs or tracefs is configured, which means you probably
+ * want some tracepoint which wasn't compiled in your kernel.
+ * - jirka
+ */
+ if (debugfs_configured() || tracefs_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);
+ tracing_events_path, 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"
+ "Error:\tUnable to find debugfs/tracefs\n"
+ "Hint:\tWas your kernel compiled with debugfs/tracefs support?\n"
+ "Hint:\tIs the debugfs/tracefs filesystem mounted?\n"
"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
break;
case EACCES: {
- const char *mountpoint = debugfs_mountpoint;
+ const char *mountpoint = debugfs_find_mountpoint();
- if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
+ if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
const char *tracefs_mntpoint = tracefs_find_mountpoint();
if (tracefs_mntpoint)
- mountpoint = tracefs_mntpoint;
+ mountpoint = tracefs_find_mountpoint();
}
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);
+ tracing_events_path, filename, mountpoint);
}
break;
default:
@@ -131,7 +137,7 @@ int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *
{
char path[PATH_MAX];
- snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
+ snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*");
return strerror_open(err, buf, size, path);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 02/15] perf tools: Remove mountpoint arg from perf_debugfs_mount |
| Message-ID | <q4b7B-7ff-39@gated-at.bofh.it> |
| In reply to | #1217380 |
It's not used by any caller. We either detect the mountpoint
or use hardcoded one.
Link: http://lkml.kernel.org/n/tip-7bbr92o7gwv5bkpancqoypz3@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/perf.c | 2 +-
tools/perf/util/util.c | 14 +++++++-------
tools/perf/util/util.h | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 07dbff5c0e60..f500a4b40722 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -518,7 +518,7 @@ int main(int argc, const char **argv)
if (!cmd)
cmd = "perf-help";
/* get debugfs mount point from /proc/mounts */
- perf_debugfs_mount(NULL);
+ perf_debugfs_mount();
/*
* "perf-xxxx" is the same as "perf xxxx", but we obviously:
*
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 7acafb3c5592..74f71f8afcc2 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -398,11 +398,11 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
mountpoint, tracing, "events");
}
-static const char *__perf_tracefs_mount(const char *mountpoint)
+static const char *__perf_tracefs_mount(void)
{
const char *mnt;
- mnt = tracefs_mount(mountpoint);
+ mnt = tracefs_mount(NULL);
if (!mnt)
return NULL;
@@ -411,11 +411,11 @@ static const char *__perf_tracefs_mount(const char *mountpoint)
return mnt;
}
-static const char *__perf_debugfs_mount(const char *mountpoint)
+static const char *__perf_debugfs_mount(void)
{
const char *mnt;
- mnt = debugfs_mount(mountpoint);
+ mnt = debugfs_mount(NULL);
if (!mnt)
return NULL;
@@ -424,15 +424,15 @@ static const char *__perf_debugfs_mount(const char *mountpoint)
return mnt;
}
-const char *perf_debugfs_mount(const char *mountpoint)
+const char *perf_debugfs_mount(void)
{
const char *mnt;
- mnt = __perf_tracefs_mount(mountpoint);
+ mnt = __perf_tracefs_mount();
if (mnt)
return mnt;
- mnt = __perf_debugfs_mount(mountpoint);
+ mnt = __perf_debugfs_mount();
return mnt;
}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 291be1d84bc3..184d40048faa 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -86,7 +86,7 @@ extern char buildid_dir[];
extern char tracing_path[];
extern char tracing_events_path[];
extern void perf_debugfs_set_path(const char *mountpoint);
-const char *perf_debugfs_mount(const char *mountpoint);
+const char *perf_debugfs_mount(void);
char *get_tracing_file(const char *name);
void put_tracing_file(char *file);
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Date | 2015-09-08 16:40 +0200 |
| Subject | [tip:perf/core] perf tools: Remove mountpoint arg from perf_debugfs_mount |
| Message-ID | <q6sdY-71F-15@gated-at.bofh.it> |
| In reply to | #1217385 |
Commit-ID: f6a09af7de3b39b1e4fcff7374871f834498b7f0
Gitweb: http://git.kernel.org/tip/f6a09af7de3b39b1e4fcff7374871f834498b7f0
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 2 Sep 2015 09:56:32 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 2 Sep 2015 16:30:47 -0300
perf tools: Remove mountpoint arg from perf_debugfs_mount
It's not used by any caller. We either detect the mountpoint or use
hardcoded one.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
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: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/perf.c | 2 +-
tools/perf/util/util.c | 14 +++++++-------
tools/perf/util/util.h | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 07dbff5..f500a4b 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -518,7 +518,7 @@ int main(int argc, const char **argv)
if (!cmd)
cmd = "perf-help";
/* get debugfs mount point from /proc/mounts */
- perf_debugfs_mount(NULL);
+ perf_debugfs_mount();
/*
* "perf-xxxx" is the same as "perf xxxx", but we obviously:
*
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 7acafb3..74f71f8 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -398,11 +398,11 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
mountpoint, tracing, "events");
}
-static const char *__perf_tracefs_mount(const char *mountpoint)
+static const char *__perf_tracefs_mount(void)
{
const char *mnt;
- mnt = tracefs_mount(mountpoint);
+ mnt = tracefs_mount(NULL);
if (!mnt)
return NULL;
@@ -411,11 +411,11 @@ static const char *__perf_tracefs_mount(const char *mountpoint)
return mnt;
}
-static const char *__perf_debugfs_mount(const char *mountpoint)
+static const char *__perf_debugfs_mount(void)
{
const char *mnt;
- mnt = debugfs_mount(mountpoint);
+ mnt = debugfs_mount(NULL);
if (!mnt)
return NULL;
@@ -424,15 +424,15 @@ static const char *__perf_debugfs_mount(const char *mountpoint)
return mnt;
}
-const char *perf_debugfs_mount(const char *mountpoint)
+const char *perf_debugfs_mount(void)
{
const char *mnt;
- mnt = __perf_tracefs_mount(mountpoint);
+ mnt = __perf_tracefs_mount();
if (mnt)
return mnt;
- mnt = __perf_debugfs_mount(mountpoint);
+ mnt = __perf_debugfs_mount();
return mnt;
}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 09c1a8b..48ec232 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -86,7 +86,7 @@ extern char buildid_dir[];
extern char tracing_path[];
extern char tracing_events_path[];
extern void perf_debugfs_set_path(const char *mountpoint);
-const char *perf_debugfs_mount(const char *mountpoint);
+const char *perf_debugfs_mount(void);
char *get_tracing_file(const char *name);
void put_tracing_file(char *file);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 11/15] tools lib api: Add mount support for fs |
| Message-ID | <q4b7B-7ff-29@gated-at.bofh.it> |
| In reply to | #1217380 |
Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
interface that tries to mount the filesystem in case no mount is found.
Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk26lm@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++-----
tools/lib/api/fs/fs.h | 15 +++++++++++----
2 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ef16d2a83a27..bc93baf33fff 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -9,6 +9,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <sys/mount.h>
#include "debugfs.h"
#include "fs.h"
@@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)
return fs__get_mountpoint(fs);
}
-#define FS__MOUNTPOINT(name, idx) \
+static const char *mount_overload(struct fs *fs)
+{
+ size_t name_len = strlen(fs->name);
+ /* "PERF_" + name + "_ENVIRONMENT" + '\0' */
+ char upper_name[5 + name_len + 12 + 1];
+
+ snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name);
+ mem_toupper(upper_name, name_len);
+
+ return getenv(upper_name) ?: *fs->mounts;
+}
+
+static const char *fs__mount(int idx)
+{
+ struct fs *fs = &fs__entries[idx];
+ const char *mountpoint;
+
+ if (fs__mountpoint(idx))
+ return (const char *)fs->path;
+
+ mountpoint = mount_overload(fs);
+
+ if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0)
+ return NULL;
+
+ return fs__check_mounts(fs) ? fs->path : NULL;
+}
+
+#define FS(name, idx) \
const char *name##__mountpoint(void) \
{ \
return fs__mountpoint(idx); \
+} \
+ \
+const char *name##__mount(void) \
+{ \
+ return fs__mount(idx); \
}
-FS__MOUNTPOINT(sysfs, FS__SYSFS);
-FS__MOUNTPOINT(procfs, FS__PROCFS);
-FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
-FS__MOUNTPOINT(tracefs, FS__TRACEFS);
+FS(sysfs, FS__SYSFS);
+FS(procfs, FS__PROCFS);
+FS(debugfs, FS__DEBUGFS);
+FS(tracefs, FS__TRACEFS);
int filename__read_int(const char *filename, int *value)
{
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 9013227ae0d1..a9627ea5e6ae 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -9,10 +9,17 @@
#define PATH_MAX 4096
#endif
-const char *sysfs__mountpoint(void);
-const char *procfs__mountpoint(void);
-const char *debugfs__mountpoint(void);
-const char *tracefs__mountpoint(void);
+#define FS(name) \
+ const char *name##__mountpoint(void); \
+ const char *name##__mount(void);
+
+FS(sysfs)
+FS(procfs)
+FS(debugfs)
+FS(tracefs)
+
+#undef FS
+
int filename__read_int(const char *filename, int *value);
int sysctl__read_int(const char *sysctl, int *value);
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Raphaël Beamonte <raphael.beamonte@gmail.com> |
|---|---|
| Date | 2015-09-04 16:20 +0200 |
| Subject | Re: [PATCH 11/15] tools lib api: Add mount support for fs |
| Message-ID | <q500q-4vH-9@gated-at.bofh.it> |
| In reply to | #1217386 |
2015-09-02 3:56 GMT-04:00 Jiri Olsa <jolsa@kernel.org>:
> Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> interface that tries to mount the filesystem in case no mount is found.
>
> Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk26lm@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++-----
> tools/lib/api/fs/fs.h | 15 +++++++++++----
> 2 files changed, 50 insertions(+), 9 deletions(-)
Why automatic mounting the **fs filesystems?
Isn't it better to let the user decide when and where to mount it if
s/he forgot to do it before? Forcing a mount is also potentially
forcing to umount then mount when mounting has been forgotten before.
> diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
> index ef16d2a83a27..bc93baf33fff 100644
> --- a/tools/lib/api/fs/fs.c
> +++ b/tools/lib/api/fs/fs.c
> @@ -9,6 +9,7 @@
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <unistd.h>
> +#include <sys/mount.h>
>
> #include "debugfs.h"
> #include "fs.h"
> @@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)
> return fs__get_mountpoint(fs);
> }
>
> -#define FS__MOUNTPOINT(name, idx) \
> +static const char *mount_overload(struct fs *fs)
> +{
> + size_t name_len = strlen(fs->name);
> + /* "PERF_" + name + "_ENVIRONMENT" + '\0' */
> + char upper_name[5 + name_len + 12 + 1];
> +
> + snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name);
> + mem_toupper(upper_name, name_len);
> +
> + return getenv(upper_name) ?: *fs->mounts;
> +}
> +
> +static const char *fs__mount(int idx)
> +{
> + struct fs *fs = &fs__entries[idx];
> + const char *mountpoint;
> +
> + if (fs__mountpoint(idx))
> + return (const char *)fs->path;
> +
> + mountpoint = mount_overload(fs);
> +
> + if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0)
> + return NULL;
> +
> + return fs__check_mounts(fs) ? fs->path : NULL;
> +}
> +
> +#define FS(name, idx) \
> const char *name##__mountpoint(void) \
> { \
> return fs__mountpoint(idx); \
> +} \
> + \
> +const char *name##__mount(void) \
> +{ \
> + return fs__mount(idx); \
> }
>
> -FS__MOUNTPOINT(sysfs, FS__SYSFS);
> -FS__MOUNTPOINT(procfs, FS__PROCFS);
> -FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
> -FS__MOUNTPOINT(tracefs, FS__TRACEFS);
> +FS(sysfs, FS__SYSFS);
> +FS(procfs, FS__PROCFS);
> +FS(debugfs, FS__DEBUGFS);
> +FS(tracefs, FS__TRACEFS);
>
> int filename__read_int(const char *filename, int *value)
> {
> diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
> index 9013227ae0d1..a9627ea5e6ae 100644
> --- a/tools/lib/api/fs/fs.h
> +++ b/tools/lib/api/fs/fs.h
> @@ -9,10 +9,17 @@
> #define PATH_MAX 4096
> #endif
>
> -const char *sysfs__mountpoint(void);
> -const char *procfs__mountpoint(void);
> -const char *debugfs__mountpoint(void);
> -const char *tracefs__mountpoint(void);
> +#define FS(name) \
> + const char *name##__mountpoint(void); \
> + const char *name##__mount(void);
> +
> +FS(sysfs)
> +FS(procfs)
> +FS(debugfs)
> +FS(tracefs)
> +
> +#undef FS
> +
>
> int filename__read_int(const char *filename, int *value);
> int sysctl__read_int(const char *sysctl, int *value);
> --
> 2.4.3
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2015-09-04 16:30 +0200 |
| Subject | Re: [PATCH 11/15] tools lib api: Add mount support for fs |
| Message-ID | <q50a6-4GT-7@gated-at.bofh.it> |
| In reply to | #1219083 |
On Fri, 4 Sep 2015 10:14:28 -0400 Raphaël Beamonte <raphael.beamonte@gmail.com> wrote: > 2015-09-02 3:56 GMT-04:00 Jiri Olsa <jolsa@kernel.org>: > > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs) > > interface that tries to mount the filesystem in case no mount is found. > > > > Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk26lm@git.kernel.org > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > --- > > tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++----- > > tools/lib/api/fs/fs.h | 15 +++++++++++---- > > 2 files changed, 50 insertions(+), 9 deletions(-) > > Why automatic mounting the **fs filesystems? > Isn't it better to let the user decide when and where to mount it if > s/he forgot to do it before? Forcing a mount is also potentially > forcing to umount then mount when mounting has been forgotten before. > tracefs and debugfs have known locations to be mounted at. That's why the kernel supplies it (/sys/kernel/debug and /sys/kernel/trace). Why should we bother the user with this? trace-cmd does the same thing. It automatically mounts the filesystems if they are not mounted. Would you rather have the tool fail and say "please mount the trace or debugfs file system"? Even if it asked before doing so, that would become rather annoying. Running perf and trace-cmd should just work, and not expect the user to do more work than can be easily done by the tool. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-09-04 16:30 +0200 |
| Subject | Re: [PATCH 11/15] tools lib api: Add mount support for fs |
| Message-ID | <q50a6-4GT-17@gated-at.bofh.it> |
| In reply to | #1219083 |
On Fri, Sep 04, 2015 at 10:14:28AM -0400, Raphaël Beamonte wrote:
> 2015-09-02 3:56 GMT-04:00 Jiri Olsa <jolsa@kernel.org>:
> > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> > interface that tries to mount the filesystem in case no mount is found.
> >
> > Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk26lm@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++-----
> > tools/lib/api/fs/fs.h | 15 +++++++++++----
> > 2 files changed, 50 insertions(+), 9 deletions(-)
>
> Why automatic mounting the **fs filesystems?
> Isn't it better to let the user decide when and where to mount it if
> s/he forgot to do it before? Forcing a mount is also potentially
> forcing to umount then mount when mounting has been forgotten before.
well, I guess at some point we decided this was a good idea
to make perf more user friendly
AFAICS we do this only for debugfs and tracefs.. procfs
and sysfs are mounted most of the time anyway
we could track and unmount on exit, but I'd say let's have
someone complaining about it first ;-)
jirka
>
>
> > diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
> > index ef16d2a83a27..bc93baf33fff 100644
> > --- a/tools/lib/api/fs/fs.c
> > +++ b/tools/lib/api/fs/fs.c
> > @@ -9,6 +9,7 @@
> > #include <sys/stat.h>
> > #include <fcntl.h>
> > #include <unistd.h>
> > +#include <sys/mount.h>
> >
> > #include "debugfs.h"
> > #include "fs.h"
> > @@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)
> > return fs__get_mountpoint(fs);
> > }
> >
> > -#define FS__MOUNTPOINT(name, idx) \
> > +static const char *mount_overload(struct fs *fs)
> > +{
> > + size_t name_len = strlen(fs->name);
> > + /* "PERF_" + name + "_ENVIRONMENT" + '\0' */
> > + char upper_name[5 + name_len + 12 + 1];
> > +
> > + snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name);
> > + mem_toupper(upper_name, name_len);
> > +
> > + return getenv(upper_name) ?: *fs->mounts;
> > +}
> > +
> > +static const char *fs__mount(int idx)
> > +{
> > + struct fs *fs = &fs__entries[idx];
> > + const char *mountpoint;
> > +
> > + if (fs__mountpoint(idx))
> > + return (const char *)fs->path;
> > +
> > + mountpoint = mount_overload(fs);
> > +
> > + if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0)
> > + return NULL;
> > +
> > + return fs__check_mounts(fs) ? fs->path : NULL;
> > +}
> > +
> > +#define FS(name, idx) \
> > const char *name##__mountpoint(void) \
> > { \
> > return fs__mountpoint(idx); \
> > +} \
> > + \
> > +const char *name##__mount(void) \
> > +{ \
> > + return fs__mount(idx); \
> > }
> >
> > -FS__MOUNTPOINT(sysfs, FS__SYSFS);
> > -FS__MOUNTPOINT(procfs, FS__PROCFS);
> > -FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
> > -FS__MOUNTPOINT(tracefs, FS__TRACEFS);
> > +FS(sysfs, FS__SYSFS);
> > +FS(procfs, FS__PROCFS);
> > +FS(debugfs, FS__DEBUGFS);
> > +FS(tracefs, FS__TRACEFS);
> >
> > int filename__read_int(const char *filename, int *value)
> > {
> > diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
> > index 9013227ae0d1..a9627ea5e6ae 100644
> > --- a/tools/lib/api/fs/fs.h
> > +++ b/tools/lib/api/fs/fs.h
> > @@ -9,10 +9,17 @@
> > #define PATH_MAX 4096
> > #endif
> >
> > -const char *sysfs__mountpoint(void);
> > -const char *procfs__mountpoint(void);
> > -const char *debugfs__mountpoint(void);
> > -const char *tracefs__mountpoint(void);
> > +#define FS(name) \
> > + const char *name##__mountpoint(void); \
> > + const char *name##__mount(void);
> > +
> > +FS(sysfs)
> > +FS(procfs)
> > +FS(debugfs)
> > +FS(tracefs)
> > +
> > +#undef FS
> > +
> >
> > int filename__read_int(const char *filename, int *value);
> > int sysctl__read_int(const char *sysctl, int *value);
> > --
> > 2.4.3
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2015-09-04 17:00 +0200 |
| Subject | Re: [PATCH 11/15] tools lib api: Add mount support for fs |
| Message-ID | <q50D8-5eQ-7@gated-at.bofh.it> |
| In reply to | #1219090 |
On Fri, 4 Sep 2015 16:26:31 +0200 Jiri Olsa <jolsa@redhat.com> wrote: > On Fri, Sep 04, 2015 at 10:14:28AM -0400, Raphaël Beamonte wrote: > > 2015-09-02 3:56 GMT-04:00 Jiri Olsa <jolsa@kernel.org>: > > > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs) > > > interface that tries to mount the filesystem in case no mount is found. > > > > > > Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk26lm@git.kernel.org > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > > --- > > > tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++----- > > > tools/lib/api/fs/fs.h | 15 +++++++++++---- > > > 2 files changed, 50 insertions(+), 9 deletions(-) > > > > Why automatic mounting the **fs filesystems? > > Isn't it better to let the user decide when and where to mount it if > > s/he forgot to do it before? Forcing a mount is also potentially > > forcing to umount then mount when mounting has been forgotten before. > > well, I guess at some point we decided this was a good idea > to make perf more user friendly > > AFAICS we do this only for debugfs and tracefs.. procfs > and sysfs are mounted most of the time anyway Note, if sysfs isn't already mounted, than nothing will get mounted by perf. As sysfs is a requirement to get to /sys/kernel/trace and debug. > > we could track and unmount on exit, but I'd say let's have > someone complaining about it first ;-) > Agreed. Although, I use perf/trace-cmd to mount that directory for me :-) -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2015-09-04 17:10 +0200 |
| Subject | Re: [PATCH 11/15] tools lib api: Add mount support for fs |
| Message-ID | <q50MO-5FD-21@gated-at.bofh.it> |
| In reply to | #1219100 |
On Fri, 4 Sep 2015 10:57:00 -0400 Steven Rostedt <rostedt@goodmis.org> wrote: > > AFAICS we do this only for debugfs and tracefs.. procfs > > and sysfs are mounted most of the time anyway > > Note, if sysfs isn't already mounted, than nothing will get mounted by > perf. As sysfs is a requirement to get to /sys/kernel/trace and debug. I will also add that the reason the /sys/kernel/debug directory is created when DEBUGFS is enabled, was specifically so that tools had a place to automatically mount it when needed. That was the entire purpose of that directory. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Raphaël Beamonte <raphael.beamonte@gmail.com> |
|---|---|
| Date | 2015-09-04 17:20 +0200 |
| Subject | Re: [PATCH 11/15] tools lib api: Add mount support for fs |
| Message-ID | <q50Wu-5QK-15@gated-at.bofh.it> |
| In reply to | #1219104 |
2015-09-04 11:00 GMT-04:00 Steven Rostedt <rostedt@goodmis.org>: > I will also add that the reason the /sys/kernel/debug directory is > created when DEBUGFS is enabled, was specifically so that tools had a > place to automatically mount it when needed. That was the entire > purpose of that directory. Makes sense! It's also true that, as you both mentioned, it makes perf more user friendly. I wasn't sure to what extent that was the purpose though! Thanks for the clarifications! 2015-09-02 3:56 GMT-04:00 Jiri Olsa <jolsa@kernel.org>: > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs) > interface that tries to mount the filesystem in case no mount is found. > > Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk26lm@git.kernel.org > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- > tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++----- > tools/lib/api/fs/fs.h | 15 +++++++++++---- > 2 files changed, 50 insertions(+), 9 deletions(-) The patch is fine by me! My Reviewed-by can be added if wanted :o) Reviewed-by: Raphaël Beamonte <raphael.beamonte@gmail.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Date | 2015-09-08 16:40 +0200 |
| Subject | [tip:perf/core] tools lib api fs: Add FSTYPE__mount() method |
| Message-ID | <q6se1-71F-97@gated-at.bofh.it> |
| In reply to | #1217386 |
Commit-ID: 73ca85ad364769ffa312b1d892816d8fa23a02bf
Gitweb: http://git.kernel.org/tip/73ca85ad364769ffa312b1d892816d8fa23a02bf
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 2 Sep 2015 09:56:41 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 4 Sep 2015 12:01:00 -0300
tools lib api fs: Add FSTYPE__mount() method
Adding FSTYPE__mount (where FSTYPE is, as of now, one of sysfs, procfs,
debugfs, tracefs) method that tries to mount the filesystem in case no
mount of FSTYPE is found.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
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: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-12-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++-----
tools/lib/api/fs/fs.h | 15 +++++++++++----
2 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ef16d2a..bc93baf 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -9,6 +9,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <sys/mount.h>
#include "debugfs.h"
#include "fs.h"
@@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)
return fs__get_mountpoint(fs);
}
-#define FS__MOUNTPOINT(name, idx) \
+static const char *mount_overload(struct fs *fs)
+{
+ size_t name_len = strlen(fs->name);
+ /* "PERF_" + name + "_ENVIRONMENT" + '\0' */
+ char upper_name[5 + name_len + 12 + 1];
+
+ snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name);
+ mem_toupper(upper_name, name_len);
+
+ return getenv(upper_name) ?: *fs->mounts;
+}
+
+static const char *fs__mount(int idx)
+{
+ struct fs *fs = &fs__entries[idx];
+ const char *mountpoint;
+
+ if (fs__mountpoint(idx))
+ return (const char *)fs->path;
+
+ mountpoint = mount_overload(fs);
+
+ if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0)
+ return NULL;
+
+ return fs__check_mounts(fs) ? fs->path : NULL;
+}
+
+#define FS(name, idx) \
const char *name##__mountpoint(void) \
{ \
return fs__mountpoint(idx); \
+} \
+ \
+const char *name##__mount(void) \
+{ \
+ return fs__mount(idx); \
}
-FS__MOUNTPOINT(sysfs, FS__SYSFS);
-FS__MOUNTPOINT(procfs, FS__PROCFS);
-FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
-FS__MOUNTPOINT(tracefs, FS__TRACEFS);
+FS(sysfs, FS__SYSFS);
+FS(procfs, FS__PROCFS);
+FS(debugfs, FS__DEBUGFS);
+FS(tracefs, FS__TRACEFS);
int filename__read_int(const char *filename, int *value)
{
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 9013227..a9627ea 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -9,10 +9,17 @@
#define PATH_MAX 4096
#endif
-const char *sysfs__mountpoint(void);
-const char *procfs__mountpoint(void);
-const char *debugfs__mountpoint(void);
-const char *tracefs__mountpoint(void);
+#define FS(name) \
+ const char *name##__mountpoint(void); \
+ const char *name##__mount(void);
+
+FS(sysfs)
+FS(procfs)
+FS(debugfs)
+FS(tracefs)
+
+#undef FS
+
int filename__read_int(const char *filename, int *value);
int sysctl__read_int(const char *sysctl, int *value);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web