aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-06-23 10:31:20 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-06-23 10:35:01 -0400
commit602a1f4daa5d107e890fd4f5f558dedf6a0874f3 (patch)
tree01e69084d29183c62a76874af54ce8341c818854 /tools/perf
parente5cadb93d0839d268a7c4199e0fdef0f94722117 (diff)
perf tools: Rename strlist_for_each() macros to for_each_entry()
To match the semantics for list.h in the kernel, that are the interface we use in them. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Milian Wolff <milian.wolff@kdab.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Taeung Song <treeze.taeung@gmail.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-0b5i2ki9c3di6706fxpticsb@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-buildid-cache.c10
-rw-r--r--tools/perf/builtin-probe.c4
-rw-r--r--tools/perf/builtin-trace.c2
-rw-r--r--tools/perf/util/probe-event.c4
-rw-r--r--tools/perf/util/probe-file.c8
-rw-r--r--tools/perf/util/strlist.h4
-rw-r--r--tools/perf/util/symbol.c2
-rw-r--r--tools/perf/util/thread_map.c4
8 files changed, 19 insertions, 19 deletions
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index 2cbec658be90..76a4d03c7cd0 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -209,7 +209,7 @@ static int build_id_cache__purge_path(const char *pathname)
209 if (err) 209 if (err)
210 goto out; 210 goto out;
211 211
212 strlist__for_each(pos, list) { 212 strlist__for_each_entry(pos, list) {
213 err = build_id_cache__remove_s(pos->s); 213 err = build_id_cache__remove_s(pos->s);
214 pr_debug("Removing %s %s: %s\n", pos->s, pathname, 214 pr_debug("Removing %s %s: %s\n", pos->s, pathname,
215 err ? "FAIL" : "Ok"); 215 err ? "FAIL" : "Ok");
@@ -343,7 +343,7 @@ int cmd_buildid_cache(int argc, const char **argv,
343 if (add_name_list_str) { 343 if (add_name_list_str) {
344 list = strlist__new(add_name_list_str, NULL); 344 list = strlist__new(add_name_list_str, NULL);
345 if (list) { 345 if (list) {
346 strlist__for_each(pos, list) 346 strlist__for_each_entry(pos, list)
347 if (build_id_cache__add_file(pos->s)) { 347 if (build_id_cache__add_file(pos->s)) {
348 if (errno == EEXIST) { 348 if (errno == EEXIST) {
349 pr_debug("%s already in the cache\n", 349 pr_debug("%s already in the cache\n",
@@ -361,7 +361,7 @@ int cmd_buildid_cache(int argc, const char **argv,
361 if (remove_name_list_str) { 361 if (remove_name_list_str) {
362 list = strlist__new(remove_name_list_str, NULL); 362 list = strlist__new(remove_name_list_str, NULL);
363 if (list) { 363 if (list) {
364 strlist__for_each(pos, list) 364 strlist__for_each_entry(pos, list)
365 if (build_id_cache__remove_file(pos->s)) { 365 if (build_id_cache__remove_file(pos->s)) {
366 if (errno == ENOENT) { 366 if (errno == ENOENT) {
367 pr_debug("%s wasn't in the cache\n", 367 pr_debug("%s wasn't in the cache\n",
@@ -379,7 +379,7 @@ int cmd_buildid_cache(int argc, const char **argv,
379 if (purge_name_list_str) { 379 if (purge_name_list_str) {
380 list = strlist__new(purge_name_list_str, NULL); 380 list = strlist__new(purge_name_list_str, NULL);
381 if (list) { 381 if (list) {
382 strlist__for_each(pos, list) 382 strlist__for_each_entry(pos, list)
383 if (build_id_cache__purge_path(pos->s)) { 383 if (build_id_cache__purge_path(pos->s)) {
384 if (errno == ENOENT) { 384 if (errno == ENOENT) {
385 pr_debug("%s wasn't in the cache\n", 385 pr_debug("%s wasn't in the cache\n",
@@ -400,7 +400,7 @@ int cmd_buildid_cache(int argc, const char **argv,
400 if (update_name_list_str) { 400 if (update_name_list_str) {
401 list = strlist__new(update_name_list_str, NULL); 401 list = strlist__new(update_name_list_str, NULL);
402 if (list) { 402 if (list) {
403 strlist__for_each(pos, list) 403 strlist__for_each_entry(pos, list)
404 if (build_id_cache__update_file(pos->s)) { 404 if (build_id_cache__update_file(pos->s)) {
405 if (errno == ENOENT) { 405 if (errno == ENOENT) {
406 pr_debug("%s wasn't in the cache\n", 406 pr_debug("%s wasn't in the cache\n",
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 6d7ab4316449..34262329f405 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -389,7 +389,7 @@ static int perf_del_probe_events(struct strfilter *filter)
389 389
390 ret = probe_file__get_events(kfd, filter, klist); 390 ret = probe_file__get_events(kfd, filter, klist);
391 if (ret == 0) { 391 if (ret == 0) {
392 strlist__for_each(ent, klist) 392 strlist__for_each_entry(ent, klist)
393 pr_info("Removed event: %s\n", ent->s); 393 pr_info("Removed event: %s\n", ent->s);
394 394
395 ret = probe_file__del_strlist(kfd, klist); 395 ret = probe_file__del_strlist(kfd, klist);
@@ -399,7 +399,7 @@ static int perf_del_probe_events(struct strfilter *filter)
399 399
400 ret2 = probe_file__get_events(ufd, filter, ulist); 400 ret2 = probe_file__get_events(ufd, filter, ulist);
401 if (ret2 == 0) { 401 if (ret2 == 0) {
402 strlist__for_each(ent, ulist) 402 strlist__for_each_entry(ent, ulist)
403 pr_info("Removed event: %s\n", ent->s); 403 pr_info("Removed event: %s\n", ent->s);
404 404
405 ret2 = probe_file__del_strlist(ufd, ulist); 405 ret2 = probe_file__del_strlist(ufd, ulist);
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 1ecadfc61196..1ba134192d74 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1247,7 +1247,7 @@ static int trace__validate_ev_qualifier(struct trace *trace)
1247 1247
1248 i = 0; 1248 i = 0;
1249 1249
1250 strlist__for_each(pos, trace->ev_qualifier) { 1250 strlist__for_each_entry(pos, trace->ev_qualifier) {
1251 const char *sc = pos->s; 1251 const char *sc = pos->s;
1252 int id = syscalltbl__id(trace->sctbl, sc); 1252 int id = syscalltbl__id(trace->sctbl, sc);
1253 1253
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index caad19d8c7ef..4f7b3e5e355d 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -980,7 +980,7 @@ static int show_available_vars_at(struct debuginfo *dinfo,
980 zfree(&vl->point.symbol); 980 zfree(&vl->point.symbol);
981 nvars = 0; 981 nvars = 0;
982 if (vl->vars) { 982 if (vl->vars) {
983 strlist__for_each(node, vl->vars) { 983 strlist__for_each_entry(node, vl->vars) {
984 var = strchr(node->s, '\t') + 1; 984 var = strchr(node->s, '\t') + 1;
985 if (strfilter__compare(_filter, var)) { 985 if (strfilter__compare(_filter, var)) {
986 fprintf(stdout, "\t\t%s\n", node->s); 986 fprintf(stdout, "\t\t%s\n", node->s);
@@ -2333,7 +2333,7 @@ static int __show_perf_probe_events(int fd, bool is_kprobe,
2333 if (!rawlist) 2333 if (!rawlist)
2334 return -ENOMEM; 2334 return -ENOMEM;
2335 2335
2336 strlist__for_each(ent, rawlist) { 2336 strlist__for_each_entry(ent, rawlist) {
2337 ret = parse_probe_trace_command(ent->s, &tev); 2337 ret = parse_probe_trace_command(ent->s, &tev);
2338 if (ret >= 0) { 2338 if (ret >= 0) {
2339 if (!filter_probe_trace_event(&tev, filter)) 2339 if (!filter_probe_trace_event(&tev, filter))
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 25a40427003e..1c12c1ab19c9 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -178,7 +178,7 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
178 if (!rawlist) 178 if (!rawlist)
179 return NULL; 179 return NULL;
180 sl = strlist__new(NULL, NULL); 180 sl = strlist__new(NULL, NULL);
181 strlist__for_each(ent, rawlist) { 181 strlist__for_each_entry(ent, rawlist) {
182 ret = parse_probe_trace_command(ent->s, &tev); 182 ret = parse_probe_trace_command(ent->s, &tev);
183 if (ret < 0) 183 if (ret < 0)
184 break; 184 break;
@@ -281,7 +281,7 @@ int probe_file__get_events(int fd, struct strfilter *filter,
281 if (!namelist) 281 if (!namelist)
282 return -ENOENT; 282 return -ENOENT;
283 283
284 strlist__for_each(ent, namelist) { 284 strlist__for_each_entry(ent, namelist) {
285 p = strchr(ent->s, ':'); 285 p = strchr(ent->s, ':');
286 if ((p && strfilter__compare(filter, p + 1)) || 286 if ((p && strfilter__compare(filter, p + 1)) ||
287 strfilter__compare(filter, ent->s)) { 287 strfilter__compare(filter, ent->s)) {
@@ -299,7 +299,7 @@ int probe_file__del_strlist(int fd, struct strlist *namelist)
299 int ret = 0; 299 int ret = 0;
300 struct str_node *ent; 300 struct str_node *ent;
301 301
302 strlist__for_each(ent, namelist) { 302 strlist__for_each_entry(ent, namelist) {
303 ret = __del_trace_probe_event(fd, ent); 303 ret = __del_trace_probe_event(fd, ent);
304 if (ret < 0) 304 if (ret < 0)
305 break; 305 break;
@@ -612,7 +612,7 @@ static int probe_cache_entry__write(struct probe_cache_entry *entry, int fd)
612 if (ret < (int)iov[1].iov_len + 2) 612 if (ret < (int)iov[1].iov_len + 2)
613 goto rollback; 613 goto rollback;
614 614
615 strlist__for_each(snode, entry->tevlist) { 615 strlist__for_each_entry(snode, entry->tevlist) {
616 iov[0].iov_base = (void *)snode->s; 616 iov[0].iov_base = (void *)snode->s;
617 iov[0].iov_len = strlen(snode->s); 617 iov[0].iov_len = strlen(snode->s);
618 iov[1].iov_base = (void *)"\n"; iov[1].iov_len = 1; 618 iov[1].iov_base = (void *)"\n"; iov[1].iov_len = 1;
diff --git a/tools/perf/util/strlist.h b/tools/perf/util/strlist.h
index ca990029e243..19207e50fce5 100644
--- a/tools/perf/util/strlist.h
+++ b/tools/perf/util/strlist.h
@@ -73,7 +73,7 @@ static inline struct str_node *strlist__next(struct str_node *sn)
73 * @pos: the &struct str_node to use as a loop cursor. 73 * @pos: the &struct str_node to use as a loop cursor.
74 * @slist: the &struct strlist for loop. 74 * @slist: the &struct strlist for loop.
75 */ 75 */
76#define strlist__for_each(pos, slist) \ 76#define strlist__for_each_entry(pos, slist) \
77 for (pos = strlist__first(slist); pos; pos = strlist__next(pos)) 77 for (pos = strlist__first(slist); pos; pos = strlist__next(pos))
78 78
79/** 79/**
@@ -83,7 +83,7 @@ static inline struct str_node *strlist__next(struct str_node *sn)
83 * @n: another &struct str_node to use as temporary storage. 83 * @n: another &struct str_node to use as temporary storage.
84 * @slist: the &struct strlist for loop. 84 * @slist: the &struct strlist for loop.
85 */ 85 */
86#define strlist__for_each_safe(pos, n, slist) \ 86#define strlist__for_each_entry_safe(pos, n, slist) \
87 for (pos = strlist__first(slist), n = strlist__next(pos); pos;\ 87 for (pos = strlist__first(slist), n = strlist__next(pos); pos;\
88 pos = n, n = strlist__next(n)) 88 pos = n, n = strlist__next(n))
89#endif /* __PERF_STRLIST_H */ 89#endif /* __PERF_STRLIST_H */
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 09c5c34ae38d..b044f1a32d16 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1626,7 +1626,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
1626 if (!dirs) 1626 if (!dirs)
1627 return -1; 1627 return -1;
1628 1628
1629 strlist__for_each(nd, dirs) { 1629 strlist__for_each_entry(nd, dirs) {
1630 scnprintf(kallsyms_filename, sizeof(kallsyms_filename), 1630 scnprintf(kallsyms_filename, sizeof(kallsyms_filename),
1631 "%s/%s/kallsyms", dir, nd->s); 1631 "%s/%s/kallsyms", dir, nd->s);
1632 if (!validate_kcore_addresses(kallsyms_filename, map)) { 1632 if (!validate_kcore_addresses(kallsyms_filename, map)) {
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 5654fe15e036..40585f5b7027 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -202,7 +202,7 @@ static struct thread_map *thread_map__new_by_pid_str(const char *pid_str)
202 if (!slist) 202 if (!slist)
203 return NULL; 203 return NULL;
204 204
205 strlist__for_each(pos, slist) { 205 strlist__for_each_entry(pos, slist) {
206 pid = strtol(pos->s, &end_ptr, 10); 206 pid = strtol(pos->s, &end_ptr, 10);
207 207
208 if (pid == INT_MIN || pid == INT_MAX || 208 if (pid == INT_MIN || pid == INT_MAX ||
@@ -278,7 +278,7 @@ struct thread_map *thread_map__new_by_tid_str(const char *tid_str)
278 if (!slist) 278 if (!slist)
279 return NULL; 279 return NULL;
280 280
281 strlist__for_each(pos, slist) { 281 strlist__for_each_entry(pos, slist) {
282 tid = strtol(pos->s, &end_ptr, 10); 282 tid = strtol(pos->s, &end_ptr, 10);
283 283
284 if (tid == INT_MIN || tid == INT_MAX || 284 if (tid == INT_MIN || tid == INT_MAX ||