lkml.org 
[lkml]   [2017]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/2] perf tools: Decompress kernel module when reading DSO data
Hi Jiri,

On Thu, Jun 1, 2017 at 8:29 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Thu, Jun 01, 2017 at 06:06:04PM +0900, Namhyung Kim wrote:
>
> SNIP
>
>> @@ -399,6 +438,7 @@ static int __open_dso(struct dso *dso, struct machine *machine)
>> int fd;
>> char *root_dir = (char *)"";
>> char *name = malloc(PATH_MAX);
>> + bool needs_unlink = false;
>>
>> if (!name)
>> return -ENOMEM;
>> @@ -415,7 +455,23 @@ static int __open_dso(struct dso *dso, struct machine *machine)
>> if (!is_regular_file(name))
>> return -EINVAL;
>>
>> + if (dso__needs_decompress(dso)) {
>> + char buf[32];
>> +
>> + fd = dso__decompress_kmodule(dso, name, buf, sizeof(buf));
>> + if (fd < 0)
>
> free(name)

ok.

>
>> + return -1;
>> +
>> + close(fd);
>> + strcpy(name, buf);
>
> also why not use name directly instead of buf?

The name should have original compressed filename and buf will be set
to a new decompressed name.

Thanks,
Namhyung

\
 
 \ /
  Last update: 2017-06-05 00:16    [W:0.100 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site