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>
This commit is contained in:
Arnaldo Carvalho de Melo 2016-06-23 11:31:20 -03:00
parent e5cadb93d0
commit 602a1f4daa
8 changed files with 19 additions and 19 deletions

View File

@ -209,7 +209,7 @@ static int build_id_cache__purge_path(const char *pathname)
if (err) if (err)
goto out; goto out;
strlist__for_each(pos, list) { strlist__for_each_entry(pos, list) {
err = build_id_cache__remove_s(pos->s); err = build_id_cache__remove_s(pos->s);
pr_debug("Removing %s %s: %s\n", pos->s, pathname, pr_debug("Removing %s %s: %s\n", pos->s, pathname,
err ? "FAIL" : "Ok"); err ? "FAIL" : "Ok");
@ -343,7 +343,7 @@ int cmd_buildid_cache(int argc, const char **argv,
if (add_name_list_str) { if (add_name_list_str) {
list = strlist__new(add_name_list_str, NULL); list = strlist__new(add_name_list_str, NULL);
if (list) { if (list) {
strlist__for_each(pos, list) strlist__for_each_entry(pos, list)
if (build_id_cache__add_file(pos->s)) { if (build_id_cache__add_file(pos->s)) {
if (errno == EEXIST) { if (errno == EEXIST) {
pr_debug("%s already in the cache\n", pr_debug("%s already in the cache\n",
@ -361,7 +361,7 @@ int cmd_buildid_cache(int argc, const char **argv,
if (remove_name_list_str) { if (remove_name_list_str) {
list = strlist__new(remove_name_list_str, NULL); list = strlist__new(remove_name_list_str, NULL);
if (list) { if (list) {
strlist__for_each(pos, list) strlist__for_each_entry(pos, list)
if (build_id_cache__remove_file(pos->s)) { if (build_id_cache__remove_file(pos->s)) {
if (errno == ENOENT) { if (errno == ENOENT) {
pr_debug("%s wasn't in the cache\n", pr_debug("%s wasn't in the cache\n",
@ -379,7 +379,7 @@ int cmd_buildid_cache(int argc, const char **argv,
if (purge_name_list_str) { if (purge_name_list_str) {
list = strlist__new(purge_name_list_str, NULL); list = strlist__new(purge_name_list_str, NULL);
if (list) { if (list) {
strlist__for_each(pos, list) strlist__for_each_entry(pos, list)
if (build_id_cache__purge_path(pos->s)) { if (build_id_cache__purge_path(pos->s)) {
if (errno == ENOENT) { if (errno == ENOENT) {
pr_debug("%s wasn't in the cache\n", pr_debug("%s wasn't in the cache\n",
@ -400,7 +400,7 @@ int cmd_buildid_cache(int argc, const char **argv,
if (update_name_list_str) { if (update_name_list_str) {
list = strlist__new(update_name_list_str, NULL); list = strlist__new(update_name_list_str, NULL);
if (list) { if (list) {
strlist__for_each(pos, list) strlist__for_each_entry(pos, list)
if (build_id_cache__update_file(pos->s)) { if (build_id_cache__update_file(pos->s)) {
if (errno == ENOENT) { if (errno == ENOENT) {
pr_debug("%s wasn't in the cache\n", pr_debug("%s wasn't in the cache\n",

View File

@ -389,7 +389,7 @@ static int perf_del_probe_events(struct strfilter *filter)
ret = probe_file__get_events(kfd, filter, klist); ret = probe_file__get_events(kfd, filter, klist);
if (ret == 0) { if (ret == 0) {
strlist__for_each(ent, klist) strlist__for_each_entry(ent, klist)
pr_info("Removed event: %s\n", ent->s); pr_info("Removed event: %s\n", ent->s);
ret = probe_file__del_strlist(kfd, klist); ret = probe_file__del_strlist(kfd, klist);
@ -399,7 +399,7 @@ static int perf_del_probe_events(struct strfilter *filter)
ret2 = probe_file__get_events(ufd, filter, ulist); ret2 = probe_file__get_events(ufd, filter, ulist);
if (ret2 == 0) { if (ret2 == 0) {
strlist__for_each(ent, ulist) strlist__for_each_entry(ent, ulist)
pr_info("Removed event: %s\n", ent->s); pr_info("Removed event: %s\n", ent->s);
ret2 = probe_file__del_strlist(ufd, ulist); ret2 = probe_file__del_strlist(ufd, ulist);

View File

@ -1247,7 +1247,7 @@ static int trace__validate_ev_qualifier(struct trace *trace)
i = 0; i = 0;
strlist__for_each(pos, trace->ev_qualifier) { strlist__for_each_entry(pos, trace->ev_qualifier) {
const char *sc = pos->s; const char *sc = pos->s;
int id = syscalltbl__id(trace->sctbl, sc); int id = syscalltbl__id(trace->sctbl, sc);

View File

@ -980,7 +980,7 @@ static int show_available_vars_at(struct debuginfo *dinfo,
zfree(&vl->point.symbol); zfree(&vl->point.symbol);
nvars = 0; nvars = 0;
if (vl->vars) { if (vl->vars) {
strlist__for_each(node, vl->vars) { strlist__for_each_entry(node, vl->vars) {
var = strchr(node->s, '\t') + 1; var = strchr(node->s, '\t') + 1;
if (strfilter__compare(_filter, var)) { if (strfilter__compare(_filter, var)) {
fprintf(stdout, "\t\t%s\n", node->s); fprintf(stdout, "\t\t%s\n", node->s);
@ -2333,7 +2333,7 @@ static int __show_perf_probe_events(int fd, bool is_kprobe,
if (!rawlist) if (!rawlist)
return -ENOMEM; return -ENOMEM;
strlist__for_each(ent, rawlist) { strlist__for_each_entry(ent, rawlist) {
ret = parse_probe_trace_command(ent->s, &tev); ret = parse_probe_trace_command(ent->s, &tev);
if (ret >= 0) { if (ret >= 0) {
if (!filter_probe_trace_event(&tev, filter)) if (!filter_probe_trace_event(&tev, filter))

View File

@ -178,7 +178,7 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
if (!rawlist) if (!rawlist)
return NULL; return NULL;
sl = strlist__new(NULL, NULL); sl = strlist__new(NULL, NULL);
strlist__for_each(ent, rawlist) { strlist__for_each_entry(ent, rawlist) {
ret = parse_probe_trace_command(ent->s, &tev); ret = parse_probe_trace_command(ent->s, &tev);
if (ret < 0) if (ret < 0)
break; break;
@ -281,7 +281,7 @@ int probe_file__get_events(int fd, struct strfilter *filter,
if (!namelist) if (!namelist)
return -ENOENT; return -ENOENT;
strlist__for_each(ent, namelist) { strlist__for_each_entry(ent, namelist) {
p = strchr(ent->s, ':'); p = strchr(ent->s, ':');
if ((p && strfilter__compare(filter, p + 1)) || if ((p && strfilter__compare(filter, p + 1)) ||
strfilter__compare(filter, ent->s)) { strfilter__compare(filter, ent->s)) {
@ -299,7 +299,7 @@ int probe_file__del_strlist(int fd, struct strlist *namelist)
int ret = 0; int ret = 0;
struct str_node *ent; struct str_node *ent;
strlist__for_each(ent, namelist) { strlist__for_each_entry(ent, namelist) {
ret = __del_trace_probe_event(fd, ent); ret = __del_trace_probe_event(fd, ent);
if (ret < 0) if (ret < 0)
break; break;
@ -612,7 +612,7 @@ static int probe_cache_entry__write(struct probe_cache_entry *entry, int fd)
if (ret < (int)iov[1].iov_len + 2) if (ret < (int)iov[1].iov_len + 2)
goto rollback; goto rollback;
strlist__for_each(snode, entry->tevlist) { strlist__for_each_entry(snode, entry->tevlist) {
iov[0].iov_base = (void *)snode->s; iov[0].iov_base = (void *)snode->s;
iov[0].iov_len = strlen(snode->s); iov[0].iov_len = strlen(snode->s);
iov[1].iov_base = (void *)"\n"; iov[1].iov_len = 1; iov[1].iov_base = (void *)"\n"; iov[1].iov_len = 1;

View File

@ -73,7 +73,7 @@ static inline struct str_node *strlist__next(struct str_node *sn)
* @pos: the &struct str_node to use as a loop cursor. * @pos: the &struct str_node to use as a loop cursor.
* @slist: the &struct strlist for loop. * @slist: the &struct strlist for loop.
*/ */
#define strlist__for_each(pos, slist) \ #define strlist__for_each_entry(pos, slist) \
for (pos = strlist__first(slist); pos; pos = strlist__next(pos)) for (pos = strlist__first(slist); pos; pos = strlist__next(pos))
/** /**
@ -83,7 +83,7 @@ static inline struct str_node *strlist__next(struct str_node *sn)
* @n: another &struct str_node to use as temporary storage. * @n: another &struct str_node to use as temporary storage.
* @slist: the &struct strlist for loop. * @slist: the &struct strlist for loop.
*/ */
#define strlist__for_each_safe(pos, n, slist) \ #define strlist__for_each_entry_safe(pos, n, slist) \
for (pos = strlist__first(slist), n = strlist__next(pos); pos;\ for (pos = strlist__first(slist), n = strlist__next(pos); pos;\
pos = n, n = strlist__next(n)) pos = n, n = strlist__next(n))
#endif /* __PERF_STRLIST_H */ #endif /* __PERF_STRLIST_H */

View File

@ -1626,7 +1626,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
if (!dirs) if (!dirs)
return -1; return -1;
strlist__for_each(nd, dirs) { strlist__for_each_entry(nd, dirs) {
scnprintf(kallsyms_filename, sizeof(kallsyms_filename), scnprintf(kallsyms_filename, sizeof(kallsyms_filename),
"%s/%s/kallsyms", dir, nd->s); "%s/%s/kallsyms", dir, nd->s);
if (!validate_kcore_addresses(kallsyms_filename, map)) { if (!validate_kcore_addresses(kallsyms_filename, map)) {

View File

@ -202,7 +202,7 @@ static struct thread_map *thread_map__new_by_pid_str(const char *pid_str)
if (!slist) if (!slist)
return NULL; return NULL;
strlist__for_each(pos, slist) { strlist__for_each_entry(pos, slist) {
pid = strtol(pos->s, &end_ptr, 10); pid = strtol(pos->s, &end_ptr, 10);
if (pid == INT_MIN || pid == INT_MAX || if (pid == INT_MIN || pid == INT_MAX ||
@ -278,7 +278,7 @@ struct thread_map *thread_map__new_by_tid_str(const char *tid_str)
if (!slist) if (!slist)
return NULL; return NULL;
strlist__for_each(pos, slist) { strlist__for_each_entry(pos, slist) {
tid = strtol(pos->s, &end_ptr, 10); tid = strtol(pos->s, &end_ptr, 10);
if (tid == INT_MIN || tid == INT_MAX || if (tid == INT_MIN || tid == INT_MAX ||