[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-dde755a90e98a1c57f6a92d1a79bc5554024065c@git.kernel.org>
Date: Thu, 23 Aug 2018 01:42:50 -0700
From: tip-bot for Jiri Olsa <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, dsahern@...il.com, tglx@...utronix.de,
mpetlan@...hat.com, peterz@...radead.org, jolsa@...nel.org,
alexander.shishkin@...ux.intel.com, acme@...hat.com,
linux-kernel@...r.kernel.org, namhyung@...nel.org, mingo@...nel.org
Subject: [tip:perf/urgent] perf tools: Use compression id in
decompress_kmodule()
Commit-ID: dde755a90e98a1c57f6a92d1a79bc5554024065c
Gitweb: https://git.kernel.org/tip/dde755a90e98a1c57f6a92d1a79bc5554024065c
Author: Jiri Olsa <jolsa@...nel.org>
AuthorDate: Fri, 17 Aug 2018 11:48:08 +0200
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 20 Aug 2018 08:54:59 -0300
perf tools: Use compression id in decompress_kmodule()
Once we parsed out the compression ID, we dont need to iterate all
available compressions and we can call it directly.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Michael Petlan <mpetlan@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/20180817094813.15086-9-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/dso.c | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index d875e6956a3e..54bfe1f4762f 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -244,18 +244,6 @@ bool is_kernel_module(const char *pathname, int cpumode)
return m.kmod;
}
-static bool decompress_to_file(const char *ext, const char *filename, int output_fd)
-{
- unsigned i;
-
- for (i = 0; compressions[i].fmt; i++) {
- if (!strcmp(ext, compressions[i].fmt))
- return !compressions[i].decompress(filename,
- output_fd);
- }
- return false;
-}
-
bool dso__needs_decompress(struct dso *dso)
{
return dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
@@ -265,31 +253,25 @@ bool dso__needs_decompress(struct dso *dso)
static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf)
{
int fd = -1;
- struct kmod_path m;
if (!dso__needs_decompress(dso))
return -1;
- if (kmod_path__parse_ext(&m, dso->long_name))
+ if (dso->comp == COMP_ID__NONE)
return -1;
- if (!m.comp)
- goto out;
-
fd = mkstemp(tmpbuf);
if (fd < 0) {
dso->load_errno = errno;
- goto out;
+ return -1;
}
- if (!decompress_to_file(m.ext, name, fd)) {
+ if (compressions[dso->comp].decompress(name, fd)) {
dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE;
close(fd);
fd = -1;
}
-out:
- free(m.ext);
return fd;
}
Powered by blists - more mailing lists