aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-05-17 15:22:41 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-17 15:22:41 -0400
commitedb7c60e27c1baff38d82440dc52eaffac9a45f4 (patch)
treefc49d1f862fd5f1393c8b6245d571d97b208d91a /tools
parent8035458fbb567ae138c77a5f710050107c6a7066 (diff)
perf options: Type check all the remaining OPT_ variants
OPT_SET_INT was renamed to OPT_SET_UINT since the only use in these tools is to set something that has an enum type, that is builtin compatible with unsigned int. Several string constifications were done to make OPT_STRING require a const char * type. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-bench.c4
-rw-r--r--tools/perf/builtin-help.c6
-rw-r--r--tools/perf/builtin-kvm.c2
-rw-r--r--tools/perf/builtin-report.c4
-rw-r--r--tools/perf/builtin-sched.c2
-rw-r--r--tools/perf/builtin-top.c2
-rw-r--r--tools/perf/util/hist.c2
-rw-r--r--tools/perf/util/parse-options.c10
-rw-r--r--tools/perf/util/parse-options.h16
-rw-r--r--tools/perf/util/sort.c8
-rw-r--r--tools/perf/util/sort.h8
-rw-r--r--tools/perf/util/symbol.h2
12 files changed, 33 insertions, 33 deletions
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index 46996774e559..fcb96269852a 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -95,7 +95,7 @@ static void dump_suites(int subsys_index)
95 return; 95 return;
96} 96}
97 97
98static char *bench_format_str; 98static const char *bench_format_str;
99int bench_format = BENCH_FORMAT_DEFAULT; 99int bench_format = BENCH_FORMAT_DEFAULT;
100 100
101static const struct option bench_options[] = { 101static const struct option bench_options[] = {
@@ -126,7 +126,7 @@ static void print_usage(void)
126 printf("\n"); 126 printf("\n");
127} 127}
128 128
129static int bench_str2int(char *str) 129static int bench_str2int(const char *str)
130{ 130{
131 if (!str) 131 if (!str)
132 return BENCH_FORMAT_DEFAULT; 132 return BENCH_FORMAT_DEFAULT;
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 81e3ecc40fc7..6d5a8a7faf48 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -33,10 +33,10 @@ static bool show_all = false;
33static enum help_format help_format = HELP_FORMAT_MAN; 33static enum help_format help_format = HELP_FORMAT_MAN;
34static struct option builtin_help_options[] = { 34static struct option builtin_help_options[] = {
35 OPT_BOOLEAN('a', "all", &show_all, "print all available commands"), 35 OPT_BOOLEAN('a', "all", &show_all, "print all available commands"),
36 OPT_SET_INT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN), 36 OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN),
37 OPT_SET_INT('w', "web", &help_format, "show manual in web browser", 37 OPT_SET_UINT('w', "web", &help_format, "show manual in web browser",
38 HELP_FORMAT_WEB), 38 HELP_FORMAT_WEB),
39 OPT_SET_INT('i', "info", &help_format, "show info page", 39 OPT_SET_UINT('i', "info", &help_format, "show info page",
40 HELP_FORMAT_INFO), 40 HELP_FORMAT_INFO),
41 OPT_END(), 41 OPT_END(),
42}; 42};
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index b1c6b38567f0..34d1e853829d 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -19,7 +19,7 @@
19#include <pthread.h> 19#include <pthread.h>
20#include <math.h> 20#include <math.h>
21 21
22static char *file_name; 22static const char *file_name;
23static char name_buffer[256]; 23static char name_buffer[256];
24 24
25bool perf_host = 1; 25bool perf_host = 1;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 68265120ee07..1d3c1003b43a 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -39,8 +39,8 @@ static bool dont_use_callchains;
39static bool show_threads; 39static bool show_threads;
40static struct perf_read_values show_threads_values; 40static struct perf_read_values show_threads_values;
41 41
42static char default_pretty_printing_style[] = "normal"; 42static const char default_pretty_printing_style[] = "normal";
43static char *pretty_printing_style = default_pretty_printing_style; 43static const char *pretty_printing_style = default_pretty_printing_style;
44 44
45static char callchain_default_opt[] = "fractal,0.5"; 45static char callchain_default_opt[] = "fractal,0.5";
46 46
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c80acdf927a7..f67bce2a83b4 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -22,7 +22,7 @@
22static char const *input_name = "perf.data"; 22static char const *input_name = "perf.data";
23 23
24static char default_sort_order[] = "avg, max, switch, runtime"; 24static char default_sort_order[] = "avg, max, switch, runtime";
25static char *sort_order = default_sort_order; 25static const char *sort_order = default_sort_order;
26 26
27static int profile_cpu = -1; 27static int profile_cpu = -1;
28 28
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 9f0cfa0108a6..397290a0a76e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -96,7 +96,7 @@ struct source_line {
96 struct source_line *next; 96 struct source_line *next;
97}; 97};
98 98
99static char *sym_filter = NULL; 99static const char *sym_filter = NULL;
100struct sym_entry *sym_filter_entry = NULL; 100struct sym_entry *sym_filter_entry = NULL;
101struct sym_entry *sym_filter_entry_sched = NULL; 101struct sym_entry *sym_filter_entry_sched = NULL;
102static int sym_pcnt_filter = 5; 102static int sym_pcnt_filter = 5;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index f75c5f62401c..9a71c94f057a 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -662,7 +662,7 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
662 long displacement = 0; 662 long displacement = 0;
663 unsigned int width; 663 unsigned int width;
664 const char *sep = symbol_conf.field_sep; 664 const char *sep = symbol_conf.field_sep;
665 char *col_width = symbol_conf.col_width_list_str; 665 const char *col_width = symbol_conf.col_width_list_str;
666 666
667 init_rem_hits(); 667 init_rem_hits();
668 668
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 36d955e49422..99d02aa57dbf 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -51,7 +51,7 @@ static int get_value(struct parse_opt_ctx_t *p,
51 case OPTION_BOOLEAN: 51 case OPTION_BOOLEAN:
52 case OPTION_INCR: 52 case OPTION_INCR:
53 case OPTION_BIT: 53 case OPTION_BIT:
54 case OPTION_SET_INT: 54 case OPTION_SET_UINT:
55 case OPTION_SET_PTR: 55 case OPTION_SET_PTR:
56 return opterror(opt, "takes no value", flags); 56 return opterror(opt, "takes no value", flags);
57 case OPTION_END: 57 case OPTION_END:
@@ -83,8 +83,8 @@ static int get_value(struct parse_opt_ctx_t *p,
83 *(int *)opt->value = unset ? 0 : *(int *)opt->value + 1; 83 *(int *)opt->value = unset ? 0 : *(int *)opt->value + 1;
84 return 0; 84 return 0;
85 85
86 case OPTION_SET_INT: 86 case OPTION_SET_UINT:
87 *(int *)opt->value = unset ? 0 : opt->defval; 87 *(unsigned int *)opt->value = unset ? 0 : opt->defval;
88 return 0; 88 return 0;
89 89
90 case OPTION_SET_PTR: 90 case OPTION_SET_PTR:
@@ -515,13 +515,13 @@ int usage_with_options_internal(const char * const *usagestr,
515 pos += fprintf(stderr, " ..."); 515 pos += fprintf(stderr, " ...");
516 } 516 }
517 break; 517 break;
518 default: /* OPTION_{BIT,BOOLEAN,SET_INT,SET_PTR} */ 518 default: /* OPTION_{BIT,BOOLEAN,SET_UINT,SET_PTR} */
519 case OPTION_END: 519 case OPTION_END:
520 case OPTION_GROUP: 520 case OPTION_GROUP:
521 case OPTION_BIT: 521 case OPTION_BIT:
522 case OPTION_BOOLEAN: 522 case OPTION_BOOLEAN:
523 case OPTION_INCR: 523 case OPTION_INCR:
524 case OPTION_SET_INT: 524 case OPTION_SET_UINT:
525 case OPTION_SET_PTR: 525 case OPTION_SET_PTR:
526 break; 526 break;
527 } 527 }
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
index 5838e2d8bbc1..c7d72dce54b2 100644
--- a/tools/perf/util/parse-options.h
+++ b/tools/perf/util/parse-options.h
@@ -13,7 +13,7 @@ enum parse_opt_type {
13 OPTION_BIT, 13 OPTION_BIT,
14 OPTION_BOOLEAN, 14 OPTION_BOOLEAN,
15 OPTION_INCR, 15 OPTION_INCR,
16 OPTION_SET_INT, 16 OPTION_SET_UINT,
17 OPTION_SET_PTR, 17 OPTION_SET_PTR,
18 /* options with arguments (usually) */ 18 /* options with arguments (usually) */
19 OPTION_STRING, 19 OPTION_STRING,
@@ -79,7 +79,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
79 * 79 *
80 * `defval`:: 80 * `defval`::
81 * default value to fill (*->value) with for PARSE_OPT_OPTARG. 81 * default value to fill (*->value) with for PARSE_OPT_OPTARG.
82 * OPTION_{BIT,SET_INT,SET_PTR} store the {mask,integer,pointer} to put in 82 * OPTION_{BIT,SET_UINT,SET_PTR} store the {mask,integer,pointer} to put in
83 * the value when met. 83 * the value when met.
84 * CALLBACKS can use it like they want. 84 * CALLBACKS can use it like they want.
85 */ 85 */
@@ -101,16 +101,16 @@ struct option {
101#define OPT_END() { .type = OPTION_END } 101#define OPT_END() { .type = OPTION_END }
102#define OPT_ARGUMENT(l, h) { .type = OPTION_ARGUMENT, .long_name = (l), .help = (h) } 102#define OPT_ARGUMENT(l, h) { .type = OPTION_ARGUMENT, .long_name = (l), .help = (h) }
103#define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } 103#define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) }
104#define OPT_BIT(s, l, v, h, b) { .type = OPTION_BIT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (b) } 104#define OPT_BIT(s, l, v, h, b) { .type = OPTION_BIT, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h), .defval = (b) }
105#define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = check_vtype(v, bool *), .help = (h) } 105#define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = check_vtype(v, bool *), .help = (h) }
106#define OPT_INCR(s, l, v, h) { .type = OPTION_INCR, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 106#define OPT_INCR(s, l, v, h) { .type = OPTION_INCR, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
107#define OPT_SET_INT(s, l, v, h, i) { .type = OPTION_SET_INT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (i) } 107#define OPT_SET_UINT(s, l, v, h, i) { .type = OPTION_SET_UINT, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h), .defval = (i) }
108#define OPT_SET_PTR(s, l, v, h, p) { .type = OPTION_SET_PTR, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (p) } 108#define OPT_SET_PTR(s, l, v, h, p) { .type = OPTION_SET_PTR, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (p) }
109#define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) } 109#define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
110#define OPT_UINTEGER(s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) } 110#define OPT_UINTEGER(s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }
111#define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 111#define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
112#define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 112#define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
113#define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h) } 113#define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
114#define OPT_DATE(s, l, v, h) \ 114#define OPT_DATE(s, l, v, h) \
115 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb } 115 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb }
116#define OPT_CALLBACK(s, l, v, a, h, f) \ 116#define OPT_CALLBACK(s, l, v, a, h, f) \
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index da30b305fba0..2316cb5a4116 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,10 +1,10 @@
1#include "sort.h" 1#include "sort.h"
2 2
3regex_t parent_regex; 3regex_t parent_regex;
4char default_parent_pattern[] = "^sys_|^do_page_fault"; 4const char default_parent_pattern[] = "^sys_|^do_page_fault";
5char *parent_pattern = default_parent_pattern; 5const char *parent_pattern = default_parent_pattern;
6char default_sort_order[] = "comm,dso,symbol"; 6const char default_sort_order[] = "comm,dso,symbol";
7char *sort_order = default_sort_order; 7const char *sort_order = default_sort_order;
8int sort__need_collapse = 0; 8int sort__need_collapse = 0;
9int sort__has_parent = 0; 9int sort__has_parent = 0;
10 10
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index eab2e0b3b74e..0d61c4082f43 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -25,10 +25,10 @@
25#include "sort.h" 25#include "sort.h"
26 26
27extern regex_t parent_regex; 27extern regex_t parent_regex;
28extern char *sort_order; 28extern const char *sort_order;
29extern char default_parent_pattern[]; 29extern const char default_parent_pattern[];
30extern char *parent_pattern; 30extern const char *parent_pattern;
31extern char default_sort_order[]; 31extern const char default_sort_order[];
32extern int sort__need_collapse; 32extern int sort__need_collapse;
33extern int sort__has_parent; 33extern int sort__has_parent;
34extern char *field_sep; 34extern char *field_sep;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 6389d1acaf81..032469e41876 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -78,7 +78,7 @@ struct symbol_conf {
78 *default_guest_kallsyms, 78 *default_guest_kallsyms,
79 *default_guest_modules; 79 *default_guest_modules;
80 const char *guestmount; 80 const char *guestmount;
81 char *dso_list_str, 81 const char *dso_list_str,
82 *comm_list_str, 82 *comm_list_str,
83 *sym_list_str, 83 *sym_list_str,
84 *col_width_list_str; 84 *col_width_list_str;