Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217380 > unrolled thread

[PATCH 00/15] perf tools: Cleanup filesystem api

Started byJiri Olsa <jolsa@kernel.org>
First post2015-09-02 10:00 +0200
Last post2015-09-02 10:10 +0200
Articles 20 on this page of 43 — 7 participants

Back to article view | Back to linux.kernel


Contents

  [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 2 of 3 — ← Prev page 1 [2] 3  Next page →


#1217390 — [PATCH 12/15] tools lib api: Add configured support for fs

FromJiri Olsa <jolsa@kernel.org>
Date2015-09-02 10:00 +0200
Subject[PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q4b7B-7ff-45@gated-at.bofh.it>
In reply to#1217380
Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
interface that returns bool state of the filesystem mount:
  true - mounted, false - not mounted

It will not try to mount the filesystem.

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 | 23 ++++++++++++++---------
 tools/lib/api/fs/fs.h |  5 ++++-
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index bc93baf33fff..8afe08a99bc6 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -244,15 +244,20 @@ static const char *fs__mount(int idx)
 	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);		\
+#define FS(name, idx)				\
+const char *name##__mountpoint(void)		\
+{						\
+	return fs__mountpoint(idx);		\
+}						\
+						\
+const char *name##__mount(void)			\
+{						\
+	return fs__mount(idx);			\
+}						\
+						\
+bool name##__configured(void)			\
+{						\
+	return name##__mountpoint() != NULL;	\
 }
 
 FS(sysfs,   FS__SYSFS);
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index a9627ea5e6ae..f654bcb99d1e 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -1,6 +1,8 @@
 #ifndef __API_FS__
 #define __API_FS__
 
+#include <stdbool.h>
+
 /*
  * On most systems <limits.h> would have given us this, but  not on some systems
  * (e.g. GNU/Hurd).
@@ -11,7 +13,8 @@
 
 #define FS(name)				\
 	const char *name##__mountpoint(void);	\
-	const char *name##__mount(void);
+	const char *name##__mount(void);	\
+	bool name##__configured(void);		\
 
 FS(sysfs)
 FS(procfs)
-- 
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]


#1217603 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-02 15:40 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q4gqC-6uo-7@gated-at.bofh.it>
In reply to#1217390
Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> interface that returns bool state of the filesystem mount:
>   true - mounted, false - not mounted

Well, why not take the opportunity and call it... name__mounted()?
"__configured()" is too vague...

Also there was some cut'n'pasting mistake here... if you agree I can fix
it all up and make this change, well, I'm doing it on my local tree,
holler if you have any objection :)

- Arnaldo
 
> It will not try to mount the filesystem.

No FSTYPE__configured() (to-be FSTYPE__mounted()) doesn't mount
anything, that is what FSTYPE__mount() does :-) 

- Arnaldo
 
> 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 | 23 ++++++++++++++---------
>  tools/lib/api/fs/fs.h |  5 ++++-
>  2 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
> index bc93baf33fff..8afe08a99bc6 100644
> --- a/tools/lib/api/fs/fs.c
> +++ b/tools/lib/api/fs/fs.c
> @@ -244,15 +244,20 @@ static const char *fs__mount(int idx)
>  	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);		\
> +#define FS(name, idx)				\
> +const char *name##__mountpoint(void)		\
> +{						\
> +	return fs__mountpoint(idx);		\
> +}						\
> +						\
> +const char *name##__mount(void)			\
> +{						\
> +	return fs__mount(idx);			\
> +}						\
> +						\
> +bool name##__configured(void)			\
> +{						\
> +	return name##__mountpoint() != NULL;	\
>  }
>  
>  FS(sysfs,   FS__SYSFS);
> diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
> index a9627ea5e6ae..f654bcb99d1e 100644
> --- a/tools/lib/api/fs/fs.h
> +++ b/tools/lib/api/fs/fs.h
> @@ -1,6 +1,8 @@
>  #ifndef __API_FS__
>  #define __API_FS__
>  
> +#include <stdbool.h>
> +
>  /*
>   * On most systems <limits.h> would have given us this, but  not on some systems
>   * (e.g. GNU/Hurd).
> @@ -11,7 +13,8 @@
>  
>  #define FS(name)				\
>  	const char *name##__mountpoint(void);	\
> -	const char *name##__mount(void);
> +	const char *name##__mount(void);	\
> +	bool name##__configured(void);		\
>  
>  FS(sysfs)
>  FS(procfs)
> -- 
> 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]


#1217609 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromJiri Olsa <jolsa@redhat.com>
Date2015-09-02 15:50 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q4gAi-6FJ-11@gated-at.bofh.it>
In reply to#1217603
On Wed, Sep 02, 2015 at 10:39:31AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> > interface that returns bool state of the filesystem mount:
> >   true - mounted, false - not mounted
> 
> Well, why not take the opportunity and call it... name__mounted()?
> "__configured()" is too vague...

I mirrored the debugfs/tracefs object interface
we can have another patch changing that

> 
> Also there was some cut'n'pasting mistake here... if you agree I can fix
> it all up and make this change, well, I'm doing it on my local tree,
> holler if you have any objection :)
> 
> - Arnaldo
>  
> > It will not try to mount the filesystem.
> 
> No FSTYPE__configured() (to-be FSTYPE__mounted()) doesn't mount
> anything, that is what FSTYPE__mount() does :-) 

I stated it just to be clear ;-)

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]


#1217626 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-02 16:20 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q4h3j-7tc-7@gated-at.bofh.it>
In reply to#1217609
Em Wed, Sep 02, 2015 at 03:46:25PM +0200, Jiri Olsa escreveu:
> On Wed, Sep 02, 2015 at 10:39:31AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> > > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)

The cut'n'paste error I mentioned was in the above line, BTW.

> > > interface that returns bool state of the filesystem mount:
> > >   true - mounted, false - not mounted
> > 
> > Well, why not take the opportunity and call it... name__mounted()?
> > "__configured()" is too vague...
> 
> I mirrored the debugfs/tracefs object interface
> we can have another patch changing that

Ok, agreed, will leave it as configured() and then we can change it.
 
> > 
> > Also there was some cut'n'pasting mistake here... if you agree I can fix
> > it all up and make this change, well, I'm doing it on my local tree,
> > holler if you have any objection :)
> >  
> > > It will not try to mount the filesystem.
> > 
> > No FSTYPE__configured() (to-be FSTYPE__mounted()) doesn't mount
> > anything, that is what FSTYPE__mount() does :-) 
> 
> I stated it just to be clear ;-)

Sure, somehow the cut'n'paste error on the first line flipped a bit in
my brain, sorry ;-\

- 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]


#1217751 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-02 19:00 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q4jya-2ro-19@gated-at.bofh.it>
In reply to#1217626
Em Wed, Sep 02, 2015 at 11:17:59AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Sep 02, 2015 at 03:46:25PM +0200, Jiri Olsa escreveu:
> > On Wed, Sep 02, 2015 at 10:39:31AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> > > > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> 
> The cut'n'paste error I mentioned was in the above line, BTW.
> 
> > > > interface that returns bool state of the filesystem mount:
> > > >   true - mounted, false - not mounted
> > > 
> > > Well, why not take the opportunity and call it... name__mounted()?
> > > "__configured()" is too vague...
> > 
> > I mirrored the debugfs/tracefs object interface
> > we can have another patch changing that
> 
> Ok, agreed, will leave it as configured() and then we can change it.

What I have is at my tmp.perf/core branch, out for lunch.

- Arnaldo
  
> > > 
> > > Also there was some cut'n'pasting mistake here... if you agree I can fix
> > > it all up and make this change, well, I'm doing it on my local tree,
> > > holler if you have any objection :)
> > >  
> > > > It will not try to mount the filesystem.
> > > 
> > > No FSTYPE__configured() (to-be FSTYPE__mounted()) doesn't mount
> > > anything, that is what FSTYPE__mount() does :-) 
> > 
> > I stated it just to be clear ;-)
> 
> Sure, somehow the cut'n'paste error on the first line flipped a bit in
> my brain, sorry ;-\
> 
> - 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]


#1218695 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromJiri Olsa <jolsa@redhat.com>
Date2015-09-04 09:10 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q4Tii-3k1-29@gated-at.bofh.it>
In reply to#1217751
On Wed, Sep 02, 2015 at 01:52:28PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 02, 2015 at 11:17:59AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, Sep 02, 2015 at 03:46:25PM +0200, Jiri Olsa escreveu:
> > > On Wed, Sep 02, 2015 at 10:39:31AM -0300, Arnaldo Carvalho de Melo wrote:
> > > > Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> > > > > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> > 
> > The cut'n'paste error I mentioned was in the above line, BTW.
> > 
> > > > > interface that returns bool state of the filesystem mount:
> > > > >   true - mounted, false - not mounted
> > > > 
> > > > Well, why not take the opportunity and call it... name__mounted()?
> > > > "__configured()" is too vague...
> > > 
> > > I mirrored the debugfs/tracefs object interface
> > > we can have another patch changing that
> > 
> > Ok, agreed, will leave it as configured() and then we can change it.
> 
> What I have is at my tmp.perf/core branch, out for lunch.

I can see all of it in your's perf/core apart from:

Applying: tools lib api: Make tracing_path_strerror_open message generic
Applying: tools lib api: Replace debugfs/tracefs objects interface with fs.c
Applying: tools lib api: Remove debugfs, tracefs and findfs objects
Applying: perf tools: Switch to tracing_path interface on appropriate places

should I repost or do you plan to take it? I didn't get any comments on those

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]


#1219161 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-04 18:50 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q52lA-7Jv-19@gated-at.bofh.it>
In reply to#1218695
Em Fri, Sep 04, 2015 at 09:08:45AM +0200, Jiri Olsa escreveu:
> On Wed, Sep 02, 2015 at 01:52:28PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Sep 02, 2015 at 11:17:59AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Wed, Sep 02, 2015 at 03:46:25PM +0200, Jiri Olsa escreveu:
> > > > On Wed, Sep 02, 2015 at 10:39:31AM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> > > > > > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> > > 
> > > The cut'n'paste error I mentioned was in the above line, BTW.
> > > 
> > > > > > interface that returns bool state of the filesystem mount:
> > > > > >   true - mounted, false - not mounted
> > > > > 
> > > > > Well, why not take the opportunity and call it... name__mounted()?
> > > > > "__configured()" is too vague...
> > > > 
> > > > I mirrored the debugfs/tracefs object interface
> > > > we can have another patch changing that
> > > 
> > > Ok, agreed, will leave it as configured() and then we can change it.
> > 
> > What I have is at my tmp.perf/core branch, out for lunch.
> 
> I can see all of it in your's perf/core apart from:
> 
> Applying: tools lib api: Make tracing_path_strerror_open message generic
> Applying: tools lib api: Replace debugfs/tracefs objects interface with fs.c
> Applying: tools lib api: Remove debugfs, tracefs and findfs objects
> Applying: perf tools: Switch to tracing_path interface on appropriate places
> 
> should I repost or do you plan to take it? I didn't get any comments on those

I'll get back to those, its just that the number of patches in my
perf/core branch was getting too high, better flush it a bit, will
continue.

If you can just make sure that a rebase on top of my perf/core goes
well, that helps.

- 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]


#1219225 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromJiri Olsa <jolsa@redhat.com>
Date2015-09-04 19:50 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q53hD-Cw-3@gated-at.bofh.it>
In reply to#1219161
On Fri, Sep 04, 2015 at 01:42:51PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Sep 04, 2015 at 09:08:45AM +0200, Jiri Olsa escreveu:
> > On Wed, Sep 02, 2015 at 01:52:28PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Wed, Sep 02, 2015 at 11:17:59AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Wed, Sep 02, 2015 at 03:46:25PM +0200, Jiri Olsa escreveu:
> > > > > On Wed, Sep 02, 2015 at 10:39:31AM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > > Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> > > > > > > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> > > > 
> > > > The cut'n'paste error I mentioned was in the above line, BTW.
> > > > 
> > > > > > > interface that returns bool state of the filesystem mount:
> > > > > > >   true - mounted, false - not mounted
> > > > > > 
> > > > > > Well, why not take the opportunity and call it... name__mounted()?
> > > > > > "__configured()" is too vague...
> > > > > 
> > > > > I mirrored the debugfs/tracefs object interface
> > > > > we can have another patch changing that
> > > > 
> > > > Ok, agreed, will leave it as configured() and then we can change it.
> > > 
> > > What I have is at my tmp.perf/core branch, out for lunch.
> > 
> > I can see all of it in your's perf/core apart from:
> > 
> > Applying: tools lib api: Make tracing_path_strerror_open message generic
> > Applying: tools lib api: Replace debugfs/tracefs objects interface with fs.c
> > Applying: tools lib api: Remove debugfs, tracefs and findfs objects
> > Applying: perf tools: Switch to tracing_path interface on appropriate places
> > 
> > should I repost or do you plan to take it? I didn't get any comments on those
> 
> I'll get back to those, its just that the number of patches in my
> perf/core branch was getting too high, better flush it a bit, will
> continue.
> 
> If you can just make sure that a rebase on top of my perf/core goes
> well, that helps.

I updated my perf/tracing_path branch to your current perf/core
no conflicts..

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]


#1217611 — Re: [PATCH 12/15] tools lib api: Add configured support for fs

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-02 15:50 +0200
SubjectRe: [PATCH 12/15] tools lib api: Add configured support for fs
Message-ID<q4gAi-6FJ-9@gated-at.bofh.it>
In reply to#1217603
Em Wed, Sep 02, 2015 at 10:39:31AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu:
> > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
> > interface that returns bool state of the filesystem mount:
> >   true - mounted, false - not mounted
> 
> Well, why not take the opportunity and call it... name__mounted()?
> "__configured()" is too vague...
> 
> Also there was some cut'n'pasting mistake here... if you agree I can fix
> it all up and make this change, well, I'm doing it on my local tree,
> holler if you have any objection :)
> 
> - Arnaldo
>  
> > It will not try to mount the filesystem.
> 
> No FSTYPE__configured() (to-be FSTYPE__mounted()) doesn't mount
> anything, that is what FSTYPE__mount() does :-) 

Argh, now it was me confused, right, __configured() or __mounted()
doesn'try to mount anything, as you said, it is just the "Adding
name__mount() that in the beginning that needs fixing, the rest of my
comment stands.

- Arnaldo

> 
> - Arnaldo
>  
> > 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 | 23 ++++++++++++++---------
> >  tools/lib/api/fs/fs.h |  5 ++++-
> >  2 files changed, 18 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
> > index bc93baf33fff..8afe08a99bc6 100644
> > --- a/tools/lib/api/fs/fs.c
> > +++ b/tools/lib/api/fs/fs.c
> > @@ -244,15 +244,20 @@ static const char *fs__mount(int idx)
> >  	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);		\
> > +#define FS(name, idx)				\
> > +const char *name##__mountpoint(void)		\
> > +{						\
> > +	return fs__mountpoint(idx);		\
> > +}						\
> > +						\
> > +const char *name##__mount(void)			\
> > +{						\
> > +	return fs__mount(idx);			\
> > +}						\
> > +						\
> > +bool name##__configured(void)			\
> > +{						\
> > +	return name##__mountpoint() != NULL;	\
> >  }
> >  
> >  FS(sysfs,   FS__SYSFS);
> > diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
> > index a9627ea5e6ae..f654bcb99d1e 100644
> > --- a/tools/lib/api/fs/fs.h
> > +++ b/tools/lib/api/fs/fs.h
> > @@ -1,6 +1,8 @@
> >  #ifndef __API_FS__
> >  #define __API_FS__
> >  
> > +#include <stdbool.h>
> > +
> >  /*
> >   * On most systems <limits.h> would have given us this, but  not on some systems
> >   * (e.g. GNU/Hurd).
> > @@ -11,7 +13,8 @@
> >  
> >  #define FS(name)				\
> >  	const char *name##__mountpoint(void);	\
> > -	const char *name##__mount(void);
> > +	const char *name##__mount(void);	\
> > +	bool name##__configured(void);		\
> >  
> >  FS(sysfs)
> >  FS(procfs)
> > -- 
> > 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]


#1217391 — [PATCH 09/15] tools lib api: Add debugfs into fs.c object

FromJiri Olsa <jolsa@kernel.org>
Date2015-09-02 10:00 +0200
Subject[PATCH 09/15] tools lib api: Add debugfs into fs.c object
Message-ID<q4b7C-7ff-47@gated-at.bofh.it>
In reply to#1217380
Adding debugfs support into fs.c framework. It'll replace
the debugfs object functionality in following patches.

Link: http://lkml.kernel.org/n/tip-6n8d5bxn47oqcvlhzqw09dol@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/lib/api/fs/fs.c | 31 +++++++++++++++++++++++++------
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 0700eb953495..798052cbc7c0 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -1,5 +1,3 @@
-/* TODO merge/factor in debugfs.c here */
-
 #include <ctype.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -26,6 +24,10 @@
 #define PROC_SUPER_MAGIC       0x9fa0
 #endif
 
+#ifndef DEBUGFS_MAGIC
+#define DEBUGFS_MAGIC          0x64626720
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
 	"/sys",
 	0,
@@ -36,6 +38,16 @@ static const char * const procfs__known_mountpoints[] = {
 	0,
 };
 
+#ifndef DEBUGFS_DEFAULT_PATH
+#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
+#endif
+
+static const char * const debugfs__known_mountpoints[] = {
+	DEBUGFS_DEFAULT_PATH,
+	"/debug",
+	0,
+};
+
 struct fs {
 	const char		*name;
 	const char * const	*mounts;
@@ -45,8 +57,9 @@ struct fs {
 };
 
 enum {
-	FS__SYSFS  = 0,
-	FS__PROCFS = 1,
+	FS__SYSFS   = 0,
+	FS__PROCFS  = 1,
+	FS__DEBUGFS = 2,
 };
 
 static struct fs fs__entries[] = {
@@ -60,6 +73,11 @@ static struct fs fs__entries[] = {
 		.mounts	= procfs__known_mountpoints,
 		.magic	= PROC_SUPER_MAGIC,
 	},
+	[FS__DEBUGFS] = {
+		.name	= "debugfs",
+		.mounts	= debugfs__known_mountpoints,
+		.magic	= DEBUGFS_MAGIC,
+	},
 };
 
 static bool fs__read_mounts(struct fs *fs)
@@ -176,8 +194,9 @@ const char *name##__mountpoint(void)	\
 	return fs__mountpoint(idx);	\
 }
 
-FS__MOUNTPOINT(sysfs,  FS__SYSFS);
-FS__MOUNTPOINT(procfs, FS__PROCFS);
+FS__MOUNTPOINT(sysfs,   FS__SYSFS);
+FS__MOUNTPOINT(procfs,  FS__PROCFS);
+FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
 
 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 674efc8dfd9b..a4e6b1d93d2f 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -11,6 +11,7 @@
 
 const char *sysfs__mountpoint(void);
 const char *procfs__mountpoint(void);
+const char *debugfs__mountpoint(void);
 
 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]


#1217392 — [PATCH 10/15] tools lib api: Add tracefs into fs.c object

FromJiri Olsa <jolsa@kernel.org>
Date2015-09-02 10:00 +0200
Subject[PATCH 10/15] tools lib api: Add tracefs into fs.c object
Message-ID<q4b7C-7ff-49@gated-at.bofh.it>
In reply to#1217380
Adding tracefs support into fs.c framework. It'll replace
the tracefs object functionality in following patches.

Link: http://lkml.kernel.org/n/tip-m27bbnbg8s03mt2na6zghf9q@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/lib/api/fs/fs.c | 28 ++++++++++++++++++++++++++++
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 29 insertions(+)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 798052cbc7c0..ef16d2a83a27 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -28,6 +28,10 @@
 #define DEBUGFS_MAGIC          0x64626720
 #endif
 
+#ifndef TRACEFS_MAGIC
+#define TRACEFS_MAGIC          0x74726163
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
 	"/sys",
 	0,
@@ -48,6 +52,19 @@ static const char * const debugfs__known_mountpoints[] = {
 	0,
 };
 
+
+#ifndef TRACEFS_DEFAULT_PATH
+#define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing"
+#endif
+
+static const char * const tracefs__known_mountpoints[] = {
+	TRACEFS_DEFAULT_PATH,
+	"/sys/kernel/debug/tracing",
+	"/tracing",
+	"/trace",
+	0,
+};
+
 struct fs {
 	const char		*name;
 	const char * const	*mounts;
@@ -60,8 +77,13 @@ enum {
 	FS__SYSFS   = 0,
 	FS__PROCFS  = 1,
 	FS__DEBUGFS = 2,
+	FS__TRACEFS = 3,
 };
 
+#ifndef TRACEFS_MAGIC
+#define TRACEFS_MAGIC 0x74726163
+#endif
+
 static struct fs fs__entries[] = {
 	[FS__SYSFS] = {
 		.name	= "sysfs",
@@ -78,6 +100,11 @@ static struct fs fs__entries[] = {
 		.mounts	= debugfs__known_mountpoints,
 		.magic	= DEBUGFS_MAGIC,
 	},
+	[FS__TRACEFS] = {
+		.name	= "tracefs",
+		.mounts	= tracefs__known_mountpoints,
+		.magic	= TRACEFS_MAGIC,
+	},
 };
 
 static bool fs__read_mounts(struct fs *fs)
@@ -197,6 +224,7 @@ const char *name##__mountpoint(void)	\
 FS__MOUNTPOINT(sysfs,   FS__SYSFS);
 FS__MOUNTPOINT(procfs,  FS__PROCFS);
 FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
+FS__MOUNTPOINT(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 a4e6b1d93d2f..9013227ae0d1 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -12,6 +12,7 @@
 const char *sysfs__mountpoint(void);
 const char *procfs__mountpoint(void);
 const char *debugfs__mountpoint(void);
+const char *tracefs__mountpoint(void);
 
 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]


#1217393 — [PATCH 15/15] perf tools: Switch to tracing_path interface on appropriate places

FromJiri Olsa <jolsa@kernel.org>
Date2015-09-02 10:00 +0200
Subject[PATCH 15/15] perf tools: Switch to tracing_path interface on appropriate places
Message-ID<q4b7C-7ff-53@gated-at.bofh.it>
In reply to#1217380
Using tracing_path interface on several places, that more or less
copy the functionality of tracing_path interface.

Link: http://lkml.kernel.org/n/tip-nvxvjo2bpsjf3hhz3ylulw1k@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/openat-syscall-all-cpus.c |  9 +++------
 tools/perf/tests/openat-syscall.c          | 11 ++++-------
 tools/perf/tests/parse-events.c            | 16 ++--------------
 tools/perf/util/probe-file.c               | 14 ++------------
 4 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index a38adf94c731..495d8126b722 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -15,6 +15,7 @@ int test__openat_syscall_event_on_all_cpus(void)
 	cpu_set_t cpu_set;
 	struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
 	char sbuf[STRERR_BUFSIZE];
+	char errbuf[BUFSIZ];
 
 	if (threads == NULL) {
 		pr_debug("thread_map__new\n");
@@ -31,12 +32,8 @@ int test__openat_syscall_event_on_all_cpus(void)
 
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (evsel == NULL) {
-		if (tracefs__configured())
-			pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
-		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");
+		tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
+		pr_err("%s\n", errbuf);
 		goto out_thread_map_delete;
 	}
 
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index 8048c7d7cd67..08ac9d94a050 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,4 +1,4 @@
-#include <api/fs/fs.h>
+#include <api/fs/tracing_path.h>
 #include "thread_map.h"
 #include "evsel.h"
 #include "debug.h"
@@ -11,6 +11,7 @@ int test__openat_syscall_event(void)
 	unsigned int nr_openat_calls = 111, i;
 	struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
 	char sbuf[STRERR_BUFSIZE];
+	char errbuf[BUFSIZ];
 
 	if (threads == NULL) {
 		pr_debug("thread_map__new\n");
@@ -19,12 +20,8 @@ int test__openat_syscall_event(void)
 
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (evsel == NULL) {
-		if (tracefs__configured())
-			pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
-		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");
+		tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
+		pr_err("%s\n", errbuf);
 		goto out_thread_map_delete;
 	}
 
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 91fbfd593c4a..3a2ebe666192 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1261,23 +1261,11 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
 
 static int count_tracepoints(void)
 {
-	char events_path[PATH_MAX];
 	struct dirent *events_ent;
-	const char *mountpoint;
 	DIR *events_dir;
 	int cnt = 0;
 
-	mountpoint = tracefs__mountpoint();
-	if (mountpoint) {
-		scnprintf(events_path, PATH_MAX, "%s/events",
-			  mountpoint);
-	} else {
-		mountpoint = debugfs__mountpoint();
-		scnprintf(events_path, PATH_MAX, "%s/tracing/events",
-			  mountpoint);
-	}
-
-	events_dir = opendir(events_path);
+	events_dir = opendir(tracing_events_path);
 
 	TEST_ASSERT_VAL("Can't open events dir", events_dir);
 
@@ -1294,7 +1282,7 @@ static int count_tracepoints(void)
 			continue;
 
 		scnprintf(sys_path, PATH_MAX, "%s/%s",
-			  events_path, events_ent->d_name);
+			  tracing_events_path, events_ent->d_name);
 
 		sys_dir = opendir(sys_path);
 		TEST_ASSERT_VAL("Can't open sys dir", sys_dir);
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index de0df1e6222a..cbc5783389f8 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -22,7 +22,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include <api/fs/fs.h>
+#include <api/fs/tracing_path.h>
 #include "probe-event.h"
 #include "probe-file.h"
 #include "session.h"
@@ -72,21 +72,11 @@ static void print_both_open_warning(int kerr, int uerr)
 static int open_probe_events(const char *trace_file, bool readwrite)
 {
 	char buf[PATH_MAX];
-	const char *__debugfs;
 	const char *tracing_dir = "";
 	int ret;
 
-	__debugfs = tracefs__mountpoint();
-	if (__debugfs == NULL) {
-		tracing_dir = "tracing/";
-
-		__debugfs = debugfs__mountpoint();
-		if (__debugfs == NULL)
-			return -ENOTSUP;
-	}
-
 	ret = e_snprintf(buf, PATH_MAX, "%s/%s%s",
-			 __debugfs, tracing_dir, trace_file);
+			 tracing_path, tracing_dir, trace_file);
 	if (ret >= 0) {
 		pr_debug("Opening %s write=%d\n", buf, readwrite);
 		if (readwrite && !probe_event_dry_run)
-- 
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]


#1217394 — [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c

FromJiri Olsa <jolsa@kernel.org>
Date2015-09-02 10:00 +0200
Subject[PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c
Message-ID<q4b7B-7ff-31@gated-at.bofh.it>
In reply to#1217380
Moving tracing_path interface into api/fs/tracing_path.c
out of util.c. It seems generic enough to be used by
others, and I couldn't think of better place.

Link: http://lkml.kernel.org/n/tip-xqvrud2e3z4uynvnu3imlu2y@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/lib/api/fs/Build             |  1 +
 tools/lib/api/fs/tracing_path.c    | 83 ++++++++++++++++++++++++++++++++++++++
 tools/lib/api/fs/tracing_path.h    | 13 ++++++
 tools/perf/perf.c                  |  2 +-
 tools/perf/util/parse-events.c     |  2 +-
 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             |  6 ---
 9 files changed, 101 insertions(+), 79 deletions(-)
 create mode 100644 tools/lib/api/fs/tracing_path.c
 create mode 100644 tools/lib/api/fs/tracing_path.h

diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index 6de5a4f0b501..fa726f679b29 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,4 +1,5 @@
 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/tracing_path.c b/tools/lib/api/fs/tracing_path.c
new file mode 100644
index 000000000000..1fd6e1f99234
--- /dev/null
+++ b/tools/lib/api/fs/tracing_path.c
@@ -0,0 +1,83 @@
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "debugfs.h"
+#include "tracefs.h"
+
+#include "tracing_path.h"
+
+
+char tracing_path[PATH_MAX + 1]        = "/sys/kernel/debug/tracing";
+char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
+
+
+static void __tracing_path_set(const char *tracing, const char *mountpoint)
+{
+	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
+		 mountpoint, tracing);
+	snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s",
+		 mountpoint, tracing, "events");
+}
+
+static const char *tracing_path_tracefs_mount(void)
+{
+	const char *mnt;
+
+	mnt = tracefs_mount(NULL);
+	if (!mnt)
+		return NULL;
+
+	__tracing_path_set("", mnt);
+
+	return mnt;
+}
+
+static const char *tracing_path_debugfs_mount(void)
+{
+	const char *mnt;
+
+	mnt = debugfs_mount(NULL);
+	if (!mnt)
+		return NULL;
+
+	__tracing_path_set("tracing/", mnt);
+
+	return mnt;
+}
+
+const char *tracing_path_mount(void)
+{
+	const char *mnt;
+
+	mnt = tracing_path_tracefs_mount();
+	if (mnt)
+		return mnt;
+
+	mnt = tracing_path_debugfs_mount();
+
+	return mnt;
+}
+
+void tracing_path_set(const char *mntpt)
+{
+	__tracing_path_set("tracing/", mntpt);
+}
+
+char *get_tracing_file(const char *name)
+{
+	char *file;
+
+	if (asprintf(&file, "%s/%s", tracing_path, name) < 0)
+		return NULL;
+
+	return file;
+}
+
+void put_tracing_file(char *file)
+{
+	free(file);
+}
diff --git a/tools/lib/api/fs/tracing_path.h b/tools/lib/api/fs/tracing_path.h
new file mode 100644
index 000000000000..b132dc599fe5
--- /dev/null
+++ b/tools/lib/api/fs/tracing_path.h
@@ -0,0 +1,13 @@
+#ifndef __API_FS_TRACING_PATH_H
+#define __API_FS_TRACING_PATH_H
+
+extern char tracing_path[];
+extern char tracing_events_path[];
+
+void tracing_path_set(const char *mountpoint);
+const char *tracing_path_mount(void);
+
+char *get_tracing_file(const char *name);
+void put_tracing_file(char *file);
+
+#endif /* __API_FS_TRACING_PATH_H */
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 0e99cd1de9dd..f2fc019b3671 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -15,7 +15,7 @@
 #include "util/parse-events.h"
 #include "util/parse-options.h"
 #include "util/debug.h"
-#include <api/fs/debugfs.h>
+#include <api/fs/tracing_path.h>
 #include <pthread.h>
 
 const char perf_usage_string[] =
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d826e6f515db..3840176642f8 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -11,7 +11,7 @@
 #include "cache.h"
 #include "header.h"
 #include "debug.h"
-#include <api/fs/debugfs.h>
+#include <api/fs/tracing_path.h>
 #include "parse-events-bison.h"
 #define YY_EXTRA_TYPE int
 #include "parse-events-flex.h"
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 22245986e59e..d995743cb673 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -38,7 +38,7 @@
 
 #include "../perf.h"
 #include "trace-event.h"
-#include <api/fs/debugfs.h>
+#include <api/fs/tracing_path.h>
 #include "evsel.h"
 #include "debug.h"
 
diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c
index b90e646c7a91..2f4996ab313d 100644
--- a/tools/perf/util/trace-event.c
+++ b/tools/perf/util/trace-event.c
@@ -8,6 +8,7 @@
 #include <fcntl.h>
 #include <linux/kernel.h>
 #include <traceevent/event-parse.h>
+#include <api/fs/tracing_path.h>
 #include "trace-event.h"
 #include "machine.h"
 #include "util.h"
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index b959f783f6cd..49a5c6ad55f5 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -34,9 +34,6 @@ bool test_attr__enabled;
 bool perf_host  = true;
 bool perf_guest = false;
 
-char tracing_path[PATH_MAX + 1]        = "/sys/kernel/debug/tracing";
-char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
-
 void event_attr_init(struct perf_event_attr *attr)
 {
 	if (!perf_host)
@@ -390,73 +387,6 @@ void set_term_quiet_input(struct termios *old)
 	tcsetattr(0, TCSANOW, &tc);
 }
 
-static void __tracing_path_set(const char *tracing, const char *mountpoint)
-{
-	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
-		 mountpoint, tracing);
-	snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s",
-		 mountpoint, tracing, "events");
-}
-
-static const char *tracing_path_tracefs_mount(void)
-{
-	const char *mnt;
-
-	mnt = tracefs_mount(NULL);
-	if (!mnt)
-		return NULL;
-
-	__tracing_path_set("", mnt);
-
-	return mnt;
-}
-
-static const char *tracing_path_debugfs_mount(void)
-{
-	const char *mnt;
-
-	mnt = debugfs_mount(NULL);
-	if (!mnt)
-		return NULL;
-
-	__tracing_path_set("tracing/", mnt);
-
-	return mnt;
-}
-
-const char *tracing_path_mount(void)
-{
-	const char *mnt;
-
-	mnt = tracing_path_tracefs_mount();
-	if (mnt)
-		return mnt;
-
-	mnt = tracing_path_debugfs_mount();
-
-	return mnt;
-}
-
-void tracing_path_set(const char *mntpt)
-{
-	__tracing_path_set("tracing/", mntpt);
-}
-
-char *get_tracing_file(const char *name)
-{
-	char *file;
-
-	if (asprintf(&file, "%s/%s", tracing_path, name) < 0)
-		return NULL;
-
-	return file;
-}
-
-void put_tracing_file(char *file)
-{
-	free(file);
-}
-
 int parse_nsec_time(const char *str, u64 *ptime)
 {
 	u64 time_sec, time_nsec;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 230c4124bfa7..f9a9717d2aff 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -83,12 +83,6 @@
 extern const char *graph_line;
 extern const char *graph_dotted_line;
 extern char buildid_dir[];
-extern char tracing_path[];
-extern char tracing_events_path[];
-extern void tracing_path_set(const char *mountpoint);
-const char *tracing_path_mount(void);
-char *get_tracing_file(const char *name);
-void put_tracing_file(char *file);
 
 /* On most systems <limits.h> would have given us this, but
  * not on some systems (e.g. GNU/Hurd).
-- 
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]


#1218843 — Re: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2015-09-04 13:40 +0200
SubjectRe: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c
Message-ID<q4Xvz-Oj-3@gated-at.bofh.it>
In reply to#1217394
On Wed, 02 Sep, at 09:56:34AM, Jiri Olsa wrote:
> Moving tracing_path interface into api/fs/tracing_path.c
> out of util.c. It seems generic enough to be used by
> others, and I couldn't think of better place.
> 
> Link: http://lkml.kernel.org/n/tip-xqvrud2e3z4uynvnu3imlu2y@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/lib/api/fs/Build             |  1 +
>  tools/lib/api/fs/tracing_path.c    | 83 ++++++++++++++++++++++++++++++++++++++
>  tools/lib/api/fs/tracing_path.h    | 13 ++++++
>  tools/perf/perf.c                  |  2 +-
>  tools/perf/util/parse-events.c     |  2 +-
>  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             |  6 ---
>  9 files changed, 101 insertions(+), 79 deletions(-)
>  create mode 100644 tools/lib/api/fs/tracing_path.c
>  create mode 100644 tools/lib/api/fs/tracing_path.h

Reviewed-by: Matt Fleming <matt.fleming@intel.com>

-- 
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 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]


#1218971 — Re: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c

FromRaphaël Beamonte <raphael.beamonte@gmail.com>
Date2015-09-04 15:30 +0200
SubjectRe: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c
Message-ID<q4Ze2-3lc-43@gated-at.bofh.it>
In reply to#1218843
2015-09-04 7:35 GMT-04:00 Matt Fleming <matt@codeblueprint.co.uk>:
> On Wed, 02 Sep, at 09:56:34AM, Jiri Olsa wrote:
>> Moving tracing_path interface into api/fs/tracing_path.c
>> out of util.c. It seems generic enough to be used by
>> others, and I couldn't think of better place.
>>
>> Link: http://lkml.kernel.org/n/tip-xqvrud2e3z4uynvnu3imlu2y@git.kernel.org
>> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
>> ---
>>  tools/lib/api/fs/Build             |  1 +
>>  tools/lib/api/fs/tracing_path.c    | 83 ++++++++++++++++++++++++++++++++++++++
>>  tools/lib/api/fs/tracing_path.h    | 13 ++++++
>>  tools/perf/perf.c                  |  2 +-
>>  tools/perf/util/parse-events.c     |  2 +-
>>  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             |  6 ---
>>  9 files changed, 101 insertions(+), 79 deletions(-)
>>  create mode 100644 tools/lib/api/fs/tracing_path.c
>>  create mode 100644 tools/lib/api/fs/tracing_path.h
>
> Reviewed-by: Matt Fleming <matt.fleming@intel.com>
>
> --
> Matt Fleming, Intel Open Source Technology Center

I can get behind that too.
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]


#1217397 — [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object

FromJiri Olsa <jolsa@kernel.org>
Date2015-09-02 10:10 +0200
Subject[PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Message-ID<q4bhf-7FS-9@gated-at.bofh.it>
In reply to#1217380
Moving debugfs__strerror_open out of api/fs/debugfs.c,
because it's not debugfs specific. It'll be changed to
consider tracefs mount as well in following patches.

Renaming it into tracing_path__strerror_open_tp to fit
into the namespace. No functional change is intended.

Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m759kv@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/lib/api/fs/debugfs.c      | 52 ---------------------------------------
 tools/lib/api/fs/tracing_path.c | 54 +++++++++++++++++++++++++++++++++++++++++
 tools/lib/api/fs/tracing_path.h |  3 +++
 tools/perf/builtin-trace.c      |  5 ++--
 4 files changed, 60 insertions(+), 54 deletions(-)

diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
index eb7cf4d18f8a..c707cfb32782 100644
--- a/tools/lib/api/fs/debugfs.c
+++ b/tools/lib/api/fs/debugfs.c
@@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint)
 out:
 	return debugfs_mountpoint;
 }
-
-int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename)
-{
-	char sbuf[128];
-
-	switch (err) {
-	case ENOENT:
-		if (debugfs_found) {
-			snprintf(buf, size,
-				 "Error:\tFile %s/%s not found.\n"
-				 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
-				 debugfs_mountpoint, filename);
-			break;
-		}
-		snprintf(buf, size, "%s",
-			 "Error:\tUnable to find debugfs\n"
-			 "Hint:\tWas your kernel compiled with debugfs support?\n"
-			 "Hint:\tIs the debugfs filesystem mounted?\n"
-			 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
-		break;
-	case EACCES: {
-		const char *mountpoint = debugfs_mountpoint;
-
-		if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
-			const char *tracefs_mntpoint = tracefs_find_mountpoint();
-
-			if (tracefs_mntpoint)
-				mountpoint = tracefs_mntpoint;
-		}
-
-		snprintf(buf, size,
-			 "Error:\tNo permissions to read %s/%s\n"
-			 "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
-			 debugfs_mountpoint, filename, mountpoint);
-	}
-		break;
-	default:
-		snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf)));
-		break;
-	}
-
-	return 0;
-}
-
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
-{
-	char path[PATH_MAX];
-
-	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
-
-	return debugfs__strerror_open(err, buf, size, path);
-}
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 1fd6e1f99234..3b3e4f5fc50b 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -5,6 +5,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
+#include <unistd.h>
 #include "debugfs.h"
 #include "tracefs.h"
 
@@ -81,3 +83,55 @@ void put_tracing_file(char *file)
 {
 	free(file);
 }
+
+static int strerror_open(int err, char *buf, size_t size, const char *filename)
+{
+	char sbuf[128];
+
+	switch (err) {
+	case ENOENT:
+		if (debugfs_configured()) {
+			snprintf(buf, size,
+				 "Error:\tFile %s/%s not found.\n"
+				 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
+				 debugfs_mountpoint, filename);
+			break;
+		}
+		snprintf(buf, size, "%s",
+			 "Error:\tUnable to find debugfs\n"
+			 "Hint:\tWas your kernel compiled with debugfs support?\n"
+			 "Hint:\tIs the debugfs filesystem mounted?\n"
+			 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
+		break;
+	case EACCES: {
+		const char *mountpoint = debugfs_mountpoint;
+
+		if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
+			const char *tracefs_mntpoint = tracefs_find_mountpoint();
+
+			if (tracefs_mntpoint)
+				mountpoint = tracefs_mntpoint;
+		}
+
+		snprintf(buf, size,
+			 "Error:\tNo permissions to read %s/%s\n"
+			 "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
+			 debugfs_mountpoint, filename, mountpoint);
+	}
+		break;
+	default:
+		snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf)));
+		break;
+	}
+
+	return 0;
+}
+
+int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
+{
+	char path[PATH_MAX];
+
+	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
+
+	return strerror_open(err, buf, size, path);
+}
diff --git a/tools/lib/api/fs/tracing_path.h b/tools/lib/api/fs/tracing_path.h
index b132dc599fe5..3f233ac70b6f 100644
--- a/tools/lib/api/fs/tracing_path.h
+++ b/tools/lib/api/fs/tracing_path.h
@@ -1,6 +1,8 @@
 #ifndef __API_FS_TRACING_PATH_H
 #define __API_FS_TRACING_PATH_H
 
+#include <linux/types.h>
+
 extern char tracing_path[];
 extern char tracing_events_path[];
 
@@ -10,4 +12,5 @@ const char *tracing_path_mount(void);
 char *get_tracing_file(const char *name);
 void put_tracing_file(char *file);
 
+int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
 #endif /* __API_FS_TRACING_PATH_H */
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 4e3abba03062..215653274102 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -17,6 +17,7 @@
  */
 
 #include <traceevent/event-parse.h>
+#include <api/fs/tracing_path.h>
 #include "builtin.h"
 #include "util/color.h"
 #include "util/debug.h"
@@ -2686,11 +2687,11 @@ out_delete_evlist:
 	char errbuf[BUFSIZ];
 
 out_error_sched_stat_runtime:
-	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
+	tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
 	goto out_error;
 
 out_error_raw_syscalls:
-	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
+	tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
 	goto out_error;
 
 out_error_mmap:
-- 
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]


#1217594 — Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-02 15:20 +0200
SubjectRe: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Message-ID<q4g7g-683-7@gated-at.bofh.it>
In reply to#1217397
Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu:
> Moving debugfs__strerror_open out of api/fs/debugfs.c,
> because it's not debugfs specific. It'll be changed to
> consider tracefs mount as well in following patches.
> 
> Renaming it into tracing_path__strerror_open_tp to fit
> into the namespace. No functional change is intended.

Humm, here I think that "_path" may look excessive... But tracing_path__ better
than debugfs__, so its progress, applying, if we get a better name, we
can change this later.

- Arnaldo

 
> Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m759kv@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/lib/api/fs/debugfs.c      | 52 ---------------------------------------
>  tools/lib/api/fs/tracing_path.c | 54 +++++++++++++++++++++++++++++++++++++++++
>  tools/lib/api/fs/tracing_path.h |  3 +++
>  tools/perf/builtin-trace.c      |  5 ++--
>  4 files changed, 60 insertions(+), 54 deletions(-)
> 
> diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
> index eb7cf4d18f8a..c707cfb32782 100644
> --- a/tools/lib/api/fs/debugfs.c
> +++ b/tools/lib/api/fs/debugfs.c
> @@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint)
>  out:
>  	return debugfs_mountpoint;
>  }
> -
> -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename)
> -{
> -	char sbuf[128];
> -
> -	switch (err) {
> -	case ENOENT:
> -		if (debugfs_found) {
> -			snprintf(buf, size,
> -				 "Error:\tFile %s/%s not found.\n"
> -				 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
> -				 debugfs_mountpoint, filename);
> -			break;
> -		}
> -		snprintf(buf, size, "%s",
> -			 "Error:\tUnable to find debugfs\n"
> -			 "Hint:\tWas your kernel compiled with debugfs support?\n"
> -			 "Hint:\tIs the debugfs filesystem mounted?\n"
> -			 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
> -		break;
> -	case EACCES: {
> -		const char *mountpoint = debugfs_mountpoint;
> -
> -		if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
> -			const char *tracefs_mntpoint = tracefs_find_mountpoint();
> -
> -			if (tracefs_mntpoint)
> -				mountpoint = tracefs_mntpoint;
> -		}
> -
> -		snprintf(buf, size,
> -			 "Error:\tNo permissions to read %s/%s\n"
> -			 "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
> -			 debugfs_mountpoint, filename, mountpoint);
> -	}
> -		break;
> -	default:
> -		snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf)));
> -		break;
> -	}
> -
> -	return 0;
> -}
> -
> -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
> -{
> -	char path[PATH_MAX];
> -
> -	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
> -
> -	return debugfs__strerror_open(err, buf, size, path);
> -}
> diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> index 1fd6e1f99234..3b3e4f5fc50b 100644
> --- a/tools/lib/api/fs/tracing_path.c
> +++ b/tools/lib/api/fs/tracing_path.c
> @@ -5,6 +5,8 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> +#include <errno.h>
> +#include <unistd.h>
>  #include "debugfs.h"
>  #include "tracefs.h"
>  
> @@ -81,3 +83,55 @@ void put_tracing_file(char *file)
>  {
>  	free(file);
>  }
> +
> +static int strerror_open(int err, char *buf, size_t size, const char *filename)
> +{
> +	char sbuf[128];
> +
> +	switch (err) {
> +	case ENOENT:
> +		if (debugfs_configured()) {
> +			snprintf(buf, size,
> +				 "Error:\tFile %s/%s not found.\n"
> +				 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
> +				 debugfs_mountpoint, filename);
> +			break;
> +		}
> +		snprintf(buf, size, "%s",
> +			 "Error:\tUnable to find debugfs\n"
> +			 "Hint:\tWas your kernel compiled with debugfs support?\n"
> +			 "Hint:\tIs the debugfs filesystem mounted?\n"
> +			 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
> +		break;
> +	case EACCES: {
> +		const char *mountpoint = debugfs_mountpoint;
> +
> +		if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
> +			const char *tracefs_mntpoint = tracefs_find_mountpoint();
> +
> +			if (tracefs_mntpoint)
> +				mountpoint = tracefs_mntpoint;
> +		}
> +
> +		snprintf(buf, size,
> +			 "Error:\tNo permissions to read %s/%s\n"
> +			 "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
> +			 debugfs_mountpoint, filename, mountpoint);
> +	}
> +		break;
> +	default:
> +		snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf)));
> +		break;
> +	}
> +
> +	return 0;
> +}
> +
> +int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
> +{
> +	char path[PATH_MAX];
> +
> +	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
> +
> +	return strerror_open(err, buf, size, path);
> +}
> diff --git a/tools/lib/api/fs/tracing_path.h b/tools/lib/api/fs/tracing_path.h
> index b132dc599fe5..3f233ac70b6f 100644
> --- a/tools/lib/api/fs/tracing_path.h
> +++ b/tools/lib/api/fs/tracing_path.h
> @@ -1,6 +1,8 @@
>  #ifndef __API_FS_TRACING_PATH_H
>  #define __API_FS_TRACING_PATH_H
>  
> +#include <linux/types.h>
> +
>  extern char tracing_path[];
>  extern char tracing_events_path[];
>  
> @@ -10,4 +12,5 @@ const char *tracing_path_mount(void);
>  char *get_tracing_file(const char *name);
>  void put_tracing_file(char *file);
>  
> +int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
>  #endif /* __API_FS_TRACING_PATH_H */
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 4e3abba03062..215653274102 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -17,6 +17,7 @@
>   */
>  
>  #include <traceevent/event-parse.h>
> +#include <api/fs/tracing_path.h>
>  #include "builtin.h"
>  #include "util/color.h"
>  #include "util/debug.h"
> @@ -2686,11 +2687,11 @@ out_delete_evlist:
>  	char errbuf[BUFSIZ];
>  
>  out_error_sched_stat_runtime:
> -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
> +	tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
>  	goto out_error;
>  
>  out_error_raw_syscalls:
> -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
> +	tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
>  	goto out_error;
>  
>  out_error_mmap:
> -- 
> 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]


