aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/virtio-9p.c
diff options
context:
space:
mode:
authorWei Liu <wei.liu2@citrix.com>2015-12-02 14:22:04 +0000
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2016-01-08 14:53:39 +0530
commit0e2082d9e5aafbde9d1cf71159ce0123cd9fda05 (patch)
tree7bd14a6c77b3a8efb35f3950bc4e47f9037435f5 /hw/9pfs/virtio-9p.c
parentdc295f83538e936895c0e26d817b1a123c384c82 (diff)
downloadqemu-0e2082d9e5aafbde9d1cf71159ce0123cd9fda05.zip
qemu-0e2082d9e5aafbde9d1cf71159ce0123cd9fda05.tar.gz
qemu-0e2082d9e5aafbde9d1cf71159ce0123cd9fda05.tar.bz2
9pfs: make pdu_{,un}marshal proper functions
Factor out v9fs_iov_v{,un}marshal. Implement pdu_{,un}marshal with those functions. 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.c')
-rw-r--r--hw/9pfs/virtio-9p.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index d8ce12e..a740f85 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -39,6 +39,32 @@ enum {
Oappend = 0x80,
};
+ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
+{
+ ssize_t ret;
+ va_list ap;
+
+ va_start(ap, fmt);
+ ret = v9fs_iov_vmarshal(pdu->elem.in_sg, pdu->elem.in_num,
+ offset, 1, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
+ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
+{
+ ssize_t ret;
+ va_list ap;
+
+ va_start(ap, fmt);
+ ret = v9fs_iov_vunmarshal(pdu->elem.out_sg, pdu->elem.out_num,
+ offset, 1, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
static int omode_to_uflags(int8_t mode)
{
int ret = 0;