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


Groups > linux.kernel > #1217399

[PATCH 03/15] perf tools: Move tracing_path stuff under same namespace

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 03/15] perf tools: Move tracing_path stuff under same namespace
Date 2015-09-02 10:10 +0200
Message-ID <q4bhg-7FS-17@gated-at.bofh.it> (permalink)
References <q4b7z-7ff-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Renaming all functions touching tracing_path under same
namespace. New interface is:

  char tracing_path[];
  - tracing mount path

  char tracing_events_path[];
  - tracing mount/events path

  void tracing_path_set(const char *mountpoint);
  - setting directly tracing_path(_events), used by --debugfs-dir option

  const char *tracing_path_mount(void);
  - initial setup of tracing_(events)_path, called from perf.c
    mounts debugfs/tracefs if needed and possible

  char *get_tracing_file(const char *name);
  void put_tracing_file(char *file);
  - get/put tracing file path

Link: http://lkml.kernel.org/n/tip-miy6kftxxryjf40b3qb6eknc@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/perf.c      | 10 ++++++----
 tools/perf/util/util.c | 20 ++++++++++----------
 tools/perf/util/util.h |  4 ++--
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index f500a4b40722..0e99cd1de9dd 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -214,7 +214,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 				fprintf(stderr, "No directory given for --debugfs-dir.\n");
 				usage(perf_usage_string);
 			}
-			perf_debugfs_set_path((*argv)[1]);
+			tracing_path_set((*argv)[1]);
 			if (envchanged)
 				*envchanged = 1;
 			(*argv)++;
@@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			(*argv)++;
 			(*argc)--;
 		} else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
-			perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR));
+			tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
 			fprintf(stderr, "dir: %s\n", tracing_path);
 			if (envchanged)
 				*envchanged = 1;
@@ -517,8 +517,10 @@ int main(int argc, const char **argv)
 	cmd = perf_extract_argv0_path(argv[0]);
 	if (!cmd)
 		cmd = "perf-help";
-	/* get debugfs mount point from /proc/mounts */
-	perf_debugfs_mount();
+
+	/* get debugfs/tracefs mount point from /proc/mounts */
+	tracing_path_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 74f71f8afcc2..b959f783f6cd 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -390,7 +390,7 @@ void set_term_quiet_input(struct termios *old)
 	tcsetattr(0, TCSANOW, &tc);
 }
 
-static void set_tracing_events_path(const char *tracing, const char *mountpoint)
+static void __tracing_path_set(const char *tracing, const char *mountpoint)
 {
 	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
 		 mountpoint, tracing);
@@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
 		 mountpoint, tracing, "events");
 }
 
-static const char *__perf_tracefs_mount(void)
+static const char *tracing_path_tracefs_mount(void)
 {
 	const char *mnt;
 
@@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(void)
 	if (!mnt)
 		return NULL;
 
-	set_tracing_events_path("", mnt);
+	__tracing_path_set("", mnt);
 
 	return mnt;
 }
 
-static const char *__perf_debugfs_mount(void)
+static const char *tracing_path_debugfs_mount(void)
 {
 	const char *mnt;
 
@@ -419,27 +419,27 @@ static const char *__perf_debugfs_mount(void)
 	if (!mnt)
 		return NULL;
 
-	set_tracing_events_path("tracing/", mnt);
+	__tracing_path_set("tracing/", mnt);
 
 	return mnt;
 }
 
-const char *perf_debugfs_mount(void)
+const char *tracing_path_mount(void)
 {
 	const char *mnt;
 
-	mnt = __perf_tracefs_mount();
+	mnt = tracing_path_tracefs_mount();
 	if (mnt)
 		return mnt;
 
-	mnt = __perf_debugfs_mount();
+	mnt = tracing_path_debugfs_mount();
 
 	return mnt;
 }
 
-void perf_debugfs_set_path(const char *mntpt)
+void tracing_path_set(const char *mntpt)
 {
-	set_tracing_events_path("tracing/", mntpt);
+	__tracing_path_set("tracing/", mntpt);
 }
 
 char *get_tracing_file(const char *name)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 184d40048faa..230c4124bfa7 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -85,8 +85,8 @@ extern const char *graph_dotted_line;
 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(void);
+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);
 
-- 
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/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[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

csiph-web