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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCHv3 1/9] refresh iov_* functions
Date: Tue, 13 Mar 2012 18:44:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

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).

> +    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.

Paolo



reply via email to

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