Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1399114 > unrolled thread
| Started by | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| First post | 2016-05-11 16:00 +0200 |
| Last post | 2016-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.
[PATCH perf/core v7 05/21] perf symbol: Use lsdir for search in kcore cache directory Masami Hiramatsu <mhiramat@kernel.org> - 2016-05-11 16:00 +0200
Re: [PATCH perf/core v7 05/21] perf symbol: Use lsdir for search in kcore cache directory Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-11 17:50 +0200
[tip:perf/core] perf symbols: Use lsdir() for the search in kcore cache directory tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2016-05-12 12:30 +0200
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Date | 2016-05-11 16:00 +0200 |
| Subject | [PATCH perf/core v7 05/21] perf symbol: Use lsdir for search in kcore cache directory |
| Message-ID | <rxCQb-UH-39@gated-at.bofh.it> |
Use lsdir for search in kcore cache directory. This also
avoid checking hidden dot directory entries, because
kcore cache directories must always have the name from
timestamps when taking the kcore snapshots, and it never
start with dot.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
tools/perf/util/symbol.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 18d81c1..e112bbd 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1596,25 +1596,27 @@ out:
return err;
}
+static bool visible_dir_filter(const char *name, struct dirent *d)
+{
+ if (d->d_type != DT_DIR)
+ return false;
+ return lsdir_no_dot_filter(name, d);
+}
+
static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
{
char kallsyms_filename[PATH_MAX];
- struct dirent *dent;
int ret = -1;
- DIR *d;
+ struct strlist *dirs;
+ struct str_node *nd;
- d = opendir(dir);
- if (!d)
+ dirs = lsdir(dir, visible_dir_filter);
+ if (!dirs)
return -1;
- while (1) {
- dent = readdir(d);
- if (!dent)
- break;
- if (dent->d_type != DT_DIR)
- continue;
+ strlist__for_each(nd, dirs) {
scnprintf(kallsyms_filename, sizeof(kallsyms_filename),
- "%s/%s/kallsyms", dir, dent->d_name);
+ "%s/%s/kallsyms", dir, nd->s);
if (!validate_kcore_addresses(kallsyms_filename, map)) {
strlcpy(dir, kallsyms_filename, dir_sz);
ret = 0;
@@ -1622,7 +1624,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
}
}
- closedir(d);
+ strlist__delete(dirs);
return ret;
}
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-05-11 17:50 +0200 |
| Subject | Re: [PATCH perf/core v7 05/21] perf symbol: Use lsdir for search in kcore cache directory |
| Message-ID | <rxEyB-2Hv-3@gated-at.bofh.it> |
| In reply to | #1399114 |
Em Wed, May 11, 2016 at 10:52:08PM +0900, Masami Hiramatsu escreveu: > Use lsdir for search in kcore cache directory. This also > avoid checking hidden dot directory entries, because > kcore cache directories must always have the name from > timestamps when taking the kcore snapshots, and it never > start with dot. Applied
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Masami Hiramatsu <tipbot@zytor.com> |
|---|---|
| Date | 2016-05-12 12:30 +0200 |
| Subject | [tip:perf/core] perf symbols: Use lsdir() for the search in kcore cache directory |
| Message-ID | <rxW2v-3Gh-41@gated-at.bofh.it> |
| In reply to | #1399114 |
Commit-ID: c48903b816e6cdffb09b473352851bf199d0c582
Gitweb: http://git.kernel.org/tip/c48903b816e6cdffb09b473352851bf199d0c582
Author: Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Wed, 11 May 2016 22:52:08 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 May 2016 13:06:07 -0300
perf symbols: Use lsdir() for the search in kcore cache directory
Use lsdir() to search in kcore cache directory. This also avoids
checking hidden dot directory entries, because kcore cache directories
must always have the name from timestamps when taking the kcore
snapshots, and it never start with dot.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
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/20160511135208.23943.68071.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 4ada5a4..7fb3330 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1608,25 +1608,27 @@ out:
return err;
}
+static bool visible_dir_filter(const char *name, struct dirent *d)
+{
+ if (d->d_type != DT_DIR)
+ return false;
+ return lsdir_no_dot_filter(name, d);
+}
+
static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
{
char kallsyms_filename[PATH_MAX];
- struct dirent *dent;
int ret = -1;
- DIR *d;
+ struct strlist *dirs;
+ struct str_node *nd;
- d = opendir(dir);
- if (!d)
+ dirs = lsdir(dir, visible_dir_filter);
+ if (!dirs)
return -1;
- while (1) {
- dent = readdir(d);
- if (!dent)
- break;
- if (dent->d_type != DT_DIR)
- continue;
+ strlist__for_each(nd, dirs) {
scnprintf(kallsyms_filename, sizeof(kallsyms_filename),
- "%s/%s/kallsyms", dir, dent->d_name);
+ "%s/%s/kallsyms", dir, nd->s);
if (!validate_kcore_addresses(kallsyms_filename, map)) {
strlcpy(dir, kallsyms_filename, dir_sz);
ret = 0;
@@ -1634,7 +1636,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
}
}
- closedir(d);
+ strlist__delete(dirs);
return ret;
}
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web