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-02 10:10 +0200 |
| Articles | 20 on this page of 43 — 7 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
[PATCH 02/15] perf tools: Remove mountpoint arg from perf_debugfs_mount Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +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
[PATCH 14/15] tools lib api: Remove debugfs, tracefs and findfs objects Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +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
[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
[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
[PATCH 09/15] tools lib api: Add debugfs into fs.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 10/15] tools lib api: Add tracefs into fs.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +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
[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
[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
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
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 | 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 | 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 | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 14/15] tools lib api: Remove debugfs, tracefs and findfs objects |
| Message-ID | <q4b7B-7ff-35@gated-at.bofh.it> |
| In reply to | #1217380 |
We have all the functionality in fs.c, let's remove unneeded
objects.
Link: http://lkml.kernel.org/n/tip-4ylqs27bec3m6ofefqo0eek4@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/api/fs/Build | 3 --
tools/lib/api/fs/debugfs.c | 77 ---------------------------------------------
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/tracefs.c | 78 ----------------------------------------------
tools/lib/api/fs/tracefs.h | 21 -------------
7 files changed, 288 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
diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index fa726f679b29..f4ed9629ae85 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,5 +1,2 @@
libapi-y += fs.o
libapi-y += tracing_path.o
-libapi-y += debugfs.o
-libapi-y += findfs.o
-libapi-y += tracefs.o
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
deleted file mode 100644
index c707cfb32782..000000000000
--- a/tools/lib/api/fs/debugfs.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#define _GNU_SOURCE
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <linux/kernel.h>
-
-#include "debugfs.h"
-#include "tracefs.h"
-
-#ifndef DEBUGFS_DEFAULT_PATH
-#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
-#endif
-
-char debugfs_mountpoint[PATH_MAX + 1] = DEBUGFS_DEFAULT_PATH;
-
-static const char * const debugfs_known_mountpoints[] = {
- DEBUGFS_DEFAULT_PATH,
- "/debug",
- 0,
-};
-
-static bool debugfs_found;
-
-bool debugfs_configured(void)
-{
- return debugfs_find_mountpoint() != NULL;
-}
-
-/* find the path to the mounted debugfs */
-const char *debugfs_find_mountpoint(void)
-{
- const char *ret;
-
- if (debugfs_found)
- return (const char *)debugfs_mountpoint;
-
- ret = find_mountpoint("debugfs", (long) DEBUGFS_MAGIC,
- debugfs_mountpoint, PATH_MAX + 1,
- debugfs_known_mountpoints);
- if (ret)
- debugfs_found = true;
-
- return ret;
-}
-
-/* mount the debugfs somewhere if it's not mounted */
-char *debugfs_mount(const char *mountpoint)
-{
- /* see if it's already mounted */
- if (debugfs_find_mountpoint())
- goto out;
-
- /* if not mounted and no argument */
- if (mountpoint == NULL) {
- /* see if environment variable set */
- mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT);
- /* if no environment variable, use default */
- if (mountpoint == NULL)
- mountpoint = DEBUGFS_DEFAULT_PATH;
- }
-
- if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
- return NULL;
-
- /* save the mountpoint */
- debugfs_found = true;
- strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
-out:
- return debugfs_mountpoint;
-}
diff --git a/tools/lib/api/fs/debugfs.h b/tools/lib/api/fs/debugfs.h
deleted file mode 100644
index 455023698d2b..000000000000
--- a/tools/lib/api/fs/debugfs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __API_DEBUGFS_H__
-#define __API_DEBUGFS_H__
-
-#include "findfs.h"
-
-#ifndef DEBUGFS_MAGIC
-#define DEBUGFS_MAGIC 0x64626720
-#endif
-
-#ifndef PERF_DEBUGFS_ENVIRONMENT
-#define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR"
-#endif
-
-bool debugfs_configured(void);
-const char *debugfs_find_mountpoint(void);
-char *debugfs_mount(const char *mountpoint);
-
-extern char debugfs_mountpoint[];
-
-int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
-
-#endif /* __API_DEBUGFS_H__ */
diff --git a/tools/lib/api/fs/findfs.c b/tools/lib/api/fs/findfs.c
deleted file mode 100644
index 49946cb6d7af..000000000000
--- a/tools/lib/api/fs/findfs.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-
-#include "findfs.h"
-
-/* verify that a mountpoint is actually the type we want */
-
-int valid_mountpoint(const char *mount, long magic)
-{
- struct statfs st_fs;
-
- if (statfs(mount, &st_fs) < 0)
- return -ENOENT;
- else if ((long)st_fs.f_type != magic)
- return -ENOENT;
-
- return 0;
-}
-
-/* find the path to a mounted file system */
-const char *find_mountpoint(const char *fstype, long magic,
- char *mountpoint, int len,
- const char * const *known_mountpoints)
-{
- const char * const *ptr;
- char format[128];
- char type[100];
- FILE *fp;
-
- if (known_mountpoints) {
- ptr = known_mountpoints;
- while (*ptr) {
- if (valid_mountpoint(*ptr, magic) == 0) {
- strncpy(mountpoint, *ptr, len - 1);
- mountpoint[len-1] = 0;
- return mountpoint;
- }
- ptr++;
- }
- }
-
- /* give up and parse /proc/mounts */
- fp = fopen("/proc/mounts", "r");
- if (fp == NULL)
- return NULL;
-
- snprintf(format, 128, "%%*s %%%ds %%99s %%*s %%*d %%*d\n", len);
-
- while (fscanf(fp, format, mountpoint, type) == 2) {
- if (strcmp(type, fstype) == 0)
- break;
- }
- fclose(fp);
-
- if (strcmp(type, fstype) != 0)
- return NULL;
-
- return mountpoint;
-}
diff --git a/tools/lib/api/fs/findfs.h b/tools/lib/api/fs/findfs.h
deleted file mode 100644
index b6f5d05acc42..000000000000
--- a/tools/lib/api/fs/findfs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __API_FINDFS_H__
-#define __API_FINDFS_H__
-
-#include <stdbool.h>
-
-#define _STR(x) #x
-#define STR(x) _STR(x)
-
-/*
- * On most systems <limits.h> would have given us this, but not on some systems
- * (e.g. GNU/Hurd).
- */
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-const char *find_mountpoint(const char *fstype, long magic,
- char *mountpoint, int len,
- const char * const *known_mountpoints);
-
-int valid_mountpoint(const char *mount, long magic);
-
-#endif /* __API_FINDFS_H__ */
diff --git a/tools/lib/api/fs/tracefs.c b/tools/lib/api/fs/tracefs.c
deleted file mode 100644
index e4aa9688b71e..000000000000
--- a/tools/lib/api/fs/tracefs.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <linux/kernel.h>
-
-#include "tracefs.h"
-
-#ifndef TRACEFS_DEFAULT_PATH
-#define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing"
-#endif
-
-char tracefs_mountpoint[PATH_MAX + 1] = TRACEFS_DEFAULT_PATH;
-
-static const char * const tracefs_known_mountpoints[] = {
- TRACEFS_DEFAULT_PATH,
- "/sys/kernel/debug/tracing",
- "/tracing",
- "/trace",
- 0,
-};
-
-static bool tracefs_found;
-
-bool tracefs_configured(void)
-{
- return tracefs_find_mountpoint() != NULL;
-}
-
-/* find the path to the mounted tracefs */
-const char *tracefs_find_mountpoint(void)
-{
- const char *ret;
-
- if (tracefs_found)
- return (const char *)tracefs_mountpoint;
-
- ret = find_mountpoint("tracefs", (long) TRACEFS_MAGIC,
- tracefs_mountpoint, PATH_MAX + 1,
- tracefs_known_mountpoints);
-
- if (ret)
- tracefs_found = true;
-
- return ret;
-}
-
-/* mount the tracefs somewhere if it's not mounted */
-char *tracefs_mount(const char *mountpoint)
-{
- /* see if it's already mounted */
- if (tracefs_find_mountpoint())
- goto out;
-
- /* if not mounted and no argument */
- if (mountpoint == NULL) {
- /* see if environment variable set */
- mountpoint = getenv(PERF_TRACEFS_ENVIRONMENT);
- /* if no environment variable, use default */
- if (mountpoint == NULL)
- mountpoint = TRACEFS_DEFAULT_PATH;
- }
-
- if (mount(NULL, mountpoint, "tracefs", 0, NULL) < 0)
- return NULL;
-
- /* save the mountpoint */
- tracefs_found = true;
- strncpy(tracefs_mountpoint, mountpoint, sizeof(tracefs_mountpoint));
-out:
- return tracefs_mountpoint;
-}
diff --git a/tools/lib/api/fs/tracefs.h b/tools/lib/api/fs/tracefs.h
deleted file mode 100644
index da780ac49acb..000000000000
--- a/tools/lib/api/fs/tracefs.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __API_TRACEFS_H__
-#define __API_TRACEFS_H__
-
-#include "findfs.h"
-
-#ifndef TRACEFS_MAGIC
-#define TRACEFS_MAGIC 0x74726163
-#endif
-
-#ifndef PERF_TRACEFS_ENVIRONMENT
-#define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR"
-#endif
-
-bool tracefs_configured(void);
-const char *tracefs_find_mountpoint(void);
-int tracefs_valid_mountpoint(const char *debugfs);
-char *tracefs_mount(const char *mountpoint);
-
-extern char tracefs_mountpoint[];
-
-#endif /* __API_DEBUGFS_H__ */
--
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@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 13/15] tools lib api: Replace debugfs/tracefs objects interface with fs.c |
| Message-ID | <q4b7B-7ff-37@gated-at.bofh.it> |
| In reply to | #1217380 |
Switching to the fs.c related filesystem framework.
Link: http://lkml.kernel.org/n/tip-csvlq2hr43ys3u7nfs2up9y9@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/api/fs/fs.c | 1 -
tools/lib/api/fs/tracing_path.c | 15 +++++++--------
tools/perf/builtin-kvm.c | 1 -
tools/perf/builtin-probe.c | 1 -
tools/perf/tests/openat-syscall-all-cpus.c | 5 +++--
tools/perf/tests/openat-syscall.c | 5 +++--
tools/perf/tests/parse-events.c | 7 +++----
tools/perf/util/evsel.c | 2 +-
tools/perf/util/probe-event.c | 5 ++---
tools/perf/util/probe-file.c | 7 +++----
tools/perf/util/util.h | 3 +--
11 files changed, 23 insertions(+), 29 deletions(-)
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 8afe08a99bc6..791509346178 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -11,7 +11,6 @@
#include <unistd.h>
#include <sys/mount.h>
-#include "debugfs.h"
#include "fs.h"
#define _STR(x) #x
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index b0ee3b3acef0..b53aa9c8d1c8 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -7,8 +7,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
-#include "debugfs.h"
-#include "tracefs.h"
+#include "fs.h"
#include "tracing_path.h"
@@ -29,7 +28,7 @@ static const char *tracing_path_tracefs_mount(void)
{
const char *mnt;
- mnt = tracefs_mount(NULL);
+ mnt = tracefs__mount();
if (!mnt)
return NULL;
@@ -42,7 +41,7 @@ static const char *tracing_path_debugfs_mount(void)
{
const char *mnt;
- mnt = debugfs_mount(NULL);
+ mnt = debugfs__mount();
if (!mnt)
return NULL;
@@ -90,7 +89,7 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
switch (err) {
case ENOENT:
- if (debugfs_configured() || tracefs_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",
@@ -104,13 +103,13 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
break;
case EACCES: {
- const char *mountpoint = debugfs_find_mountpoint();
+ const char *mountpoint = debugfs__mountpoint();
if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
- const char *tracefs_mntpoint = tracefs_find_mountpoint();
+ const char *tracefs_mntpoint = tracefs__mountpoint();
if (tracefs_mntpoint)
- mountpoint = tracefs_find_mountpoint();
+ mountpoint = tracefs__mountpoint();
}
snprintf(buf, size,
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index fc1cffb1b7a2..dd94b4ca2213 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -13,7 +13,6 @@
#include "util/parse-options.h"
#include "util/trace-event.h"
#include "util/debug.h"
-#include <api/fs/debugfs.h>
#include "util/tool.h"
#include "util/stat.h"
#include "util/top.h"
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index b81cec33b4b2..310aba2756a8 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -37,7 +37,6 @@
#include "util/strfilter.h"
#include "util/symbol.h"
#include "util/debug.h"
-#include <api/fs/debugfs.h>
#include "util/parse-options.h"
#include "util/probe-finder.h"
#include "util/probe-event.h"
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index a572f87e9c8d..a38adf94c731 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -1,3 +1,4 @@
+#include <api/fs/fs.h>
#include "evsel.h"
#include "tests.h"
#include "thread_map.h"
@@ -30,9 +31,9 @@ int test__openat_syscall_event_on_all_cpus(void)
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
- if (tracefs_configured())
+ if (tracefs__configured())
pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
- else if (debugfs_configured())
+ else if (debugfs__configured())
pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
else
pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index c9a37bc6b33a..8048c7d7cd67 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,3 +1,4 @@
+#include <api/fs/fs.h>
#include "thread_map.h"
#include "evsel.h"
#include "debug.h"
@@ -18,9 +19,9 @@ int test__openat_syscall_event(void)
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
- if (tracefs_configured())
+ if (tracefs__configured())
pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
- else if (debugfs_configured())
+ else if (debugfs__configured())
pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
else
pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 9b6b2b6324a1..91fbfd593c4a 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -3,11 +3,10 @@
#include "evsel.h"
#include "evlist.h"
#include <api/fs/fs.h>
-#include <api/fs/tracefs.h>
-#include <api/fs/debugfs.h>
#include "tests.h"
#include "debug.h"
#include <linux/hw_breakpoint.h>
+#include <api/fs/fs.h>
#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
@@ -1268,12 +1267,12 @@ static int count_tracepoints(void)
DIR *events_dir;
int cnt = 0;
- mountpoint = tracefs_find_mountpoint();
+ mountpoint = tracefs__mountpoint();
if (mountpoint) {
scnprintf(events_path, PATH_MAX, "%s/events",
mountpoint);
} else {
- mountpoint = debugfs_find_mountpoint();
+ mountpoint = debugfs__mountpoint();
scnprintf(events_path, PATH_MAX, "%s/tracing/events",
mountpoint);
}
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c53f79123b37..771ade4d5966 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -9,7 +9,7 @@
#include <byteswap.h>
#include <linux/bitops.h>
-#include <api/fs/debugfs.h>
+#include <api/fs/tracing_path.h>
#include <traceevent/event-parse.h>
#include <linux/hw_breakpoint.h>
#include <linux/perf_event.h>
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index eb5f18b75402..1104c584e3d9 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -40,8 +40,7 @@
#include "color.h"
#include "symbol.h"
#include "thread.h"
-#include <api/fs/debugfs.h>
-#include <api/fs/tracefs.h>
+#include <api/fs/fs.h>
#include "trace-event.h" /* For __maybe_unused */
#include "probe-event.h"
#include "probe-finder.h"
@@ -2054,7 +2053,7 @@ static void kprobe_blacklist__delete(struct list_head *blacklist)
static int kprobe_blacklist__load(struct list_head *blacklist)
{
struct kprobe_blacklist_node *node;
- const char *__debugfs = debugfs_find_mountpoint();
+ const char *__debugfs = debugfs__mountpoint();
char buf[PATH_MAX], *p;
FILE *fp;
int ret;
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index bbb243717ec8..de0df1e6222a 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -22,8 +22,7 @@
#include "color.h"
#include "symbol.h"
#include "thread.h"
-#include <api/fs/debugfs.h>
-#include <api/fs/tracefs.h>
+#include <api/fs/fs.h>
#include "probe-event.h"
#include "probe-file.h"
#include "session.h"
@@ -77,11 +76,11 @@ static int open_probe_events(const char *trace_file, bool readwrite)
const char *tracing_dir = "";
int ret;
- __debugfs = tracefs_find_mountpoint();
+ __debugfs = tracefs__mountpoint();
if (__debugfs == NULL) {
tracing_dir = "tracing/";
- __debugfs = debugfs_find_mountpoint();
+ __debugfs = debugfs__mountpoint();
if (__debugfs == NULL)
return -ENOTSUP;
}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index f9a9717d2aff..91b3bb79a4b5 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -74,8 +74,7 @@
#include <linux/magic.h>
#include <linux/types.h>
#include <sys/ttydefaults.h>
-#include <api/fs/debugfs.h>
-#include <api/fs/tracefs.h>
+#include <api/fs/tracing_path.h>
#include <termios.h>
#include <linux/bitops.h>
#include <termios.h>
--
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@kernel.org> |
|---|---|
| Date | 2015-09-02 10:00 +0200 |
| Subject | [PATCH 08/15] tools lib api: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c |
| Message-ID | <q4b7B-7ff-41@gated-at.bofh.it> |
| In reply to | #1217380 |
There's no need to export SYSFS_MAGIC PROC_SUPER_MAGIC
in fs.h. Leave them in the fs.c.
Link: http://lkml.kernel.org/n/tip-b2cd1bb7yvbazq5oua24oz18@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/api/fs/fs.c | 8 ++++++++
tools/lib/api/fs/fs.h | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 5e838d3c419d..0700eb953495 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -18,6 +18,14 @@
#define _STR(x) #x
#define STR(x) _STR(x)
+#ifndef SYSFS_MAGIC
+#define SYSFS_MAGIC 0x62656572
+#endif
+
+#ifndef PROC_SUPER_MAGIC
+#define PROC_SUPER_MAGIC 0x9fa0
+#endif
+
static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index fd6288d73383..674efc8dfd9b 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -9,14 +9,6 @@
#define PATH_MAX 4096
#endif
-#ifndef SYSFS_MAGIC
-#define SYSFS_MAGIC 0x62656572
-#endif
-
-#ifndef PROC_SUPER_MAGIC
-#define PROC_SUPER_MAGIC 0x9fa0
-#endif
-
const char *sysfs__mountpoint(void);
const char *procfs__mountpoint(void);
--
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]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web