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


Groups > linux.kernel > #1661752

[PATCH 10/15] perf annotate: Use dso__decompress_kmodule_path()

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 10/15] perf annotate: Use dso__decompress_kmodule_path()
Date 2017-06-09 00:10 +0200
Message-ID <tQdMT-1yv-47@gated-at.bofh.it> (permalink)
References <tQdMR-1yv-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Namhyung Kim <namhyung@kernel.org>

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 | 27 +++------------------------
 1 file 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
 				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);
-- 
2.9.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 02/15] perf script: Fix outdated comment for perf-trace-python Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 14/15] perf symbols: Keep DSO->symtab_type after decompress Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 07/15] perf annotate: Fix symbolic link of build-id cache Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 15/15] perf symbols: Kill dso__build_id_is_kmod() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 08/15] perf tools: Fix a memory leak in __open_dso() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 10/15] perf annotate: Use dso__decompress_kmodule_path() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  Re: [GIT PULL 00/15] perf/urgent fixes Ingo Molnar <mingo@kernel.org> - 2017-06-09 00:50 +0200

csiph-web