#1218844 — Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2015-09-04 13:40 +0200
SubjectRe: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Message-ID<q4Xvz-Oj-5@gated-at.bofh.it>
In reply to#1217397
On Wed, 02 Sep, at 09:56:35AM, Jiri Olsa wrote:
> Moving debugfs__strerror_open out of api/fs/debugfs.c,
> because it's not debugfs specific. It'll be changed to
> consider tracefs mount as well in following patches.
> 
> Renaming it into tracing_path__strerror_open_tp to fit
> into the namespace. No functional change is intended.
> 
> Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m759kv@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/lib/api/fs/debugfs.c      | 52 ---------------------------------------
>  tools/lib/api/fs/tracing_path.c | 54 +++++++++++++++++++++++++++++++++++++++++
>  tools/lib/api/fs/tracing_path.h |  3 +++
>  tools/perf/builtin-trace.c      |  5 ++--
>  4 files changed, 60 insertions(+), 54 deletions(-)

Reviewed-by: Matt Fleming <matt.fleming@intel.com>

-- 
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 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]


#1219034 — Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object

FromJiri Olsa <jolsa@redhat.com>
Date2015-09-04 15:50 +0200
SubjectRe: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Message-ID<q4Zxr-3Iu-69@gated-at.bofh.it>
In reply to#1217397
On Fri, Sep 04, 2015 at 09:41:59AM -0400, Raphaël Beamonte wrote:
> 2015-09-02 9:12 GMT-04:00 Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>:
> > Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu:
> > Humm, here I think that "_path" may look excessive... But tracing_path__ better
> > than debugfs__, so its progress, applying, if we get a better name, we
> > can change this later.
> >
> > - Arnaldo
> 
> I agree that "tracing_path" seems a bit heavy.
> Why not using tracefs here like for the previous changes?

