lkml.org 
[lkml]   [2014]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 03/37] perf tools: Use perf_data_file__fd() consistently
On Sat, Dec 27, 2014 at 1:30 AM, David Ahern <dsahern@gmail.com> wrote:
> On 12/24/14 12:14 AM, Namhyung Kim wrote:
>
>> diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
>> index 84df2deed988..d8b13407594d 100644
>> --- a/tools/perf/builtin-inject.c
>> +++ b/tools/perf/builtin-inject.c
>> @@ -375,8 +375,10 @@ static int __cmd_inject(struct perf_inject *inject)
>> }
>> }
>>
>
> How about a local variable to make this more readable?
> fd = perf_data_file__fd(file_out)

Will do.


>
>> - if (!file_out->is_pipe)
>> - lseek(file_out->fd, session->header.data_offset,
>> SEEK_SET);
>> + if (!file_out->is_pipe) {
>> + lseek(perf_data_file__fd(file_out),
>> session->header.data_offset,
>> + SEEK_SET);
>> + }
>>
>> ret = perf_session__process_events(session, &inject->tool);
>>
>> @@ -385,7 +387,8 @@ static int __cmd_inject(struct perf_inject *inject)
>> perf_header__set_feat(&session->header,
>> HEADER_BUILD_ID);
>> session->header.data_size = inject->bytes_written;
>> - perf_session__write_header(session, session->evlist,
>> file_out->fd, true);
>> + perf_session__write_header(session, session->evlist,
>> + perf_data_file__fd(file_out),
>> true);
>> }
>>
>> return ret;
>> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
>> index aa5fa6aabb31..054c6e57d3b9 100644
>> --- a/tools/perf/builtin-record.c
>> +++ b/tools/perf/builtin-record.c
>> @@ -196,7 +196,7 @@ static int process_buildids(struct record *rec)
>> struct perf_session *session = rec->session;
>> u64 start = session->header.data_offset;
>>
>> - u64 size = lseek(file->fd, 0, SEEK_CUR);
>> + u64 size = lseek(perf_data_file__fd(file), 0, SEEK_CUR);
>> if (size == 0)
>> return 0;
>>
>> @@ -360,12 +360,12 @@ static int __cmd_record(struct record *rec, int
>> argc, const char **argv)
>> perf_header__clear_feat(&session->header,
>> HEADER_GROUP_DESC);
>
>
> Similarly in this function.

No problem.

Thanks,
Namhyung


\
 
 \ /
  Last update: 2014-12-27 07:01    [W:0.110 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site