qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv3 1/9] refresh iov_* functions


From: Michael Tokarev
Subject: Re: [Qemu-devel] [PATCHv3 1/9] refresh iov_* functions
Date: Tue, 13 Mar 2012 22:28:04 +0400
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:8.0) Gecko/20120216 Icedove/8.0

On 13.03.2012 21:44, Paolo Bonzini wrote:
> Il 12/03/2012 20:14, Michael Tokarev ha scritto:
>> +    for (i = 0, done = 0; done < bytes && i < iov_cnt; i++) {
>> +        if (offset < iov[i].iov_len) {
>> +            size_t len = MIN(iov[i].iov_len - offset, bytes - done);
>> +            memcpy(iov[i].iov_base + offset, buf + done, len);
>> +            done += len;
>> +            offset = 0;
>> +        } else {
>> +            offset -= iov[i].iov_len;
>>          }
>> -        iovec_off += iov[i].iov_len;
>>      }
>> -    return buf_off;
>> +    assert(offset == 0);
> 
> This needs to be assert(offset == 0 || done == 0).

Nope.  All these functions actually allow to specify very
large value for `bytes' (and I suggested using -1 for it
to mean "up to the end").  Only offset must be within
the iovec.

>> +    return done;
> 
> Otherwise looks good, but I must say I do not like changing the API
> *and* the implementation in the same patch.  It seems like a
> bisectability nightmare (and reviewing nightmare, too).  I do prefer
> your new code though.

I changed it all to be the same and actually verified.
Sure I can split it into two patches -- that should be
easy, will do that in a moment...  Just like I did with
qemu_sendv_recvv().  The whole thing is just trivial but.. ;)

Thank you for the review!

> Paolo

/mjt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]