From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, dsahern@gmail.com, peterz@infradead.org,
wangnan0@huawei.com, mingo@kernel.org,
linux-kernel@vger.kernel.org, tglx@linutronix.de,
namhyung@kernel.org, hpa@zytor.com, andi@firstfloor.org,
jolsa@kernel.org
Subject: [tip:perf/urgent] perf tools: Add file_only config option to strlist
Date: Wed, 13 Jan 2016 01:42:04 -0800 [thread overview]
Message-ID: <tip-dd8232bc9d13b729d92590b55befd14e49f81eca@git.kernel.org> (raw)
In-Reply-To: <1452334589-8782-2-git-send-email-namhyung@kernel.org>
Commit-ID: dd8232bc9d13b729d92590b55befd14e49f81eca
Gitweb: http://git.kernel.org/tip/dd8232bc9d13b729d92590b55befd14e49f81eca
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Sat, 9 Jan 2016 19:16:27 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Jan 2016 12:42:07 -0300
perf tools: Add file_only config option to strlist
If strlist_config.dirname is present, the strlist__new() tries to load
stirngs from dirname/list file first but if it failes it falls back to
add 'list' as string. But sometimes it's not desired so adds new
file_only field to prevent it.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1452334589-8782-2-git-send-email-namhyung@kernel.org
[ Add documentation for strlist_config::file_only, in the struct definition */
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/strlist.c | 8 ++++++++
tools/perf/util/strlist.h | 9 ++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index bdf98f6..0d3dfcb 100644
--- a/tools/perf/util/strlist.c
+++ b/tools/perf/util/strlist.c
@@ -126,6 +126,11 @@ static int strlist__parse_list_entry(struct strlist *slist, const char *s,
err = strlist__load(slist, subst);
goto out;
}
+
+ if (slist->file_only) {
+ err = -ENOENT;
+ goto out;
+ }
}
err = strlist__add(slist, s);
@@ -157,11 +162,13 @@ struct strlist *strlist__new(const char *list, const struct strlist_config *conf
if (slist != NULL) {
bool dupstr = true;
+ bool file_only = false;
const char *dirname = NULL;
if (config) {
dupstr = !config->dont_dupstr;
dirname = config->dirname;
+ file_only = config->file_only;
}
rblist__init(&slist->rblist);
@@ -170,6 +177,7 @@ struct strlist *strlist__new(const char *list, const struct strlist_config *conf
slist->rblist.node_delete = strlist__node_delete;
slist->dupstr = dupstr;
+ slist->file_only = file_only;
if (list && strlist__parse_list(slist, list, dirname) != 0)
goto out_error;
diff --git a/tools/perf/util/strlist.h b/tools/perf/util/strlist.h
index 297565a..ca99002 100644
--- a/tools/perf/util/strlist.h
+++ b/tools/perf/util/strlist.h
@@ -13,11 +13,18 @@ struct str_node {
struct strlist {
struct rblist rblist;
- bool dupstr;
+ bool dupstr;
+ bool file_only;
};
+/*
+ * @file_only: When dirname is present, only consider entries as filenames,
+ * that should not be added to the list if dirname/entry is not
+ * found
+ */
struct strlist_config {
bool dont_dupstr;
+ bool file_only;
const char *dirname;
};
next prev parent reply other threads:[~2016-01-13 9:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-09 10:16 [PATCH 1/4] perf tools: Add more usage tips Namhyung Kim
2016-01-09 10:16 ` [PATCH 2/4] perf tools: Add file_only config option to strlist Namhyung Kim
2016-01-13 9:42 ` tip-bot for Namhyung Kim [this message]
2016-01-09 10:16 ` [PATCH 3/4] perf tools: Set and pass DOCDIR to builtin-report.c Namhyung Kim
2016-01-13 9:42 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2016-01-09 10:16 ` [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt Namhyung Kim
2016-01-11 9:18 ` Jiri Olsa
2016-01-12 15:34 ` Arnaldo Carvalho de Melo
2016-01-12 15:39 ` Arnaldo Carvalho de Melo
2016-01-12 15:22 ` Arnaldo Carvalho de Melo
2016-01-13 9:43 ` [tip:perf/urgent] perf tools: Fallback to srcdir/Documentation/ tips.txt tip-bot for Namhyung Kim
2016-01-10 3:38 ` [PATCH 1/4] perf tools: Add more usage tips Andi Kleen
2016-01-11 10:35 ` [PATCH v2 " Namhyung Kim
2016-01-11 10:53 ` [PATCH 5/4] perf ui/tui: Print helpline message as is Namhyung Kim
2016-01-12 15:23 ` Arnaldo Carvalho de Melo
2016-01-13 9:42 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2016-01-13 9:41 ` [tip:perf/urgent] perf tools: Add more usage tips tip-bot for Namhyung Kim
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-dd8232bc9d13b729d92590b55befd14e49f81eca@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).