diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-05-17 14:51:10 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-05-17 15:22:37 -0400 |
commit | 8035458fbb567ae138c77a5f710050107c6a7066 (patch) | |
tree | 0bd6e3730d96aa5d574e73d500f1820d2b195d8c | |
parent | 1967936d688c475b85d34d84e09858cf514c893c (diff) |
perf options: Type check OPT_BOOLEAN and fix the offenders
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>
-rw-r--r-- | tools/perf/builtin-kvm.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-lock.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-test.c | 2 | ||||
-rw-r--r-- | tools/perf/perf.h | 3 | ||||
-rw-r--r-- | tools/perf/util/parse-options.h | 3 |
5 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index a4c7cae45024..b1c6b38567f0 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -22,8 +22,8 @@ | |||
22 | static char *file_name; | 22 | static char *file_name; |
23 | static char name_buffer[256]; | 23 | static char name_buffer[256]; |
24 | 24 | ||
25 | int perf_host = 1; | 25 | bool perf_host = 1; |
26 | int perf_guest; | 26 | bool perf_guest; |
27 | 27 | ||
28 | static const char * const kvm_usage[] = { | 28 | static const char * const kvm_usage[] = { |
29 | "perf kvm [<options>] {top|record|report|diff|buildid-list}", | 29 | "perf kvm [<options>] {top|record|report|diff|buildid-list}", |
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index e18dfdc2948a..821c1586a22b 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c | |||
@@ -792,8 +792,7 @@ static void print_result(void) | |||
792 | print_bad_events(bad, total); | 792 | print_bad_events(bad, total); |
793 | } | 793 | } |
794 | 794 | ||
795 | static int info_threads; | 795 | static bool info_threads, info_map; |
796 | static int info_map; | ||
797 | 796 | ||
798 | static void dump_threads(void) | 797 | static void dump_threads(void) |
799 | { | 798 | { |
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 0339612e7385..035b9fa063a9 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
@@ -257,7 +257,7 @@ static const char * const test_usage[] = { | |||
257 | }; | 257 | }; |
258 | 258 | ||
259 | static const struct option test_options[] = { | 259 | static const struct option test_options[] = { |
260 | OPT_BOOLEAN('v', "verbose", &verbose, | 260 | OPT_INTEGER('v', "verbose", &verbose, |
261 | "be more verbose (show symbol address, etc)"), | 261 | "be more verbose (show symbol address, etc)"), |
262 | OPT_END() | 262 | OPT_END() |
263 | }; | 263 | }; |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 02821febb704..ef7aa0a0c526 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -80,6 +80,7 @@ void get_term_dimensions(struct winsize *ws); | |||
80 | 80 | ||
81 | #include "../../include/linux/perf_event.h" | 81 | #include "../../include/linux/perf_event.h" |
82 | #include "util/types.h" | 82 | #include "util/types.h" |
83 | #include <stdbool.h> | ||
83 | 84 | ||
84 | /* | 85 | /* |
85 | * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all | 86 | * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all |
@@ -131,6 +132,6 @@ struct ip_callchain { | |||
131 | u64 ips[0]; | 132 | u64 ips[0]; |
132 | }; | 133 | }; |
133 | 134 | ||
134 | extern int perf_host, perf_guest; | 135 | extern bool perf_host, perf_guest; |
135 | 136 | ||
136 | #endif | 137 | #endif |
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h index 9ca348e1063b..5838e2d8bbc1 100644 --- a/tools/perf/util/parse-options.h +++ b/tools/perf/util/parse-options.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __PERF_PARSE_OPTIONS_H | 2 | #define __PERF_PARSE_OPTIONS_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <stdbool.h> | ||
5 | 6 | ||
6 | enum parse_opt_type { | 7 | enum parse_opt_type { |
7 | /* special types */ | 8 | /* special types */ |
@@ -101,7 +102,7 @@ struct option { | |||
101 | #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) } |
102 | #define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } | 103 | #define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } |
103 | #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 = (v), .help = (h), .defval = (b) } |
104 | #define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = (v), .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) } |
105 | #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 = (v), .help = (h) } |
106 | #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_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_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) } |