From patchwork Tue Jan 12 06:08:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 566312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B4578140326 for ; Tue, 12 Jan 2016 17:11:25 +1100 (AEDT) Received: from localhost ([::1]:58327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIsAs-0006tJ-W9 for incoming@patchwork.ozlabs.org; Tue, 12 Jan 2016 01:11:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIs8i-0002Ue-SV for qemu-devel@nongnu.org; Tue, 12 Jan 2016 01:09:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIs8g-00067j-Fk for qemu-devel@nongnu.org; Tue, 12 Jan 2016 01:09:08 -0500 Received: from e28smtp08.in.ibm.com ([125.16.236.8]:59983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIs8f-00066x-R9 for qemu-devel@nongnu.org; Tue, 12 Jan 2016 01:09:06 -0500 Received: from localhost by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Jan 2016 11:39:03 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp08.in.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 12 Jan 2016 11:39:02 +0530 X-IBM-Helo: d28dlp02.in.ibm.com X-IBM-MailFrom: aneesh.kumar@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 0CB38394005C for ; Tue, 12 Jan 2016 11:39:02 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0C691Nm6881660 for ; Tue, 12 Jan 2016 11:39:01 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0C691sE026356 for ; Tue, 12 Jan 2016 11:39:01 +0530 Received: from skywalker.in.ibm.com (skywalker.in.ibm.com [9.124.35.51]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u0C68ZAN023715; Tue, 12 Jan 2016 11:38:50 +0530 From: "Aneesh Kumar K.V" To: peter.maydell@linaro.org Date: Tue, 12 Jan 2016 11:38:22 +0530 Message-Id: <1452578912-12546-16-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452578912-12546-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1452578912-12546-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16011206-0029-0000-0000-00000A3FF924 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 125.16.236.8 Cc: Wei Liu , qemu-devel@nongnu.org, "Aneesh Kumar K.V" Subject: [Qemu-devel] [PATCH 15/25] 9pfs: factor out virtio_pdu_{, un}marshal X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Aneesh Kumar K.V --- 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 f3091cc813e7..d77247f3cdad 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 a740f85625a3..6d32b81faa25 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 d6f3ac08a76a..e298949fde40 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)