Re: KVM Block Device Driver

Wolfgang Richter
2013-08-14T19:43:05Z

I'd expect it would be something with QEMUIOvector :-) Glad you found it!

On Wed, Aug 14, 2013 at 2:44 PM, Spensky, Chad - 0559 - MITLL
<chad.spensky@ll.mit.edu> wrote:
> Wolfgang,
>
> Thanks so much for the response. It turns out that wasn't handling the
> QEMUIOVector properly. When I first implemented it, I saw that the iovec
> was a pointer and assumed that there would only ever be one. Given the
> lack of documentation and my lack of understanding this went undetected
> for a while. everything now seems to work just fine. :-) See below for
> the portion of code that threw me off. Thanks again!

Just so you know (possibly to be safer?) the code I use was based on
these functions (used to be declared qemu-common.h and iov.h, moved or
refactored I think recently?):

void qemu_iovec_to_fd(int fd, QEMUIOVector *qiov);
void iov_to_fd(int fd, const struct iovec *iov, unsigned int iov_cnt);

void qemu_iovec_to_fd(int fd, QEMUIOVector *qiov)
{
iov_to_fd(fd, qiov->iov, qiov->niov);
}

void iov_to_fd(int fd, const struct iovec *iov, const unsigned int iov_cnt)
{
unsigned int i;
for (i = 0; i < iov_cnt; i++)
{
assert(qemu_write_full(fd, iov[i].iov_base, iov[i].iov_len) ==
iov[i].iov_len);
}
}

Thus, you have to loop through the iovector (as I think you found and
just fixed).

--
Wolf