From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753995AbcEXHR7 (ORCPT ); Tue, 24 May 2016 03:17:59 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:36504 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753865AbcEXHR4 (ORCPT ); Tue, 24 May 2016 03:17:56 -0400 From: Taeung Song To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim , Ingo Molnar , Peter Zijlstra , Alexander Shishkin , Masami Hiramatsu , Taeung Song , Jiri Olsa Subject: [PATCH v2 5/5] perf config: Reset config set at only 'config' sub-command Date: Tue, 24 May 2016 16:17:32 +0900 Message-Id: <1464074252-21991-6-git-send-email-treeze.taeung@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1464074252-21991-1-git-send-email-treeze.taeung@gmail.com> References: <1464074252-21991-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 When first calling perf_config(), config set is initialized but 'config' sub-command need to reset config set because of '--user' or '--system' options. The options of 'config' sub-command is to select a particular config file location so the config set should be reinitialized collecting configs from selected exclusive config file. Cc: Namhyung Kim Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Alexander Shishkin Signed-off-by: Taeung Song --- tools/perf/builtin-config.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c index 4a61411..dc5b52f 100644 --- a/tools/perf/builtin-config.c +++ b/tools/perf/builtin-config.c @@ -47,7 +47,6 @@ static int show_config(const char *key, const char *value, int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused) { int ret = 0; - struct perf_config_set *set; char *user_config = mkpath("%s/.perfconfig", getenv("HOME")); argc = parse_options(argc, argv, config_options, config_usage, @@ -65,11 +64,11 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused) else if (use_user_config) config_exclusive_filename = user_config; - set = perf_config_set__new(); - if (!set) { - ret = -1; - goto out_err; - } + /* + * Reset config set at only 'config' sub-command + * because of options config file location. + */ + perf_config_set__delete(); switch (actions) { case ACTION_LIST: @@ -92,6 +91,5 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused) } perf_config_set__delete(); -out_err: return ret; } -- 2.5.0