| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5] tools/libxc: Implement writev_exact() in the same style as write_exact()
 On 19/02/15 17:01, Ian Campbell wrote:
> On Thu, 2015-02-19 at 16:58 +0000, Andrew Cooper wrote:
>> On 19/02/15 16:39, Ian Campbell wrote:
>>> On Thu, 2015-02-19 at 11:45 +0000, Andrew Cooper wrote:
>>>
>>>> +    while ( iov_idx < iovcnt )
>>>> +    {
>>>> +        /* Skip over iov[] entries with 0 length. */
>>>> +        while ( iov[iov_idx].iov_len == 0 )
>>>> +            if ( ++iov_idx == iovcnt )
>>>> +                goto out;
>>> Is this required for some reason or just an optimisation?
>> Experimentally, submitting a writev() with every iov of length 0 results
>> in an EINVAL on CentOS 5.x
> How exciting!
>
>> This causes a failure if a partial write adjustment happens and only iov
>> entries of length 0 remain in the set.
> If only entries of length 0 remain then isn't that a complete-write of
> the final non-empty entry?
Hmm - I think you are right.  This loop might now be redundant with the
partial iov[] handling below.  That bit of code did the hokey-cokey
several times.
On the other hand, I seem to remember that it ended up like this very
deliberately, and that I couldn't cover the edge case with only one
loop.  I think I am going to have to debug this back into existence again.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |