Patchwork [RFC,06/20] Introduce iovec util functions, qemu_iovec_to_vector() and qemu_iovec_to_size().

login
register
mail settings
Submitter Yoshiaki Tamura
Date April 21, 2010, 5:57 a.m.
Message ID <1271829445-5328-7-git-send-email-tamura.yoshiaki@lab.ntt.co.jp>
Download mbox | patch
Permalink /patch/50621/
State New
Headers show

Comments

Yoshiaki Tamura - April 21, 2010, 5:57 a.m.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
 cutils.c      |   12 ++++++++++++
 qemu-common.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

Patch

diff --git a/cutils.c b/cutils.c
index be99b21..1d35590 100644
--- a/cutils.c
+++ b/cutils.c
@@ -238,3 +238,15 @@  void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count)
         count -= copy;
     }
 }
+
+void qemu_iovec_to_vector(QEMUIOVector *qiov, struct iovec **iov, int *count)
+{
+    *iov = qiov->iov;
+    *count = qiov->niov;
+}
+
+void qemu_iovec_to_size(QEMUIOVector *qiov, size_t *size)
+{
+    *size = qiov->size;
+}
+
diff --git a/qemu-common.h b/qemu-common.h
index 2e5f3a7..0af30d2 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -273,6 +273,8 @@  void qemu_iovec_destroy(QEMUIOVector *qiov);
 void qemu_iovec_reset(QEMUIOVector *qiov);
 void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf);
 void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count);
+void qemu_iovec_to_vector(QEMUIOVector *qiov, struct iovec **iov, int *niov);
+void qemu_iovec_to_size(QEMUIOVector *qiov, size_t *size);
 
 struct Monitor;
 typedef struct Monitor Monitor;