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 <namhy...@kernel.org>
> ---
>  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

Reply via email to