From patchwork Fri Mar 4 12:01:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 8503431 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E2F49F38C for ; Fri, 4 Mar 2016 12:01:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CE01201C7 for ; Fri, 4 Mar 2016 12:01:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C310200E6 for ; Fri, 4 Mar 2016 12:01:36 +0000 (UTC) Received: from localhost ([::1]:40709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aboQJ-0003de-R5 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Mar 2016 07:01:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aboQ7-0003aT-6x for qemu-devel@nongnu.org; Fri, 04 Mar 2016 07:01:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aboQ1-0006rF-8h for qemu-devel@nongnu.org; Fri, 04 Mar 2016 07:01:23 -0500 Received: from [59.151.112.132] (port=26185 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aboPz-0006oI-9A for qemu-devel@nongnu.org; Fri, 04 Mar 2016 07:01:17 -0500 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4237830" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Mar 2016 20:00:53 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id EF15C42B4B05; Fri, 4 Mar 2016 20:00:49 +0800 (CST) Received: from G08FNSTD140215.g08.fujitsu.local (10.167.226.56) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 4 Mar 2016 20:00:49 +0800 From: Zhang Chen To: qemu devel , Jason Wang Date: Fri, 4 Mar 2016 20:01:44 +0800 Message-ID: <1457092906-19828-2-git-send-email-zhangchen.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457092906-19828-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> References: <1457092906-19828-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.56] X-yoursite-MailScanner-ID: EF15C42B4B05.AEDAA X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhangchen.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: Li Zhijian , Gui jianfeng , "eddie.dong" , zhanghailiang , "Dr. David Alan Gilbert" , Zhang Chen , Yang Hongyang Subject: [Qemu-devel] [PATCH V3 1/3] net/filter-mirror: Change filter_mirror_send interface 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change filter_mirror_send interface to make it easier to used by other filter Signed-off-by: Zhang Chen Signed-off-by: Wen Congyang --- net/filter-mirror.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/filter-mirror.c b/net/filter-mirror.c index ee13d94..4ff7619 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -33,11 +33,10 @@ typedef struct MirrorState { CharDriverState *chr_out; } MirrorState; -static int filter_mirror_send(NetFilterState *nf, +static int filter_mirror_send(CharDriverState *chr_out, const struct iovec *iov, int iovcnt) { - MirrorState *s = FILTER_MIRROR(nf); int ret = 0; ssize_t size = 0; uint32_t len = 0; @@ -49,14 +48,14 @@ static int filter_mirror_send(NetFilterState *nf, } len = htonl(size); - ret = qemu_chr_fe_write_all(s->chr_out, (uint8_t *)&len, sizeof(len)); + ret = qemu_chr_fe_write_all(chr_out, (uint8_t *)&len, sizeof(len)); if (ret != sizeof(len)) { goto err; } buf = g_malloc(size); iov_to_buf(iov, iovcnt, 0, buf, size); - ret = qemu_chr_fe_write_all(s->chr_out, (uint8_t *)buf, size); + ret = qemu_chr_fe_write_all(chr_out, (uint8_t *)buf, size); g_free(buf); if (ret != size) { goto err; @@ -75,9 +74,10 @@ static ssize_t filter_mirror_receive_iov(NetFilterState *nf, int iovcnt, NetPacketSent *sent_cb) { + MirrorState *s = FILTER_MIRROR(nf); int ret; - ret = filter_mirror_send(nf, iov, iovcnt); + ret = filter_mirror_send(s->chr_out, iov, iovcnt); if (ret) { error_report("filter_mirror_send failed(%s)", strerror(-ret)); }