From patchwork Mon Mar 7 09:48:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 8516881 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 051AC9F8A8 for ; Mon, 7 Mar 2016 09:48:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 650432017D for ; Mon, 7 Mar 2016 09:48:54 +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 A48FF20148 for ; Mon, 7 Mar 2016 09:48:53 +0000 (UTC) Received: from localhost ([::1]:54697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acrmX-0005Yh-5U for patchwork-qemu-devel@patchwork.kernel.org; Mon, 07 Mar 2016 04:48:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acrln-0004iH-32 for qemu-devel@nongnu.org; Mon, 07 Mar 2016 04:48:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acrli-0006IJ-Az for qemu-devel@nongnu.org; Mon, 07 Mar 2016 04:48:07 -0500 Received: from [59.151.112.132] (port=28347 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acrlg-0006A6-RH for qemu-devel@nongnu.org; Mon, 07 Mar 2016 04:48:02 -0500 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4303074" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 07 Mar 2016 17:47:44 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 6EC7C42AC84B; Mon, 7 Mar 2016 17:47:40 +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; Mon, 7 Mar 2016 17:47:39 +0800 From: Zhang Chen To: qemu devel , Jason Wang Date: Mon, 7 Mar 2016 17:48:46 +0800 Message-ID: <1457344126-12259-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.167.226.56] X-yoursite-MailScanner-ID: 6EC7C42AC84B.AE0BB 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] 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 Signed-off-by Li Zhijian --- net/filter-mirror.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/filter-mirror.c b/net/filter-mirror.c index ee13d94..10bade6 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, - const struct iovec *iov, - int iovcnt) +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)); }