diff options
author | Namhyung Kim <namhyung@kernel.org> | 2017-06-08 03:31:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-06-08 14:39:02 -0400 |
commit | 3c84fd53044f98017271101b59a21ddb20fb312b (patch) | |
tree | b673457f8bb941913b8f60ad4f3fe8d6232869b3 | |
parent | 42b3fa670825983fc8bd0ac7b80cc84ae3abb75b (diff) |
perf annotate: Use dso__decompress_kmodule_path()
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>
-rw-r--r-- | tools/perf/util/annotate.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index df4486c3a2fa..ddbd56df9187 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1431,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na | |||
1431 | sizeof(symfs_filename)); | 1431 | sizeof(symfs_filename)); |
1432 | } | 1432 | } |
1433 | } else if (dso__needs_decompress(dso)) { | 1433 | } else if (dso__needs_decompress(dso)) { |
1434 | char tmp[PATH_MAX]; | 1434 | char tmp[KMOD_DECOMP_LEN]; |
1435 | struct kmod_path m; | ||
1436 | int fd; | ||
1437 | bool ret; | ||
1438 | 1435 | ||
1439 | if (kmod_path__parse_ext(&m, symfs_filename)) | 1436 | if (dso__decompress_kmodule_path(dso, symfs_filename, |
1440 | goto out; | 1437 | tmp, sizeof(tmp)) < 0) |
1441 | |||
1442 | snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX"); | ||
1443 | |||
1444 | fd = mkstemp(tmp); | ||
1445 | if (fd < 0) { | ||
1446 | free(m.ext); | ||
1447 | goto out; | ||
1448 | } | ||
1449 | |||
1450 | ret = decompress_to_file(m.ext, symfs_filename, fd); | ||
1451 | |||
1452 | if (ret) | ||
1453 | pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename); | ||
1454 | |||
1455 | free(m.ext); | ||
1456 | close(fd); | ||
1457 | |||
1458 | if (!ret) | ||
1459 | goto out; | 1438 | goto out; |
1460 | 1439 | ||
1461 | strcpy(symfs_filename, tmp); | 1440 | strcpy(symfs_filename, tmp); |