[Top][All Lists]
[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
- [Qemu-devel] [PATCHv3 0/9] cleanup/consolidate some iovec functions, Michael Tokarev, 2012/03/12
- [Qemu-devel] [PATCHv3 2/9] consolidate qemu_iovec_memset{, _skip}() into single function and use existing iov_memset(), Michael Tokarev, 2012/03/12
- [Qemu-devel] [PATCHv3 1/9] refresh iov_* functions, Michael Tokarev, 2012/03/12
- Re: [Qemu-devel] [PATCHv3 1/9] refresh iov_* functions,
Paolo Bonzini <=
- [Qemu-devel] [PATCHv3 4/9] consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent, Michael Tokarev, 2012/03/12
- [Qemu-devel] [PATCHv3 5/9] change qemu_iovec_to_buf() to match other to, from_buf functions, Michael Tokarev, 2012/03/12
- [Qemu-devel] [PATCHv3 8/9] cleanup qemu_co_sendv(), qemu_co_recvv() and friends, Michael Tokarev, 2012/03/12
- [Qemu-devel] [PATCHv3 7/9] export qemu_sendv_recvv() and use it in qemu_sendv() and qemu_recvv(), Michael Tokarev, 2012/03/12