From patchwork Wed Mar 30 01:22:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 8692161 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1470AC0553 for ; Wed, 30 Mar 2016 01:23:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6933C20351 for ; Wed, 30 Mar 2016 01:23:23 +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 B2BC2202F8 for ; Wed, 30 Mar 2016 01:23:22 +0000 (UTC) Received: from localhost ([::1]:51312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al4qw-0007UA-23 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Mar 2016 21:23:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al4qg-0007Pk-FY for qemu-devel@nongnu.org; Tue, 29 Mar 2016 21:23:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1al4qf-0008OG-Ew for qemu-devel@nongnu.org; Tue, 29 Mar 2016 21:23:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al4qf-0008OC-9R for qemu-devel@nongnu.org; Tue, 29 Mar 2016 21:23:05 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id EE63380E42; Wed, 30 Mar 2016 01:23:04 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (vpn1-7-94.pek2.redhat.com [10.72.7.94]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2U1Mu21025729; Tue, 29 Mar 2016 21:23:03 -0400 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Wed, 30 Mar 2016 09:22:51 +0800 Message-Id: <1459300975-5987-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1459300975-5987-1-git-send-email-jasowang@redhat.com> References: <1459300975-5987-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jason Wang , Li Zhijian , Zhang Chen Subject: [Qemu-devel] [PULL V2 3/7] 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 From: Zhang Chen 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 Signed-off-by: Jason Wang --- 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 37bfe80..78969e8 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -35,11 +35,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; @@ -51,14 +50,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; @@ -77,9 +76,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)); }