aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2015-12-15 10:39:37 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-12-16 19:34:28 -0500
commit46113a54be53aea50a4f5926b87e86e2e66c4266 (patch)
tree950a873f47d9b2487d0a6fd61e002875acab8b88
parent901421a5bdf605d24c278825cdd032cd6038bcb8 (diff)
perf tools: Remove 'perf' from subcmd function and variable names
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> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/bc3ee82b40b8f396b644fa49e0f7260ce442635b.1450193761.git.jpoimboe@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-help.c2
-rw-r--r--tools/perf/builtin-script.c8
-rw-r--r--tools/perf/perf.c6
-rw-r--r--tools/perf/tests/attr.c2
-rw-r--r--tools/perf/util/exec_cmd.c20
-rw-r--r--tools/perf/util/exec_cmd.h12
-rw-r--r--tools/perf/util/help.c4
-rw-r--r--tools/perf/util/run-command.c6
-rw-r--r--tools/perf/util/run-command.h4
9 files changed, 32 insertions, 32 deletions
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index a7d588bf3cdd..275aa641c31c 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)
407#ifndef open_html 407#ifndef open_html
408static void open_html(const char *path) 408static void open_html(const char *path)
409{ 409{
410 execl_perf_cmd("web--browse", "-c", "help.browser", path, NULL); 410 execl_cmd("web--browse", "-c", "help.browser", path, NULL);
411} 411}
412#endif 412#endif
413 413
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d259e9aa3a71..571016f16c5a 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,
1408 char first_half[BUFSIZ]; 1408 char first_half[BUFSIZ];
1409 char *script_root; 1409 char *script_root;
1410 1410
1411 snprintf(scripts_path, MAXPATHLEN, "%s/scripts", perf_exec_path()); 1411 snprintf(scripts_path, MAXPATHLEN, "%s/scripts", get_argv_exec_path());
1412 1412
1413 scripts_dir = opendir(scripts_path); 1413 scripts_dir = opendir(scripts_path);
1414 if (!scripts_dir) 1414 if (!scripts_dir)
@@ -1529,7 +1529,7 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
1529 if (!session) 1529 if (!session)
1530 return -1; 1530 return -1;
1531 1531
1532 snprintf(scripts_path, MAXPATHLEN, "%s/scripts", perf_exec_path()); 1532 snprintf(scripts_path, MAXPATHLEN, "%s/scripts", get_argv_exec_path());
1533 1533
1534 scripts_dir = opendir(scripts_path); 1534 scripts_dir = opendir(scripts_path);
1535 if (!scripts_dir) { 1535 if (!scripts_dir) {
@@ -1587,7 +1587,7 @@ static char *get_script_path(const char *script_root, const char *suffix)
1587 char lang_path[MAXPATHLEN]; 1587 char lang_path[MAXPATHLEN];
1588 char *__script_root; 1588 char *__script_root;
1589 1589
1590 snprintf(scripts_path, MAXPATHLEN, "%s/scripts", perf_exec_path()); 1590 snprintf(scripts_path, MAXPATHLEN, "%s/scripts", get_argv_exec_path());
1591 1591
1592 scripts_dir = opendir(scripts_path); 1592 scripts_dir = opendir(scripts_path);
1593 if (!scripts_dir) 1593 if (!scripts_dir)
@@ -1823,7 +1823,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
1823 scripting_max_stack = itrace_synth_opts.callchain_sz; 1823 scripting_max_stack = itrace_synth_opts.callchain_sz;
1824 1824
1825 /* make sure PERF_EXEC_PATH is set for scripts */ 1825 /* make sure PERF_EXEC_PATH is set for scripts */
1826 perf_set_argv_exec_path(perf_exec_path()); 1826 set_argv_exec_path(get_argv_exec_path());
1827 1827
1828 if (argc && !script_name && !rec_script_path && !rep_script_path) { 1828 if (argc && !script_name && !rec_script_path && !rep_script_path) {
1829 int live_pipe[2]; 1829 int live_pipe[2];
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 783a3310a9d8..6894325fe921 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)
183 if (!prefixcmp(cmd, CMD_EXEC_PATH)) { 183 if (!prefixcmp(cmd, CMD_EXEC_PATH)) {
184 cmd += strlen(CMD_EXEC_PATH); 184 cmd += strlen(CMD_EXEC_PATH);
185 if (*cmd == '=') 185 if (*cmd == '=')
186 perf_set_argv_exec_path(cmd + 1); 186 set_argv_exec_path(cmd + 1);
187 else { 187 else {
188 puts(perf_exec_path()); 188 puts(get_argv_exec_path());
189 exit(0); 189 exit(0);
190 } 190 }
191 } else if (!strcmp(cmd, "--html-path")) { 191 } else if (!strcmp(cmd, "--html-path")) {
@@ -538,7 +538,7 @@ int main(int argc, const char **argv)
538 page_size = sysconf(_SC_PAGE_SIZE); 538 page_size = sysconf(_SC_PAGE_SIZE);
539 cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); 539 cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
540 540
541 cmd = perf_extract_argv0_path(argv[0]); 541 cmd = extract_argv0_path(argv[0]);
542 if (!cmd) 542 if (!cmd)
543 cmd = "perf-help"; 543 cmd = "perf-help";
544 544
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index b66730eb94e3..6337f1c07f02 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -164,7 +164,7 @@ int test__attr(int subtest __maybe_unused)
164 return run_dir("./tests", "./perf"); 164 return run_dir("./tests", "./perf");
165 165
166 /* Then installed path. */ 166 /* Then installed path. */
167 snprintf(path_dir, PATH_MAX, "%s/tests", perf_exec_path()); 167 snprintf(path_dir, PATH_MAX, "%s/tests", get_argv_exec_path());
168 snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR); 168 snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
169 169
170 if (!lstat(path_dir, &st) && 170 if (!lstat(path_dir, &st) &&
diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
index 65d86dcaa984..701111ac7699 100644
--- a/tools/perf/util/exec_cmd.c
+++ b/tools/perf/util/exec_cmd.c
@@ -32,7 +32,7 @@ char *system_path(const char *path)
32 return buf; 32 return buf;
33} 33}
34 34
35const char *perf_extract_argv0_path(const char *argv0) 35const char *extract_argv0_path(const char *argv0)
36{ 36{
37 const char *slash; 37 const char *slash;
38 38
@@ -51,7 +51,7 @@ const char *perf_extract_argv0_path(const char *argv0)
51 return argv0; 51 return argv0;
52} 52}
53 53
54void perf_set_argv_exec_path(const char *exec_path) 54void set_argv_exec_path(const char *exec_path)
55{ 55{
56 argv_exec_path = exec_path; 56 argv_exec_path = exec_path;
57 /* 57 /*
@@ -61,8 +61,8 @@ void perf_set_argv_exec_path(const char *exec_path)
61} 61}
62 62
63 63
64/* Returns the highest-priority, location to look for perf programs. */ 64/* Returns the highest-priority location to look for subprograms. */
65char *perf_exec_path(void) 65char *get_argv_exec_path(void)
66{ 66{
67 char *env; 67 char *env;
68 68
@@ -92,7 +92,7 @@ void setup_path(void)
92{ 92{
93 const char *old_path = getenv("PATH"); 93 const char *old_path = getenv("PATH");
94 char *new_path = NULL; 94 char *new_path = NULL;
95 char *tmp = perf_exec_path(); 95 char *tmp = get_argv_exec_path();
96 96
97 add_path(&new_path, tmp); 97 add_path(&new_path, tmp);
98 add_path(&new_path, argv0_path); 98 add_path(&new_path, argv0_path);
@@ -108,7 +108,7 @@ void setup_path(void)
108 free(new_path); 108 free(new_path);
109} 109}
110 110
111static const char **prepare_perf_cmd(const char **argv) 111static const char **prepare_exec_cmd(const char **argv)
112{ 112{
113 int argc; 113 int argc;
114 const char **nargv; 114 const char **nargv;
@@ -124,8 +124,8 @@ static const char **prepare_perf_cmd(const char **argv)
124 return nargv; 124 return nargv;
125} 125}
126 126
127int execv_perf_cmd(const char **argv) { 127int execv_cmd(const char **argv) {
128 const char **nargv = prepare_perf_cmd(argv); 128 const char **nargv = prepare_exec_cmd(argv);
129 129
130 /* execvp() can only ever return if it fails */ 130 /* execvp() can only ever return if it fails */
131 execvp(subcmd_config.exec_name, (char **)nargv); 131 execvp(subcmd_config.exec_name, (char **)nargv);
@@ -135,7 +135,7 @@ int execv_perf_cmd(const char **argv) {
135} 135}
136 136
137 137
138int execl_perf_cmd(const char *cmd,...) 138int execl_cmd(const char *cmd,...)
139{ 139{
140 int argc; 140 int argc;
141 const char *argv[MAX_ARGS + 1]; 141 const char *argv[MAX_ARGS + 1];
@@ -155,5 +155,5 @@ int execl_perf_cmd(const char *cmd,...)
155 return error("too many args to run %s", cmd); 155 return error("too many args to run %s", cmd);
156 156
157 argv[argc] = NULL; 157 argv[argc] = NULL;
158 return execv_perf_cmd(argv); 158 return execv_cmd(argv);
159} 159}
diff --git a/tools/perf/util/exec_cmd.h b/tools/perf/util/exec_cmd.h
index fd4434e48d21..f1bd3436ad5f 100644
--- a/tools/perf/util/exec_cmd.h
+++ b/tools/perf/util/exec_cmd.h
@@ -4,13 +4,13 @@
4extern void exec_cmd_init(const char *exec_name, const char *prefix, 4extern void exec_cmd_init(const char *exec_name, const char *prefix,
5 const char *exec_path, const char *exec_path_env); 5 const char *exec_path, const char *exec_path_env);
6 6
7extern void perf_set_argv_exec_path(const char *exec_path); 7extern void set_argv_exec_path(const char *exec_path);
8extern const char *perf_extract_argv0_path(const char *path); 8extern const char *extract_argv0_path(const char *path);
9extern void setup_path(void); 9extern void setup_path(void);
10extern int execv_perf_cmd(const char **argv); /* NULL terminated */ 10extern int execv_cmd(const char **argv); /* NULL terminated */
11extern int execl_perf_cmd(const char *cmd, ...); 11extern int execl_cmd(const char *cmd, ...);
12/* perf_exec_path and system_path return malloc'd string, caller must free it */ 12/* get_argv_exec_path and system_path return malloc'd string, caller must free it */
13extern char *perf_exec_path(void); 13extern char *get_argv_exec_path(void);
14extern char *system_path(const char *path); 14extern char *system_path(const char *path);
15 15
16#endif /* __PERF_EXEC_CMD_H */ 16#endif /* __PERF_EXEC_CMD_H */
diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c
index 8e5e0ce3870e..303a347ee234 100644
--- a/tools/perf/util/help.c
+++ b/tools/perf/util/help.c
@@ -155,7 +155,7 @@ void load_command_list(const char *prefix,
155 struct cmdnames *other_cmds) 155 struct cmdnames *other_cmds)
156{ 156{
157 const char *env_path = getenv("PATH"); 157 const char *env_path = getenv("PATH");
158 char *exec_path = perf_exec_path(); 158 char *exec_path = get_argv_exec_path();
159 159
160 if (exec_path) { 160 if (exec_path) {
161 list_commands_in_dir(main_cmds, exec_path, prefix); 161 list_commands_in_dir(main_cmds, exec_path, prefix);
@@ -200,7 +200,7 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
200 longest = other_cmds->names[i]->len; 200 longest = other_cmds->names[i]->len;
201 201
202 if (main_cmds->cnt) { 202 if (main_cmds->cnt) {
203 char *exec_path = perf_exec_path(); 203 char *exec_path = get_argv_exec_path();
204 printf("available %s in '%s'\n", title, exec_path); 204 printf("available %s in '%s'\n", title, exec_path);
205 printf("----------------"); 205 printf("----------------");
206 mput_char('-', strlen(title) + strlen(exec_path)); 206 mput_char('-', strlen(title) + strlen(exec_path));
diff --git a/tools/perf/util/run-command.c b/tools/perf/util/run-command.c
index 34622b53e733..910c0f6479f4 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)
112 } 112 }
113 if (cmd->preexec_cb) 113 if (cmd->preexec_cb)
114 cmd->preexec_cb(); 114 cmd->preexec_cb();
115 if (cmd->perf_cmd) { 115 if (cmd->exec_cmd) {
116 execv_perf_cmd(cmd->argv); 116 execv_cmd(cmd->argv);
117 } else { 117 } else {
118 execvp(cmd->argv[0], (char *const*) cmd->argv); 118 execvp(cmd->argv[0], (char *const*) cmd->argv);
119 } 119 }
@@ -207,7 +207,7 @@ static void prepare_run_command_v_opt(struct child_process *cmd,
207 memset(cmd, 0, sizeof(*cmd)); 207 memset(cmd, 0, sizeof(*cmd));
208 cmd->argv = argv; 208 cmd->argv = argv;
209 cmd->no_stdin = opt & RUN_COMMAND_NO_STDIN ? 1 : 0; 209 cmd->no_stdin = opt & RUN_COMMAND_NO_STDIN ? 1 : 0;
210 cmd->perf_cmd = opt & RUN_PERF_CMD ? 1 : 0; 210 cmd->exec_cmd = opt & RUN_EXEC_CMD ? 1 : 0;
211 cmd->stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0; 211 cmd->stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0;
212} 212}
213 213
diff --git a/tools/perf/util/run-command.h b/tools/perf/util/run-command.h
index 1ef264d5069c..cf7d655ee2a3 100644
--- a/tools/perf/util/run-command.h
+++ b/tools/perf/util/run-command.h
@@ -41,7 +41,7 @@ struct child_process {
41 unsigned no_stdin:1; 41 unsigned no_stdin:1;
42 unsigned no_stdout:1; 42 unsigned no_stdout:1;
43 unsigned no_stderr:1; 43 unsigned no_stderr:1;
44 unsigned perf_cmd:1; /* if this is to be perf sub-command */ 44 unsigned exec_cmd:1; /* if this is to be external sub-command */
45 unsigned stdout_to_stderr:1; 45 unsigned stdout_to_stderr:1;
46 void (*preexec_cb)(void); 46 void (*preexec_cb)(void);
47}; 47};
@@ -51,7 +51,7 @@ int finish_command(struct child_process *);
51int run_command(struct child_process *); 51int run_command(struct child_process *);
52 52
53#define RUN_COMMAND_NO_STDIN 1 53#define RUN_COMMAND_NO_STDIN 1
54#define RUN_PERF_CMD 2 /*If this is to be perf sub-command */ 54#define RUN_EXEC_CMD 2 /*If this is to be external sub-command */
55#define RUN_COMMAND_STDOUT_TO_STDERR 4 55#define RUN_COMMAND_STDOUT_TO_STDERR 4
56int run_command_v_opt(const char **argv, int opt); 56int run_command_v_opt(const char **argv, int opt);
57 57