[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1480323078-15623-3-git-send-email-treeze.taeung@gmail.com>
Date: Mon, 28 Nov 2016 17:51:13 +0900
From: Taeung Song <treeze.taeung@...il.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Wang Nan <wangnan0@...wei.com>,
Taeung Song <treeze.taeung@...il.com>,
Jiri Olsa <jolsa@...hat.com>
Subject: [PATCH v9 2/7] perf config: Add macros assigning key-value pairs to default_config_item
In near future, default_config_item arrays will be added
(e.g. const struct default_config_item colors_config_items[])
To simply assign config key-value pairs to default_config_item,
add macros that are CONF_VAR() and CONF_*_VAR() for each type.
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Wang Nan <wangnan0@...wei.com>
Signed-off-by: Taeung Song <treeze.taeung@...il.com>
---
tools/perf/util/config.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/perf/util/config.h b/tools/perf/util/config.h
index 434d71c..7498669 100644
--- a/tools/perf/util/config.h
+++ b/tools/perf/util/config.h
@@ -96,4 +96,24 @@ struct default_config_section {
const struct default_config_item *items;
};
+#define CONF_VAR(_name, _field, _val, _type) \
+ { .name = _name, .value._field = _val, .type = _type }
+
+#define CONF_BOOL_VAR(_name, _val) \
+ CONF_VAR(_name, b, _val, CONFIG_TYPE_BOOL)
+#define CONF_INT_VAR(_name, _val) \
+ CONF_VAR(_name, i, _val, CONFIG_TYPE_INT)
+#define CONF_LONG_VAR(_name, _val) \
+ CONF_VAR(_name, l, _val, CONFIG_TYPE_LONG)
+#define CONF_U64_VAR(_name, _val) \
+ CONF_VAR(_name, ll, _val, CONFIG_TYPE_U64)
+#define CONF_FLOAT_VAR(_name, _val) \
+ CONF_VAR(_name, f, _val, CONFIG_TYPE_FLOAT)
+#define CONF_DOUBLE_VAR(_name, _val) \
+ CONF_VAR(_name, d, _val, CONFIG_TYPE_DOUBLE)
+#define CONF_STR_VAR(_name, _val) \
+ CONF_VAR(_name, s, _val, CONFIG_TYPE_STRING)
+#define CONF_END() \
+ { .name = NULL }
+
#endif /* __PERF_CONFIG_H */
--
2.7.4
Powered by blists - more mailing lists