From: tip-bot for Taeung Song <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, namhyung@kernel.org, acme@redhat.com,
tglx@linutronix.de, treeze.taeung@gmail.com, mingo@kernel.org,
wangnan0@huawei.com, jolsa@kernel.org, hpa@zytor.com,
linux-kernel@vger.kernel.org
Subject: [tip:perf/core] perf config: Rework buildid_dir_command_config to perf_buildid_config
Date: Wed, 30 Mar 2016 23:53:38 -0700 [thread overview]
Message-ID: <tip-9cb5987c822714352e3eb46806fc260b3cb4ff0d@git.kernel.org> (raw)
In-Reply-To: <1459099340-16911-2-git-send-email-treeze.taeung@gmail.com>
Commit-ID: 9cb5987c822714352e3eb46806fc260b3cb4ff0d
Gitweb: http://git.kernel.org/tip/9cb5987c822714352e3eb46806fc260b3cb4ff0d
Author: Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Mon, 28 Mar 2016 02:22:19 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 30 Mar 2016 11:14:09 -0300
perf config: Rework buildid_dir_command_config to perf_buildid_config
To avoid repeated calling perf_config() remove
buildid_dir_command_config() and add new perf_buildid_config into
perf_default_config.
Because perf_config() is already called with perf_default_config at
main().
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1459099340-16911-2-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/config.c | 50 +++++++++++++++++-------------------------------
1 file changed, 18 insertions(+), 32 deletions(-)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 4e72763..2dd78f4 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -377,6 +377,21 @@ const char *perf_config_dirname(const char *name, const char *value)
return value;
}
+static int perf_buildid_config(const char *var, const char *value)
+{
+ /* same dir for all commands */
+ if (!strcmp(var, "buildid.dir")) {
+ const char *dirname = perf_config_dirname(var, value);
+
+ if (!dirname)
+ return -1;
+ strncpy(buildid_dir, dirname, MAXPATHLEN-1);
+ buildid_dir[MAXPATHLEN-1] = '\0';
+ }
+
+ return 0;
+}
+
static int perf_default_core_config(const char *var __maybe_unused,
const char *value __maybe_unused)
{
@@ -412,6 +427,9 @@ int perf_default_config(const char *var, const char *value,
if (!prefixcmp(var, "llvm."))
return perf_llvm_config(var, value);
+ if (!prefixcmp(var, "buildid."))
+ return perf_buildid_config(var, value);
+
/* Add other config variables here. */
return 0;
}
@@ -515,43 +533,11 @@ int config_error_nonbool(const char *var)
return error("Missing value for '%s'", var);
}
-struct buildid_dir_config {
- char *dir;
-};
-
-static int buildid_dir_command_config(const char *var, const char *value,
- void *data)
-{
- struct buildid_dir_config *c = data;
- const char *v;
-
- /* same dir for all commands */
- if (!strcmp(var, "buildid.dir")) {
- v = perf_config_dirname(var, value);
- if (!v)
- return -1;
- strncpy(c->dir, v, MAXPATHLEN-1);
- c->dir[MAXPATHLEN-1] = '\0';
- }
- return 0;
-}
-
-static void check_buildid_dir_config(void)
-{
- struct buildid_dir_config c;
- c.dir = buildid_dir;
- perf_config(buildid_dir_command_config, &c);
-}
-
void set_buildid_dir(const char *dir)
{
if (dir)
scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
- /* try config file */
- if (buildid_dir[0] == '\0')
- check_buildid_dir_config();
-
/* default to $HOME/.debug */
if (buildid_dir[0] == '\0') {
char *v = getenv("HOME");
next prev parent reply other threads:[~2016-03-31 6:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-27 17:22 [PATCH 1/3] perf config: Remove duplicated the code calling set_buildid_dir Taeung Song
2016-03-27 17:22 ` [PATCH 2/3] perf config: Rework buildid_dir_command_config to perf_buildid_config Taeung Song
2016-03-31 6:53 ` tip-bot for Taeung Song [this message]
2016-03-27 17:22 ` [PATCH 3/3] perf config: Rename 'v' to 'home' at set_buildid_dir Taeung Song
2016-03-31 6:54 ` [tip:perf/core] perf config: Rename 'v' to 'home' in set_buildid_dir() tip-bot for Taeung Song
2016-03-28 19:52 ` [PATCH 1/3] perf config: Remove duplicated the code calling set_buildid_dir Jiri Olsa
2016-03-28 20:59 ` Arnaldo Carvalho de Melo
2016-03-28 23:58 ` Taeung Song
2016-03-31 6:53 ` [tip:perf/core] perf config: Remove duplicated set_buildid_dir calls tip-bot for Taeung Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-9cb5987c822714352e3eb46806fc260b3cb4ff0d@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=treeze.taeung@gmail.com \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.