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


Groups > linux.kernel > #1659935

[PATCH v3 2/6] perf annotate: Use dso__decompress_kmodule_path()

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v3 2/6] perf annotate: Use dso__decompress_kmodule_path()
Date 2017-06-07 17:40 +0200
Message-ID <tPLdT-8rQ-15@gated-at.bofh.it> (permalink)
References <tPLdT-8rQ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Convert open-coded decompress routine to use the function.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 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 1367d7e35242..bc4f81b5cf73 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1423,31 +1423,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.13.0

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


Thread

[PATCHSET v3 0/6] perf tools: Fix for Compressed kernel modules Namhyung Kim <namhyung@kernel.org> - 2017-06-07 17:40 +0200
  [PATCH v3 3/6] perf tools: Decompress kernel module when reading DSO data Namhyung Kim <namhyung@kernel.org> - 2017-06-07 17:40 +0200
    Re: [PATCH v3 3/6] perf tools: Decompress kernel module when reading  DSO data Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-08 00:30 +0200
      Re: [PATCH v3 3/6] perf tools: Decompress kernel module when reading  DSO data Namhyung Kim <namhyung@kernel.org> - 2017-06-08 02:00 +0200
  [PATCH v3 2/6] perf annotate: Use dso__decompress_kmodule_path() Namhyung Kim <namhyung@kernel.org> - 2017-06-07 17:40 +0200
  [PATCH v3 6/6] perf symbols: Kill dso__build_id_is_kmod() Namhyung Kim <namhyung@kernel.org> - 2017-06-07 17:50 +0200
  [PATCH v3 4/6] perf test: Decompress kernel module before objdump Namhyung Kim <namhyung@kernel.org> - 2017-06-07 17:50 +0200
    Re: [PATCH v3 4/6] perf test: Decompress kernel module before objdump Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-08 00:30 +0200
      Re: [PATCH v3 4/6] perf test: Decompress kernel module before objdump Namhyung Kim <namhyung@kernel.org> - 2017-06-08 02:00 +0200
      Re: [PATCH v3 4/6] perf test: Decompress kernel module before objdump Namhyung Kim <namhyung@kernel.org> - 2017-06-08 02:40 +0200
  [PATCH v3 5/6] perf symbols: Keep DSO->symtab_type after decompress Namhyung Kim <namhyung@kernel.org> - 2017-06-07 17:50 +0200
  [PATCH v3 1/6] perf tools: Introduce dso__decompress_kmodule_{fd,path} Namhyung Kim <namhyung@kernel.org> - 2017-06-07 17:50 +0200

csiph-web