summaryrefslogtreecommitdiff
path: root/tools/perf/util/strlist.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-01-09 13:16:27 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-01-12 18:42:07 +0300
commitdd8232bc9d13b729d92590b55befd14e49f81eca (patch)
tree5a5b1ac324ce83fb1f53cd2fb456106f4415aac4 /tools/perf/util/strlist.c
parent09f1985404aa99b9d1ad435fcb0dabd20d4ed498 (diff)
downloadlinux-dd8232bc9d13b729d92590b55befd14e49f81eca.tar.xz
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>
Diffstat (limited to 'tools/perf/util/strlist.c')
-rw-r--r--tools/perf/util/strlist.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index bdf98f6f27bb..0d3dfcb919b4 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;