[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/7] util: add return value to qemu_iovec_concat_iov
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 1/7] util: add return value to qemu_iovec_concat_iov |
Date: |
Thu, 12 Jun 2014 14:09:02 +0200 |
This will be necessary later to recognize the case where a
request has both dataout and datain.
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/qemu-common.h | 6 +++---
util/iov.c | 10 ++++++----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 66ceceb..ae76197 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -315,9 +315,9 @@ void qemu_iovec_init_external(QEMUIOVector *qiov, struct
iovec *iov, int niov);
void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
void qemu_iovec_concat(QEMUIOVector *dst,
QEMUIOVector *src, size_t soffset, size_t sbytes);
-void qemu_iovec_concat_iov(QEMUIOVector *dst,
- struct iovec *src_iov, unsigned int src_cnt,
- size_t soffset, size_t sbytes);
+size_t qemu_iovec_concat_iov(QEMUIOVector *dst,
+ struct iovec *src_iov, unsigned int src_cnt,
+ size_t soffset, size_t sbytes);
bool qemu_iovec_is_zero(QEMUIOVector *qiov);
void qemu_iovec_destroy(QEMUIOVector *qiov);
void qemu_iovec_reset(QEMUIOVector *qiov);
diff --git a/util/iov.c b/util/iov.c
index 49f8838..2b4f46d 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -295,15 +295,15 @@ void qemu_iovec_add(QEMUIOVector *qiov, void *base,
size_t len)
* of src".
* Only vector pointers are processed, not the actual data buffers.
*/
-void qemu_iovec_concat_iov(QEMUIOVector *dst,
- struct iovec *src_iov, unsigned int src_cnt,
- size_t soffset, size_t sbytes)
+size_t qemu_iovec_concat_iov(QEMUIOVector *dst,
+ struct iovec *src_iov, unsigned int src_cnt,
+ size_t soffset, size_t sbytes)
{
int i;
size_t done;
if (!sbytes) {
- return;
+ return 0;
}
assert(dst->nalloc != -1);
for (i = 0, done = 0; done < sbytes && i < src_cnt; i++) {
@@ -317,6 +317,8 @@ void qemu_iovec_concat_iov(QEMUIOVector *dst,
}
}
assert(soffset == 0); /* offset beyond end of src */
+
+ return done;
}
/*
--
1.9.3
- [Qemu-devel] [PATCH 0/7] virtio-scsi: do not rely on iov boundaries, Paolo Bonzini, 2014/06/12
- [Qemu-devel] [PATCH 1/7] util: add return value to qemu_iovec_concat_iov,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 2/7] virtio-scsi: start preparing for any_layout, Paolo Bonzini, 2014/06/12
- [Qemu-devel] [PATCH 3/7] virtio-scsi: add target swap for VirtIOSCSICtrlTMFReq fields, Paolo Bonzini, 2014/06/12
- [Qemu-devel] [PATCH 4/7] virtio-scsi: add extra argument and return type to qemu_sgl_concat, Paolo Bonzini, 2014/06/12
- [Qemu-devel] [PATCH 5/7] virtio-scsi: prepare sense data handling for any_layout, Paolo Bonzini, 2014/06/12
- [Qemu-devel] [PATCH 6/7] virtio-scsi: introduce virtio_scsi_complete_cmd_req, Paolo Bonzini, 2014/06/12
- [Qemu-devel] [PATCH 7/7] virtio-scsi: add support for the any_layout feature, Paolo Bonzini, 2014/06/12