aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/virtio-9p-device.c
diff options
context:
space:
mode:
authorWei Liu <wei.liu2@citrix.com>2015-12-03 13:21:51 +0000
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2016-01-08 15:23:02 +0530
commit592707af7f9e7098949adae6ebf2b065456e0773 (patch)
treed17236fb35e2d10118de63f03ec972759d27a7fa /hw/9pfs/virtio-9p-device.c
parentf657b17a6394e68f985111d3db33b299deb0cc3e (diff)
9pfs: break out virtio_init_iov_from_pdu
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs/virtio-9p-device.c')
-rw-r--r--hw/9pfs/virtio-9p-device.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index d77247f3cd..5cad654d8e 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -170,6 +170,18 @@ ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
offset, 1, fmt, ap);
}
+void virtio_init_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
+ unsigned int *pniov, bool is_write)
+{
+ if (is_write) {
+ *piov = pdu->elem.out_sg;
+ *pniov = pdu->elem.out_num;
+ } else {
+ *piov = pdu->elem.in_sg;
+ *pniov = pdu->elem.in_num;
+ }
+}
+
/* virtio-9p device */
static Property virtio_9p_properties[] = {