it's not fs per say, it's 'combination,choice' of debugfs and tracefs
that provides 'path' for tracing ;-)

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 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]


#1219061 — Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object

FromRaphaël Beamonte <raphael.beamonte@gmail.com>
Date2015-09-04 16:00 +0200
SubjectRe: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
Message-ID<q4ZH5-3Ud-47@gated-at.bofh.it>
In reply to#1219034
2015-09-04 9:48 GMT-04:00 Jiri Olsa <jolsa@redhat.com>:
> it's not fs per say, it's 'combination,choice' of debugfs and tracefs
> that provides 'path' for tracing ;-)

Ok then! Makes sense :) Thanks

2015-09-02 3:56 GMT-04:00 Jiri Olsa <jolsa@kernel.org>:
> Moving debugfs__strerror_open out of api/fs/debugfs.c,
> because it's not debugfs specific. It'll be changed to
> consider tracefs mount as well in following patches.
>
> Renaming it into tracing_path__strerror_open_tp to fit
> into the namespace. No functional change is intended.
>
> Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m759kv@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/lib/api/fs/debugfs.c      | 52 ---------------------------------------
>  tools/lib/api/fs/tracing_path.c | 54 +++++++++++++++++++++++++++++++++++++++++
>  tools/lib/api/fs/tracing_path.h |  3 +++
>  tools/perf/builtin-trace.c      |  5 ++--
>  4 files changed, 60 insertions(+), 54 deletions(-)

Reviewed-by: Raphaël Beamonte <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]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | linux.kernel


csiph-web