qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 17/22] 9pfs: factor out virtio_pdu_{, un}marshal


From: Wei Liu
Subject: [Qemu-devel] [PATCH 17/22] 9pfs: factor out virtio_pdu_{, un}marshal
Date: Tue, 5 Jan 2016 19:05:56 +0000

Signed-off-by: Wei Liu <address@hidden>
---
 hw/9pfs/virtio-9p-device.c | 14 ++++++++++++++
 hw/9pfs/virtio-9p.c        |  6 ++----
 hw/9pfs/virtio-9p.h        |  5 +++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index f3091cc..d77247f 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -156,6 +156,20 @@ static void virtio_9p_device_unrealize(DeviceState *dev, 
Error **errp)
     g_free(s->tag);
 }
 
+ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset,
+                            const char *fmt, va_list ap)
+{
+    return v9fs_iov_vmarshal(pdu->elem.in_sg, pdu->elem.in_num,
+                             offset, 1, fmt, ap);
+}
+
+ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
+                              const char *fmt, va_list ap)
+{
+    return v9fs_iov_vunmarshal(pdu->elem.out_sg, pdu->elem.out_num,
+                               offset, 1, fmt, ap);
+}
+
 /* virtio-9p device */
 
 static Property virtio_9p_properties[] = {
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 780c398..db79a48 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -45,8 +45,7 @@ ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char 
*fmt, ...)
     va_list ap;
 
     va_start(ap, fmt);
-    ret = v9fs_iov_vmarshal(pdu->elem.in_sg, pdu->elem.in_num,
-                            offset, 1, fmt, ap);
+    ret = virtio_pdu_vmarshal(pdu, offset, fmt, ap);
     va_end(ap);
 
     return ret;
@@ -58,8 +57,7 @@ ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char 
*fmt, ...)
     va_list ap;
 
     va_start(ap, fmt);
-    ret = v9fs_iov_vunmarshal(pdu->elem.out_sg, pdu->elem.out_num,
-                              offset, 1, fmt, ap);
+    ret = virtio_pdu_vunmarshal(pdu, offset, fmt, ap);
     va_end(ap);
 
     return ret;
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index d6f3ac0..e298949 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -323,6 +323,11 @@ extern int v9fs_name_to_path(V9fsState *s, V9fsPath 
*dirpath,
 ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...);
 ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...);
 
+ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset,
+                            const char *fmt, va_list ap);
+ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
+                              const char *fmt, va_list ap);
+
 #define TYPE_VIRTIO_9P "virtio-9p-device"
 #define VIRTIO_9P(obj) \
         OBJECT_CHECK(V9fsState, (obj), TYPE_VIRTIO_9P)
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]