Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1184461
| From | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH perf/core v2 08/16] perf-buildid-cache: Use lsdir for looking up buildid caches |
| Date | 2015-07-15 11:20 +0200 |
| Message-ID | <pMr19-36Z-65@gated-at.bofh.it> (permalink) |
| References | <pMr17-36Z-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Use new lsdir() for looking up buildid caches. This changes
logic a bit to ignore all dot files, since the build-id
cache must not start with dot.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
tools/perf/util/build-id.c | 30 +++++-------------------------
1 file changed, 5 insertions(+), 25 deletions(-)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 8c40133..02a5e0d 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -342,38 +342,18 @@ int build_id_cache__list_build_ids(const char *pathname,
{
struct strlist *list;
char *dir_name;
- DIR *dir;
- struct dirent *d;
int ret = 0;
- list = strlist__new(true, NULL);
dir_name = build_id_cache__dirname_from_path(pathname, false, false,
NULL);
- if (!list || !dir_name) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!dir_name)
+ return -ENOMEM;
- /* List up all dirents */
- dir = opendir(dir_name);
- if (!dir) {
+ list = lsdir(dir_name, lsdir_no_dot_filter);
+ if (!list)
ret = -errno;
- goto out;
- }
-
- while ((d = readdir(dir)) != NULL) {
- if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
- continue;
- strlist__add(list, d->d_name);
- }
- closedir(dir);
-
-out:
+ *result = list;
free(dir_name);
- if (ret)
- strlist__delete(list);
- else
- *result = list;
return ret;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
[RFC PATCH perf/core v2 08/16] perf-buildid-cache: Use lsdir for looking up buildid caches Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
[RFC PATCH perf/core v2 11/16] perf probe: Show all cached probes Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
[RFC PATCH perf/core v2 10/16] perf probe: Use cache entry if possible Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
[RFC PATCH perf/core v2 03/16] perf probe: Use strbuf for making strings in probe-event.c Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
Re: [RFC PATCH perf/core v2 03/16] perf probe: Use strbuf for making strings in probe-event.c Namhyung Kim <namhyung@kernel.org> - 2015-07-17 10:00 +0200
Re: Re: [RFC PATCH perf/core v2 03/16] perf probe: Use strbuf for making strings in probe-event.c Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-17 12:20 +0200
[RFC PATCH perf/core v2 07/16] perf: Add lsdir to read a directory Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
[RFC PATCH perf/core v2 13/16] perf/sdt: ELF support for SDT Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
[RFC PATCH perf/core v2 16/16] perf probe: Accept %sdt and %cached event name Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:30 +0200
Re: [RFC PATCH perf/core v2 16/16] perf probe: Accept %sdt and %cached event name Namhyung Kim <namhyung@kernel.org> - 2015-07-19 13:00 +0200
[RFC PATCH perf/core v2 15/16] perf buildid-cache: Scan and import user SDT events to probe cache Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:30 +0200
Re: [RFC PATCH perf/core v2 15/16] perf buildid-cache: Scan and import user SDT events to probe cache Namhyung Kim <namhyung@kernel.org> - 2015-07-19 12:50 +0200
Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Hemant Kumar <hemant@linux.vnet.ibm.com> - 2015-07-16 05:20 +0200
Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Hemant Kumar <hemant@linux.vnet.ibm.com> - 2015-07-22 16:20 +0200
Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-07-20 20:40 +0200
Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-07-20 20:50 +0200
csiph-web