diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-01-20 11:01:10 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-01-20 11:01:10 -0600 |
commit | 8b17ed4caa7e015324a4ecbe3c863e32458d840a (patch) | |
tree | e323612dffd78dd4cb75f58f731d208c0bf9ffce /block/win32-aio.c | |
parent | b54c2873e731dd6fc81a4591cab909633b5a9eab (diff) | |
parent | cf139388ad5b39228793f34eea99e0ea9a2924aa (diff) |
Merge remote-tracking branch 'stefanha/block' into staging
# By Kevin Wolf (4) and others
# Via Stefan Hajnoczi
* stefanha/block:
dataplane: support viostor virtio-pci status bit setting
dataplane: avoid reentrancy during virtio_blk_data_plane_stop()
win32-aio: use iov utility functions instead of open-coding them
win32-aio: Fix memory leak
win32-aio: Fix vectored reads
aio: Fix return value of aio_poll()
ide: Remove wrong assertion
block: fix null-pointer bug on error case in block commit
Diffstat (limited to 'block/win32-aio.c')
-rw-r--r-- | block/win32-aio.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/block/win32-aio.c b/block/win32-aio.c index 03833700b4..5d0fbbfb7d 100644 --- a/block/win32-aio.c +++ b/block/win32-aio.c @@ -29,6 +29,7 @@ #include "block/aio.h" #include "raw-aio.h" #include "qemu/event_notifier.h" +#include "qemu/iov.h" #include <windows.h> #include <winioctl.h> @@ -80,15 +81,9 @@ static void win32_aio_process_completion(QEMUWin32AIOState *s, if (!waiocb->is_linear) { if (ret == 0 && waiocb->is_read) { QEMUIOVector *qiov = waiocb->qiov; - char *p = waiocb->buf; - int i; - - for (i = 0; i < qiov->niov; ++i) { - memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len); - p += qiov->iov[i].iov_len; - } - qemu_vfree(waiocb->buf); + iov_from_buf(qiov->iov, qiov->niov, 0, waiocb->buf, qiov->size); } + qemu_vfree(waiocb->buf); } @@ -153,13 +148,7 @@ BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs, if (qiov->niov > 1) { waiocb->buf = qemu_blockalign(bs, qiov->size); if (type & QEMU_AIO_WRITE) { - char *p = waiocb->buf; - int i; - - for (i = 0; i < qiov->niov; ++i) { - memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len); - p += qiov->iov[i].iov_len; - } + iov_to_buf(qiov->iov, qiov->niov, 0, waiocb->buf, qiov->size); } waiocb->is_linear = false; } else { |