perf tools: Rename strlist_for_each() macros to for_each_entry()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 23 Jun 2016 14:31:20 +0000 (11:31 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 23 Jun 2016 14:35:01 +0000 (11:35 -0300)
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>
tools/perf/builtin-buildid-cache.c
tools/perf/builtin-probe.c
tools/perf/builtin-trace.c
tools/perf/util/probe-event.c
tools/perf/util/probe-file.c
tools/perf/util/strlist.h
tools/perf/util/symbol.c
tools/perf/util/thread_map.c

index 2cbec658be90a6daf57b4596ac2375f345f4f147..76a4d03c7cd09e95f64fec0d568d19fa99622081 100644 (file)
@@ -209,7 +209,7 @@ static int build_id_cache__purge_path(const char *pathname)
        if (err)
                goto out;
 
-       strlist__for_each(pos, list) {
+       strlist__for_each_entry(pos, list) {
                err = build_id_cache__remove_s(pos->s);
                pr_debug("Removing %s %s: %s\n", pos->s, pathname,
                         err ? "FAIL" : "Ok");
@@ -343,7 +343,7 @@ int cmd_buildid_cache(int argc, const char **argv,
        if (add_name_list_str) {
                list = strlist__new(add_name_list_str, NULL);
                if (list) {
-                       strlist__for_each(pos, list)
+                       strlist__for_each_entry(pos, list)
                                if (build_id_cache__add_file(pos->s)) {
                                        if (errno == EEXIST) {
                                                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) {
                list = strlist__new(remove_name_list_str, NULL);
                if (list) {
-                       strlist__for_each(pos, list)
+                       strlist__for_each_entry(pos, list)
                                if (build_id_cache__remove_file(pos->s)) {
                                        if (errno == ENOENT) {
                                                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) {
                list = strlist__new(purge_name_list_str, NULL);
                if (list) {
-                       strlist__for_each(pos, list)
+                       strlist__for_each_entry(pos, list)
                                if (build_id_cache__purge_path(pos->s)) {
                                        if (errno == ENOENT) {
                                                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) {
                list = strlist__new(update_name_list_str, NULL);
                if (list) {
-                       strlist__for_each(pos, list)
+                       strlist__for_each_entry(pos, list)
                                if (build_id_cache__update_file(pos->s)) {
                                        if (errno == ENOENT) {
                                                pr_debug("%s wasn't in the cache\n",
index 6d7ab43164495714f129b40c24d02b019bd22106..34262329f4056d660438d4b7315415ae61de8397 100644 (file)
@@ -389,7 +389,7 @@ static int perf_del_probe_events(struct strfilter *filter)
 
        ret = probe_file__get_events(kfd, filter, klist);
        if (ret == 0) {
-               strlist__for_each(ent, klist)
+               strlist__for_each_entry(ent, klist)
                        pr_info("Removed event: %s\n", ent->s);
 
                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);
        if (ret2 == 0) {
-               strlist__for_each(ent, ulist)
+               strlist__for_each_entry(ent, ulist)
                        pr_info("Removed event: %s\n", ent->s);
 
                ret2 = probe_file__del_strlist(ufd, ulist);
index 1ecadfc611969ec1b61f4a355949844f44a77110..1ba134192d74097c6849d7844522e8863519f651 100644 (file)
@@ -1247,7 +1247,7 @@ static int trace__validate_ev_qualifier(struct trace *trace)
 
        i = 0;
 
-       strlist__for_each(pos, trace->ev_qualifier) {
+       strlist__for_each_entry(pos, trace->ev_qualifier) {
                const char *sc = pos->s;
                int id = syscalltbl__id(trace->sctbl, sc);
 
index caad19d8c7ef9c451b76d15e9e8b36e5c7261f6b..4f7b3e5e355dcc8c86fb09db383054bdf1bda4f0 100644 (file)
@@ -980,7 +980,7 @@ static int show_available_vars_at(struct debuginfo *dinfo,
                zfree(&vl->point.symbol);
                nvars = 0;
                if (vl->vars) {
-                       strlist__for_each(node, vl->vars) {
+                       strlist__for_each_entry(node, vl->vars) {
                                var = strchr(node->s, '\t') + 1;
                                if (strfilter__compare(_filter, var)) {
                                        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)
                return -ENOMEM;
 
-       strlist__for_each(ent, rawlist) {
+       strlist__for_each_entry(ent, rawlist) {
                ret = parse_probe_trace_command(ent->s, &tev);
                if (ret >= 0) {
                        if (!filter_probe_trace_event(&tev, filter))
index 25a40427003e19c33f074583ff8ddb7e18f2b9b0..1c12c1ab19c94d61976dada1705d669fe2949fd4 100644 (file)
@@ -178,7 +178,7 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
        if (!rawlist)
                return 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);
                if (ret < 0)
                        break;
@@ -281,7 +281,7 @@ int probe_file__get_events(int fd, struct strfilter *filter,
        if (!namelist)
                return -ENOENT;
 
-       strlist__for_each(ent, namelist) {
+       strlist__for_each_entry(ent, namelist) {
                p = strchr(ent->s, ':');
                if ((p && strfilter__compare(filter, p + 1)) ||
                    strfilter__compare(filter, ent->s)) {
@@ -299,7 +299,7 @@ int probe_file__del_strlist(int fd, struct strlist *namelist)
        int ret = 0;
        struct str_node *ent;
 
-       strlist__for_each(ent, namelist) {
+       strlist__for_each_entry(ent, namelist) {
                ret = __del_trace_probe_event(fd, ent);
                if (ret < 0)
                        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)
                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_len = strlen(snode->s);
                iov[1].iov_base = (void *)"\n"; iov[1].iov_len = 1;
index ca990029e2430a5681d56682ae6176d66fc3ee0a..19207e50fce50a0bf7d01f11bbc87b6b64ecba6a 100644 (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.
  * @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))
 
 /**
@@ -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.
  * @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;\
             pos = n, n = strlist__next(n))
 #endif /* __PERF_STRLIST_H */
index 09c5c34ae38dd08ac21f92572ffd52def4440bd1..b044f1a32d163df2c36c198edfdf697e6906411b 100644 (file)
@@ -1626,7 +1626,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
        if (!dirs)
                return -1;
 
-       strlist__for_each(nd, dirs) {
+       strlist__for_each_entry(nd, dirs) {
                scnprintf(kallsyms_filename, sizeof(kallsyms_filename),
                          "%s/%s/kallsyms", dir, nd->s);
                if (!validate_kcore_addresses(kallsyms_filename, map)) {
index 5654fe15e036795896d3548c568bd8fa3657da06..40585f5b7027d1d1eb7c0d78e754c1a7963a74f9 100644 (file)
@@ -202,7 +202,7 @@ static struct thread_map *thread_map__new_by_pid_str(const char *pid_str)
        if (!slist)
                return NULL;
 
-       strlist__for_each(pos, slist) {
+       strlist__for_each_entry(pos, slist) {
                pid = strtol(pos->s, &end_ptr, 10);
 
                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)
                return NULL;
 
-       strlist__for_each(pos, slist) {
+       strlist__for_each_entry(pos, slist) {
                tid = strtol(pos->s, &end_ptr, 10);
 
                if (tid == INT_MIN || tid == INT_MAX ||