Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754721AbcK1IxM (ORCPT ); Mon, 28 Nov 2016 03:53:12 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36264 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754569AbcK1Ivb (ORCPT ); Mon, 28 Nov 2016 03:51:31 -0500 From: Taeung Song To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim , Ingo Molnar , Peter Zijlstra , Wang Nan , Taeung Song , Jiri Olsa Subject: [PATCH v9 2/7] perf config: Add macros assigning key-value pairs to default_config_item Date: Mon, 28 Nov 2016 17:51:13 +0900 Message-Id: <1480323078-15623-3-git-send-email-treeze.taeung@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480323078-15623-1-git-send-email-treeze.taeung@gmail.com> References: <1480323078-15623-1-git-send-email-treeze.taeung@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1550 Lines: 44 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 Cc: Jiri Olsa Cc: Wang Nan Signed-off-by: Taeung Song --- 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