summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-options.h
diff options
context:
space:
mode:
authorAkihiro Nagai <akihiro.nagai.hw@hitachi.com>2010-12-03 04:58:53 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-12-06 18:33:29 +0100
commite4e18d568b0e833c75c1f7833e1690cdde8f4d76 (patch)
tree829337ccfa8b09ad7dc23f9227886f0396698db6 /tools/perf/util/parse-options.h
parentperf hist: Better displaying of unresolved DSOs and symbols (diff)
downloadlinux-e4e18d568b0e833c75c1f7833e1690cdde8f4d76.tar.xz
linux-e4e18d568b0e833c75c1f7833e1690cdde8f4d76.zip
perf options: add OPT_CALLBACK_DEFAULT_NOOPT
Add new macro OPT_CALLBACK_DEFAULT_NOOPT for parse_options. It enables to pass the default value (opt->defval) to the callback function processing options require no argument. Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20101203035853.7827.17502.stgit@localhost6.localdomain6> Signed-off-by: Akihiro Nagai <akihiro.nagai.hw@hitachi.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-options.h')
-rw-r--r--tools/perf/util/parse-options.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
index c7d72dce54b2..abc31a1dac1a 100644
--- a/tools/perf/util/parse-options.h
+++ b/tools/perf/util/parse-options.h
@@ -119,6 +119,10 @@ struct option {
{ .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f), .flags = PARSE_OPT_NOARG }
#define OPT_CALLBACK_DEFAULT(s, l, v, a, h, f, d) \
{ .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f), .defval = (intptr_t)d, .flags = PARSE_OPT_LASTARG_DEFAULT }
+#define OPT_CALLBACK_DEFAULT_NOOPT(s, l, v, a, h, f, d) \
+ { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l),\
+ .value = (v), (a), .help = (h), .callback = (f), .defval = (intptr_t)d,\
+ .flags = PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NOARG}
/* parse_options() will filter out the processed options and leave the
* non-option argments in argv[].