From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751406AbdFEJ6G (ORCPT ); Mon, 5 Jun 2017 05:58:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55918 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751287AbdFEJ6F (ORCPT ); Mon, 5 Jun 2017 05:58:05 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 74E2A142A9F Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 74E2A142A9F Date: Mon, 5 Jun 2017 11:58:01 +0200 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , kernel-team@lge.com, David Ahern , Adrian Hunter Subject: Re: [PATCH v2 1/3] perf tools: Introduce dso__decompress_kmodule_{fd,path} Message-ID: <20170605095801.GA2253@krava> References: <20170603020033.28677-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170603020033.28677-1-namhyung@kernel.org> User-Agent: Mutt/1.8.0 (2017-02-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 05 Jun 2017 09:58:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 03, 2017 at 11:00:31AM +0900, Namhyung Kim wrote: > Move decompress_kmodule() to util/dso.c and split it to two functions > returning fd and (decompressed) file path. Existing user only wants the > fd version but the path version will be used soon. > > Signed-off-by: Namhyung Kim > --- > tools/perf/util/dso.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ > tools/perf/util/dso.h | 3 +++ > tools/perf/util/symbol-elf.c | 36 +------------------------------ > 3 files changed, 55 insertions(+), 35 deletions(-) > > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c > index b27d127cdf68..fc4747a8c283 100644 > --- a/tools/perf/util/dso.c > +++ b/tools/perf/util/dso.c > @@ -248,6 +248,57 @@ bool dso__needs_decompress(struct dso *dso) > dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; > } > > +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; the original code had also DSO_BINARY_TYPE__BUILD_ID_CACHE check, not sure why though.. ;-) jirka