Merge tag 'trace-fixes-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[firefly-linux-kernel-4.4.55.git] / tools / perf / util / header.c
index 893f8e2df9285237b26365922adf9b1eaa88a5ec..158c787ce0c40e8bc673e3e73062dcaef3872c4f 100644 (file)
@@ -200,6 +200,47 @@ static int write_buildid(const char *name, size_t name_len, u8 *build_id,
        return write_padded(fd, name, name_len + 1, len);
 }
 
+static int __dsos__hit_all(struct list_head *head)
+{
+       struct dso *pos;
+
+       list_for_each_entry(pos, head, node)
+               pos->hit = true;
+
+       return 0;
+}
+
+static int machine__hit_all_dsos(struct machine *machine)
+{
+       int err;
+
+       err = __dsos__hit_all(&machine->kernel_dsos);
+       if (err)
+               return err;
+
+       return __dsos__hit_all(&machine->user_dsos);
+}
+
+int dsos__hit_all(struct perf_session *session)
+{
+       struct rb_node *nd;
+       int err;
+
+       err = machine__hit_all_dsos(&session->machines.host);
+       if (err)
+               return err;
+
+       for (nd = rb_first(&session->machines.guests); nd; nd = rb_next(nd)) {
+               struct machine *pos = rb_entry(nd, struct machine, rb_node);
+
+               err = machine__hit_all_dsos(pos);
+               if (err)
+                       return err;
+       }
+
+       return 0;
+}
+
 static int __dsos__write_buildid_table(struct list_head *head,
                                       struct machine *machine,
                                       pid_t pid, u16 misc, int fd)
@@ -215,9 +256,9 @@ static int __dsos__write_buildid_table(struct list_head *head,
                if (!pos->hit)
                        continue;
 
-               if (is_vdso_map(pos->short_name)) {
-                       name = (char *) VDSO__MAP_NAME;
-                       name_len = sizeof(VDSO__MAP_NAME) + 1;
+               if (dso__is_vdso(pos)) {
+                       name = pos->short_name;
+                       name_len = pos->short_name_len + 1;
                } else if (dso__is_kcore(pos)) {
                        machine__mmap_name(machine, nm, sizeof(nm));
                        name = nm;
@@ -298,7 +339,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
 
        len = scnprintf(filename, size, "%s%s%s",
                       debugdir, slash ? "/" : "",
-                      is_vdso ? VDSO__MAP_NAME : realname);
+                      is_vdso ? DSO__NAME_VDSO : realname);
        if (mkdir_p(filename, 0755))
                goto out_free;
 
@@ -386,7 +427,7 @@ static int dso__cache_build_id(struct dso *dso, struct machine *machine,
                               const char *debugdir)
 {
        bool is_kallsyms = dso->kernel && dso->long_name[0] != '/';
-       bool is_vdso = is_vdso_map(dso->short_name);
+       bool is_vdso = dso__is_vdso(dso);
        const char *name = dso->long_name;
        char nm[PATH_MAX];