]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
perf annotate: Use dso__decompress_kmodule_path()
authorNamhyung Kim <namhyung@kernel.org>
Thu, 8 Jun 2017 07:31:04 +0000 (16:31 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 8 Jun 2017 18:39:02 +0000 (15:39 -0300)
Convert open-coded decompress routine to use the function.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate.c

index df4486c3a2faa35b17985f7159acaa17b08be27c..ddbd56df91878884a4de5da2a29aae991e0689a0 100644 (file)
@@ -1431,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na
                                sizeof(symfs_filename));
                }
        } else if (dso__needs_decompress(dso)) {
-               char tmp[PATH_MAX];
-               struct kmod_path m;
-               int fd;
-               bool ret;
+               char tmp[KMOD_DECOMP_LEN];
 
-               if (kmod_path__parse_ext(&m, symfs_filename))
-                       goto out;
-
-               snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX");
-
-               fd = mkstemp(tmp);
-               if (fd < 0) {
-                       free(m.ext);
-                       goto out;
-               }
-
-               ret = decompress_to_file(m.ext, symfs_filename, fd);
-
-               if (ret)
-                       pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename);
-
-               free(m.ext);
-               close(fd);
-
-               if (!ret)
+               if (dso__decompress_kmodule_path(dso, symfs_filename,
+                                                tmp, sizeof(tmp)) < 0)
                        goto out;
 
                strcpy(symfs_filename, tmp);