summaryrefslogtreecommitdiffstats
path: root/hw/iov.h
diff options
context:
space:
mode:
authorAmit Shah2010-04-27 14:34:05 +0200
committerAnthony Liguori2010-04-28 15:58:22 +0200
commite4d5639dbb6181ebbfdb554f2594721b2d63882b (patch)
tree1ad23eabc520022e909e73bbc3affbdfca4cc25f /hw/iov.h
parentvirtio-serial: Send out guest data to ports only if port is opened (diff)
downloadqemu-e4d5639dbb6181ebbfdb554f2594721b2d63882b.tar.gz
qemu-e4d5639dbb6181ebbfdb554f2594721b2d63882b.tar.xz
qemu-e4d5639dbb6181ebbfdb554f2594721b2d63882b.zip
iov: Introduce a new file for helpers around iovs, add iov_from_buf()
The virtio-net code uses iov_fill() which fills an iov from a linear buffer. The virtio-serial-bus code does something similar in an open-coded function. Create a new iov.c file that has iov_from_buf(). Convert virtio-net and virtio-serial-bus over to use this functionality. virtio-net used ints to hold sizes, the new function is going to use size_t types. Later commits will add the opposite functionality -- going from an iov to a linear buffer. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/iov.h')
-rw-r--r--hw/iov.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/iov.h b/hw/iov.h
new file mode 100644
index 0000000000..5e3e54123d
--- /dev/null
+++ b/hw/iov.h
@@ -0,0 +1,16 @@
+/*
+ * Helpers for getting linearized buffers from iov / filling buffers into iovs
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * Author(s):
+ * Amit Shah <amit.shah@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include "qemu-common.h"
+
+size_t iov_from_buf(struct iovec *iov, unsigned int iovcnt,
+ const void *buf, size_t size);