Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1399107 > unrolled thread

[PATCH perf/core v7 06/21] perf-buildid-cache: Use lsdir for looking up buildid caches

Started byMasami Hiramatsu <mhiramat@kernel.org>
First post2016-05-11 16:00 +0200
Last post2016-05-12 12:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH perf/core v7 06/21] perf-buildid-cache: Use lsdir for looking up buildid caches Masami Hiramatsu <mhiramat@kernel.org> - 2016-05-11 16:00 +0200
    Re: [PATCH perf/core v7 06/21] perf-buildid-cache: Use lsdir for  looking up buildid caches Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-11 18:00 +0200
    [tip:perf/core] perf buildid-cache: Use lsdir() for looking up  buildid caches tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2016-05-12 12:30 +0200

#1399107 — [PATCH perf/core v7 06/21] perf-buildid-cache: Use lsdir for looking up buildid caches

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2016-05-11 16:00 +0200
Subject[PATCH perf/core v7 06/21] perf-buildid-cache: Use lsdir for looking up buildid caches
Message-ID<rxCQa-UH-15@gated-at.bofh.it>
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

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>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 Changes in v7:
  - Remove unneeded local strlist.
---
 tools/perf/util/build-id.c |   30 ++++--------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 53df9aa..2cb6454 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -369,39 +369,17 @@ static char *build_id_cache__dirname_from_path(const char *name,
 int build_id_cache__list_build_ids(const char *pathname,
 				   struct strlist **result)
 {
-	struct strlist *list;
 	char *dir_name;
-	DIR *dir;
-	struct dirent *d;
 	int ret = 0;
 
-	list = strlist__new(NULL, NULL);
 	dir_name = build_id_cache__dirname_from_path(pathname, false, false);
-	if (!list || !dir_name) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!dir_name)
+		return -ENOMEM;
 
-	/* List up all dirents */
-	dir = opendir(dir_name);
-	if (!dir) {
+	*result = lsdir(dir_name, lsdir_no_dot_filter);
+	if (!*result)
 		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:
 	free(dir_name);
-	if (ret)
-		strlist__delete(list);
-	else
-		*result = list;
 
 	return ret;
 }

[toc] | [next] | [standalone]


#1399292 — Re: [PATCH perf/core v7 06/21] perf-buildid-cache: Use lsdir for looking up buildid caches

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-05-11 18:00 +0200
SubjectRe: [PATCH perf/core v7 06/21] perf-buildid-cache: Use lsdir for looking up buildid caches
Message-ID<rxEIi-2LV-17@gated-at.bofh.it>
In reply to#1399107
Em Wed, May 11, 2016 at 10:52:17PM +0900, Masami Hiramatsu escreveu:
> From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> 
> 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.

Applied
 
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  Changes in v7:
>   - Remove unneeded local strlist.
> ---
>  tools/perf/util/build-id.c |   30 ++++--------------------------
>  1 file changed, 4 insertions(+), 26 deletions(-)
> 
> diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
> index 53df9aa..2cb6454 100644
> --- a/tools/perf/util/build-id.c
> +++ b/tools/perf/util/build-id.c
> @@ -369,39 +369,17 @@ static char *build_id_cache__dirname_from_path(const char *name,
>  int build_id_cache__list_build_ids(const char *pathname,
>  				   struct strlist **result)
>  {
> -	struct strlist *list;
>  	char *dir_name;
> -	DIR *dir;
> -	struct dirent *d;
>  	int ret = 0;
>  
> -	list = strlist__new(NULL, NULL);
>  	dir_name = build_id_cache__dirname_from_path(pathname, false, false);
> -	if (!list || !dir_name) {
> -		ret = -ENOMEM;
> -		goto out;
> -	}
> +	if (!dir_name)
> +		return -ENOMEM;
>  
> -	/* List up all dirents */
> -	dir = opendir(dir_name);
> -	if (!dir) {
> +	*result = lsdir(dir_name, lsdir_no_dot_filter);
> +	if (!*result)
>  		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:
>  	free(dir_name);
> -	if (ret)
> -		strlist__delete(list);
> -	else
> -		*result = list;
>  
>  	return ret;
>  }

[toc] | [prev] | [next] | [standalone]


#1399864 — [tip:perf/core] perf buildid-cache: Use lsdir() for looking up buildid caches

Fromtip-bot for Masami Hiramatsu <tipbot@zytor.com>
Date2016-05-12 12:30 +0200
Subject[tip:perf/core] perf buildid-cache: Use lsdir() for looking up buildid caches
Message-ID<rxW2u-3Gh-5@gated-at.bofh.it>
In reply to#1399107
Commit-ID:  d65444d2fba98dcd4fa028ffada39c36a46f0038
Gitweb:     http://git.kernel.org/tip/d65444d2fba98dcd4fa028ffada39c36a46f0038
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Wed, 11 May 2016 22:52:17 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 May 2016 13:06:08 -0300

perf buildid-cache: Use lsdir() for looking up buildid caches

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 <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160511135217.23943.94596.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/build-id.c | 30 ++++--------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index b6ecf87..bff425e 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -365,39 +365,17 @@ static char *build_id_cache__dirname_from_path(const char *name,
 int build_id_cache__list_build_ids(const char *pathname,
 				   struct strlist **result)
 {
-	struct strlist *list;
 	char *dir_name;
-	DIR *dir;
-	struct dirent *d;
 	int ret = 0;
 
-	list = strlist__new(NULL, NULL);
 	dir_name = build_id_cache__dirname_from_path(pathname, false, false);
-	if (!list || !dir_name) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!dir_name)
+		return -ENOMEM;
 
-	/* List up all dirents */
-	dir = opendir(dir_name);
-	if (!dir) {
+	*result = lsdir(dir_name, lsdir_no_dot_filter);
+	if (!*result)
 		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:
 	free(dir_name);
-	if (ret)
-		strlist__delete(list);
-	else
-		*result = list;
 
 	return ret;
 }

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web