[tip:perf/core] perf options: add OPT_CALLBACK_DEFAULT_NOOPT

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: tip-bot for Akihiro Nagai
Date: Monday, December 6, 2010 - 11:56 pm

Commit-ID:  e4e18d568b0e833c75c1f7833e1690cdde8f4d76
Gitweb:     http://git.kernel.org/tip/e4e18d568b0e833c75c1f7833e1690cdde8f4d76
Author:     Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
AuthorDate: Fri, 3 Dec 2010 12:58:53 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 6 Dec 2010 15:33:29 -0200

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>
---
 tools/perf/util/parse-options.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
index c7d72dc..abc31a1 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[].
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -tip 0/7] perf: Introduce bts sub commands, Akihiro Nagai, (Thu Dec 2, 8:58 pm)
[PATCH -tip 1/7] perf: add OPT_CALLBACK_DEFAULT_NOOPT, Akihiro Nagai, (Thu Dec 2, 8:58 pm)
[PATCH -tip 4/7] perf bts trace: print pid and command, Akihiro Nagai, (Thu Dec 2, 8:59 pm)
[PATCH -tip 6/7] perf bts trace: print function+offset, Akihiro Nagai, (Thu Dec 2, 9:00 pm)
[PATCH -tip 7/7] perf bts trace: add print all option, Akihiro Nagai, (Thu Dec 2, 9:00 pm)
Re: [PATCH -tip 1/7] perf: add OPT_CALLBACK_DEFAULT_NOOPT, Masami Hiramatsu, (Sun Dec 5, 7:23 pm)
Re: [PATCH -tip 6/7] perf bts trace: print function+offset, Frederic Weisbecker, (Sun Dec 5, 7:42 pm)
Re: [PATCH -tip 4/7] perf bts trace: print pid and command, Masami Hiramatsu, (Sun Dec 5, 8:16 pm)
Re: [PATCH -tip 6/7] perf bts trace: print function+offset, Masami Hiramatsu, (Sun Dec 5, 8:20 pm)
Re: [PATCH -tip 7/7] perf bts trace: add print all option, Masami Hiramatsu, (Sun Dec 5, 8:20 pm)
[tip:perf/core] perf options: add OPT_CALLBACK_DEFAULT_NOOPT, tip-bot for Akihiro ..., (Mon Dec 6, 11:56 pm)