linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH v3 11/17] perf: Remove 'perf' from subcmd function and variable names
Date: Sun, 13 Dec 2015 22:18:11 -0600	[thread overview]
Message-ID: <55df0c2ea9faa7d920c96fe9056f4d8319c846f9.1449965119.git.jpoimboe@redhat.com> (raw)
In-Reply-To: <cover.1449965119.git.jpoimboe@redhat.com>

In preparation for moving exec_cmd.c and run-command.c out of perf and
into a library, remove 'perf' from all the symbol names.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 tools/perf/builtin-help.c     |  2 +-
 tools/perf/builtin-script.c   |  8 ++++----
 tools/perf/perf.c             |  6 +++---
 tools/perf/tests/attr.c       |  2 +-
 tools/perf/util/exec_cmd.c    | 20 ++++++++++----------
 tools/perf/util/exec_cmd.h    | 12 ++++++------
 tools/perf/util/help.c        |  4 ++--
 tools/perf/util/run-command.c |  6 +++---
 tools/perf/util/run-command.h |  4 ++--
 9 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index a7d588b..275aa64 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -407,7 +407,7 @@ static int get_html_page_path(struct strbuf *page_path, const char *page)
 #ifndef open_html
 static void open_html(const char *path)
 {
-	execl_perf_cmd("web--browse", "-c", "help.browser", path, NULL);
+	execl_cmd("web--browse", "-c", "help.browser", path, NULL);
 }
 #endif
 
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d259e9a..571016f 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1408,7 +1408,7 @@ static int list_available_scripts(const struct option *opt __maybe_unused,
 	char first_half[BUFSIZ];
 	char *script_root;
 
-	snprintf(scripts_path, MAXPATHLEN, "%s/scripts", perf_exec_path());
+	snprintf(scripts_path, MAXPATHLEN, "%s/scripts", get_argv_exec_path());
 
 	scripts_dir = opendir(scripts_path);
 	if (!scripts_dir)
@@ -1529,7 +1529,7 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
 	if (!session)
 		return -1;
 
-	snprintf(scripts_path, MAXPATHLEN, "%s/scripts", perf_exec_path());
+	snprintf(scripts_path, MAXPATHLEN, "%s/scripts", get_argv_exec_path());
 
 	scripts_dir = opendir(scripts_path);
 	if (!scripts_dir) {
@@ -1587,7 +1587,7 @@ static char *get_script_path(const char *script_root, const char *suffix)
 	char lang_path[MAXPATHLEN];
 	char *__script_root;
 
-	snprintf(scripts_path, MAXPATHLEN, "%s/scripts", perf_exec_path());
+	snprintf(scripts_path, MAXPATHLEN, "%s/scripts", get_argv_exec_path());
 
 	scripts_dir = opendir(scripts_path);
 	if (!scripts_dir)
@@ -1823,7 +1823,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 		scripting_max_stack = itrace_synth_opts.callchain_sz;
 
 	/* make sure PERF_EXEC_PATH is set for scripts */
-	perf_set_argv_exec_path(perf_exec_path());
+	set_argv_exec_path(get_argv_exec_path());
 
 	if (argc && !script_name && !rec_script_path && !rep_script_path) {
 		int live_pipe[2];
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 4d94c80..c0fa9a5 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -183,9 +183,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 		if (!prefixcmp(cmd, CMD_EXEC_PATH)) {
 			cmd += strlen(CMD_EXEC_PATH);
 			if (*cmd == '=')
-				perf_set_argv_exec_path(cmd + 1);
+				set_argv_exec_path(cmd + 1);
 			else {
-				puts(perf_exec_path());
+				puts(get_argv_exec_path());
 				exit(0);
 			}
 		} else if (!strcmp(cmd, "--html-path")) {
@@ -539,7 +539,7 @@ int main(int argc, const char **argv)
 	page_size = sysconf(_SC_PAGE_SIZE);
 	cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
 
-	cmd = perf_extract_argv0_path(argv[0]);
+	cmd = extract_argv0_path(argv[0]);
 	if (!cmd)
 		cmd = "perf-help";
 
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index b66730e..6337f1c 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -164,7 +164,7 @@ int test__attr(int subtest __maybe_unused)
 		return run_dir("./tests", "./perf");
 
 	/* Then installed path. */
-	snprintf(path_dir,  PATH_MAX, "%s/tests", perf_exec_path());
+	snprintf(path_dir,  PATH_MAX, "%s/tests", get_argv_exec_path());
 	snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
 
 	if (!lstat(path_dir, &st) &&
diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
index 84f9dc5..1e8d31f 100644
--- a/tools/perf/util/exec_cmd.c
+++ b/tools/perf/util/exec_cmd.c
@@ -36,7 +36,7 @@ char *system_path(const char *path)
 	return (char *)path;
 }
 
-const char *perf_extract_argv0_path(const char *argv0)
+const char *extract_argv0_path(const char *argv0)
 {
 	const char *slash;
 
@@ -55,7 +55,7 @@ const char *perf_extract_argv0_path(const char *argv0)
 	return argv0;
 }
 
-void perf_set_argv_exec_path(const char *exec_path)
+void set_argv_exec_path(const char *exec_path)
 {
 	argv_exec_path = exec_path;
 	/*
@@ -65,8 +65,8 @@ void perf_set_argv_exec_path(const char *exec_path)
 }
 
 
-/* Returns the highest-priority, location to look for perf programs. */
-char *perf_exec_path(void)
+/* Returns the highest-priority location to look for subprograms. */
+char *get_argv_exec_path(void)
 {
 	char *env;
 
@@ -96,7 +96,7 @@ void setup_path(void)
 {
 	const char *old_path = getenv("PATH");
 	struct strbuf new_path = STRBUF_INIT;
-	char *tmp = perf_exec_path();
+	char *tmp = get_argv_exec_path();
 
 	add_path(&new_path, tmp);
 	add_path(&new_path, argv0_path);
@@ -112,7 +112,7 @@ void setup_path(void)
 	strbuf_release(&new_path);
 }
 
-static const char **prepare_perf_cmd(const char **argv)
+static const char **prepare_exec_cmd(const char **argv)
 {
 	int argc;
 	const char **nargv;
@@ -128,8 +128,8 @@ static const char **prepare_perf_cmd(const char **argv)
 	return nargv;
 }
 
-int execv_perf_cmd(const char **argv) {
-	const char **nargv = prepare_perf_cmd(argv);
+int execv_cmd(const char **argv) {
+	const char **nargv = prepare_exec_cmd(argv);
 
 	/* execvp() can only ever return if it fails */
 	execvp(cfg_exec_name, (char **)nargv);
@@ -139,7 +139,7 @@ int execv_perf_cmd(const char **argv) {
 }
 
 
-int execl_perf_cmd(const char *cmd,...)
+int execl_cmd(const char *cmd,...)
 {
 	int argc;
 	const char *argv[MAX_ARGS + 1];
@@ -159,5 +159,5 @@ int execl_perf_cmd(const char *cmd,...)
 		return error("too many args to run %s", cmd);
 
 	argv[argc] = NULL;
-	return execv_perf_cmd(argv);
+	return execv_cmd(argv);
 }
diff --git a/tools/perf/util/exec_cmd.h b/tools/perf/util/exec_cmd.h
index fd4434e..f1bd343 100644
--- a/tools/perf/util/exec_cmd.h
+++ b/tools/perf/util/exec_cmd.h
@@ -4,13 +4,13 @@
 extern void exec_cmd_init(const char *exec_name, const char *prefix,
 			  const char *exec_path, const char *exec_path_env);
 
-extern void perf_set_argv_exec_path(const char *exec_path);
-extern const char *perf_extract_argv0_path(const char *path);
+extern void set_argv_exec_path(const char *exec_path);
+extern const char *extract_argv0_path(const char *path);
 extern void setup_path(void);
-extern int execv_perf_cmd(const char **argv); /* NULL terminated */
-extern int execl_perf_cmd(const char *cmd, ...);
-/* perf_exec_path and system_path return malloc'd string, caller must free it */
-extern char *perf_exec_path(void);
+extern int execv_cmd(const char **argv); /* NULL terminated */
+extern int execl_cmd(const char *cmd, ...);
+/* get_argv_exec_path and system_path return malloc'd string, caller must free it */
+extern char *get_argv_exec_path(void);
 extern char *system_path(const char *path);
 
 #endif /* __PERF_EXEC_CMD_H */
diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c
index 8d74f7d..89fc81b 100644
--- a/tools/perf/util/help.c
+++ b/tools/perf/util/help.c
@@ -157,7 +157,7 @@ void load_command_list(const char *prefix,
 		struct cmdnames *other_cmds)
 {
 	const char *env_path = getenv("PATH");
-	char *exec_path = perf_exec_path();
+	char *exec_path = get_argv_exec_path();
 
 	if (exec_path) {
 		list_commands_in_dir(main_cmds, exec_path, prefix);
@@ -202,7 +202,7 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
 			longest = other_cmds->names[i]->len;
 
 	if (main_cmds->cnt) {
-		char *exec_path = perf_exec_path();
+		char *exec_path = get_argv_exec_path();
 		printf("available %s in '%s'\n", title, exec_path);
 		printf("----------------");
 		mput_char('-', strlen(title) + strlen(exec_path));
diff --git a/tools/perf/util/run-command.c b/tools/perf/util/run-command.c
index 34622b5..910c0f6 100644
--- a/tools/perf/util/run-command.c
+++ b/tools/perf/util/run-command.c
@@ -112,8 +112,8 @@ int start_command(struct child_process *cmd)
 		}
 		if (cmd->preexec_cb)
 			cmd->preexec_cb();
-		if (cmd->perf_cmd) {
-			execv_perf_cmd(cmd->argv);
+		if (cmd->exec_cmd) {
+			execv_cmd(cmd->argv);
 		} else {
 			execvp(cmd->argv[0], (char *const*) cmd->argv);
 		}
@@ -207,7 +207,7 @@ static void prepare_run_command_v_opt(struct child_process *cmd,
 	memset(cmd, 0, sizeof(*cmd));
 	cmd->argv = argv;
 	cmd->no_stdin = opt & RUN_COMMAND_NO_STDIN ? 1 : 0;
-	cmd->perf_cmd = opt & RUN_PERF_CMD ? 1 : 0;
+	cmd->exec_cmd = opt & RUN_EXEC_CMD ? 1 : 0;
 	cmd->stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0;
 }
 
diff --git a/tools/perf/util/run-command.h b/tools/perf/util/run-command.h
index 1ef264d..cf7d655 100644
--- a/tools/perf/util/run-command.h
+++ b/tools/perf/util/run-command.h
@@ -41,7 +41,7 @@ struct child_process {
 	unsigned no_stdin:1;
 	unsigned no_stdout:1;
 	unsigned no_stderr:1;
-	unsigned perf_cmd:1; /* if this is to be perf sub-command */
+	unsigned exec_cmd:1; /* if this is to be external sub-command */
 	unsigned stdout_to_stderr:1;
 	void (*preexec_cb)(void);
 };
@@ -51,7 +51,7 @@ int finish_command(struct child_process *);
 int run_command(struct child_process *);
 
 #define RUN_COMMAND_NO_STDIN 1
-#define RUN_PERF_CMD	     2	/*If this is to be perf sub-command */
+#define RUN_EXEC_CMD	     2	/*If this is to be external sub-command */
 #define RUN_COMMAND_STDOUT_TO_STDERR 4
 int run_command_v_opt(const char **argv, int opt);
 
-- 
2.4.3


  parent reply	other threads:[~2015-12-14  4:22 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14  4:18 [PATCH v3 00/17] perf tools: Move perf subcommand framework to a library Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 01/17] perf build: Remove unnecessary line in Makefile.feature Josh Poimboeuf
2015-12-14 10:05   ` Jiri Olsa
2015-12-14 15:16     ` Arnaldo Carvalho de Melo
2015-12-18  8:47   ` [tip:perf/core] " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 02/17] tools build: Fix feature Makefile dependencies for 'O=' Josh Poimboeuf
2015-12-14 10:08   ` Jiri Olsa
2015-12-14 14:02     ` Josh Poimboeuf
2015-12-14 14:29       ` [PATCH v3.1 " Josh Poimboeuf
2015-12-14 15:16         ` Arnaldo Carvalho de Melo
2015-12-14 15:29         ` Jiri Olsa
2015-12-14 15:38           ` Josh Poimboeuf
2015-12-14 15:55             ` Jiri Olsa
2015-12-14 16:03               ` Josh Poimboeuf
2015-12-14 18:32               ` [PATCH v3.2] tools build: Fix feature Makefile issues with 'O=' Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 03/17] perf test: Add Build file to dependencies for llvm-src-*.c Josh Poimboeuf
2015-12-14 10:10   ` Jiri Olsa
2015-12-14 15:17     ` Arnaldo Carvalho de Melo
2015-12-18  8:47   ` [tip:perf/core] " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 04/17] perf test: remove tarpkg at end of test Josh Poimboeuf
2015-12-18  8:48   ` [tip:perf/core] perf test: Remove " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 05/17] perf build: Fix 'make clean' Josh Poimboeuf
2015-12-14 10:14   ` Jiri Olsa
2015-12-14 15:18     ` Arnaldo Carvalho de Melo
2015-12-18  8:48   ` [tip:perf/core] " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 06/17] perf build: Rename LIB_PATH -> API_PATH Josh Poimboeuf
2015-12-14 10:34   ` Jiri Olsa
2015-12-14 15:19     ` Arnaldo Carvalho de Melo
2015-12-18  8:49   ` [tip:perf/core] " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 07/17] perf: Create pager.h Josh Poimboeuf
2015-12-18  8:49   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 08/17] perf: Remove check for unused PERF_PAGER_IN_USE Josh Poimboeuf
2015-12-18  8:49   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 09/17] perf: Move help_unknown_cmd() to its own file Josh Poimboeuf
2015-12-18  8:50   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 10/17] perf: Provide subcmd configuration at runtime Josh Poimboeuf
2015-12-14 10:33   ` Jiri Olsa
2015-12-14 14:06     ` Josh Poimboeuf
2015-12-14  4:18 ` Josh Poimboeuf [this message]
2015-12-14  4:18 ` [PATCH v3 12/17] perf: Convert parse-options.c internal functions to static Josh Poimboeuf
2015-12-18  8:50   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 13/17] perf: Document the fact that parse_options*() may exit Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 14/17] perf: Remove subcmd dependencies on strbuf Josh Poimboeuf
2015-12-14 10:25   ` Jiri Olsa
2015-12-14 14:11     ` Josh Poimboeuf
2015-12-14 15:44   ` Arnaldo Carvalho de Melo
2015-12-14 16:05     ` Josh Poimboeuf
2015-12-14 17:50       ` Arnaldo Carvalho de Melo
2015-12-14 18:04         ` Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 15/17] perf: Finalize subcmd independence Josh Poimboeuf
2015-12-14 10:32   ` Jiri Olsa
2015-12-14 14:13     ` Josh Poimboeuf
2015-12-14 15:27       ` Jiri Olsa
2015-12-14 15:51       ` Arnaldo Carvalho de Melo
2015-12-14  4:18 ` [PATCH v3 16/17] perf subcmd: Create subcmd library Josh Poimboeuf
2015-12-14  4:18 ` [PATCH v3 17/17] tools subcmd: Rename subcmd header include guards Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55df0c2ea9faa7d920c96fe9056f4d8319c846f9.1449965119.git.jpoimboe@redhat.com \
    --to=jpoimboe@redhat.com \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).