lkml.org 
[lkml]   [2017]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 01/13] perf header: encapsulate read and swap
On Wed, May 24, 2017 at 8:35 AM, Namhyung Kim <namhyung@kernel.org> wrote:
> On Tue, May 23, 2017 at 12:48:41AM -0700, David Carrillo-Cisneros wrote:
>> Most callers of readn in perf header read either a 32 or a 64 bits
>> number, error check it and swap it, if necessary.
>>
>> Create do_read_u32 and do_read_u64 to simplify this usage.
>>
>> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
>> ---
>> tools/perf/util/header.c | 212 +++++++++++++++++------------------------------
>> 1 file changed, 76 insertions(+), 136 deletions(-)
>>
>> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
>> index 948b2c5efb65..1dd4dbe13f88 100644
>> --- a/tools/perf/util/header.c
>> +++ b/tools/perf/util/header.c
>> @@ -117,27 +117,56 @@ static int do_write_string(int fd, const char *str)
>> return write_padded(fd, str, olen, len);
>> }
>>
>> +static int __do_read(int fd, void *addr, ssize_t size)
>> +{
>> + ssize_t ret = readn(fd, addr, size);
>> +
>> + if (ret != (ssize_t)size)
>
> The 'size' is already ssize_t.

Will fix.

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