diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index a4c7cae450243f5d8d326025361a6c680d1ee3dc..b1c6b38567f0a1a769f3f5e328262bcfbc478b09 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -22,8 +22,8 @@ static char *file_name; static char name_buffer[256]; -int perf_host = 1; -int perf_guest; +bool perf_host = 1; +bool perf_guest; static const char * const kvm_usage[] = { "perf kvm [] {top|record|report|diff|buildid-list}", diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index e18dfdc2948aedf862c51092001388ddb7bc0e5c..821c1586a22b7da92cd732ad1a4ee4e05b037085 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -792,8 +792,7 @@ static void print_result(void) print_bad_events(bad, total); } -static int info_threads; -static int info_map; +static bool info_threads, info_map; static void dump_threads(void) { diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 0339612e738517456f57c26cf3ae8236e58da79a..035b9fa063a9453002873c00f654adcd13a99eb2 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c @@ -257,7 +257,7 @@ static const char * const test_usage[] = { }; static const struct option test_options[] = { - OPT_BOOLEAN('v', "verbose", &verbose, + OPT_INTEGER('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"), OPT_END() }; diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 02821febb704733462845599292a7afa332c03c8..ef7aa0a0c5265191e8120e76f9f134b5e241fa53 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h @@ -80,6 +80,7 @@ void get_term_dimensions(struct winsize *ws); #include "../../include/linux/perf_event.h" #include "util/types.h" +#include /* * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all @@ -131,6 +132,6 @@ struct ip_callchain { u64 ips[0]; }; -extern int perf_host, perf_guest; +extern bool perf_host, perf_guest; #endif diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h index 9ca348e1063b4ba40ebf48c6a8dfe381952ebec2..5838e2d8bbc10efe1e3dc75ad23c558369ec8064 100644 --- a/tools/perf/util/parse-options.h +++ b/tools/perf/util/parse-options.h @@ -2,6 +2,7 @@ #define __PERF_PARSE_OPTIONS_H #include +#include enum parse_opt_type { /* special types */ @@ -101,7 +102,7 @@ struct option { #define OPT_ARGUMENT(l, h) { .type = OPTION_ARGUMENT, .long_name = (l), .help = (h) } #define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } #define OPT_BIT(s, l, v, h, b) { .type = OPTION_BIT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (b) } -#define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } +#define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = check_vtype(v, bool *), .help = (h) } #define OPT_INCR(s, l, v, h) { .type = OPTION_INCR, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } #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) } #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) }