From patchwork Fri Mar 25 07:42:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 8668821 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 79837C0553 for ; Fri, 25 Mar 2016 07:44:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA2B020394 for ; Fri, 25 Mar 2016 07:44:41 +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 A468520379 for ; Fri, 25 Mar 2016 07:44:40 +0000 (UTC) Received: from localhost ([::1]:54484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajMQB-0008J0-VS for patchwork-qemu-devel@patchwork.kernel.org; Fri, 25 Mar 2016 03:44:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajMP7-0007yJ-0Z for qemu-devel@nongnu.org; Fri, 25 Mar 2016 03:44:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ajMNy-0005E2-IA for qemu-devel@nongnu.org; Fri, 25 Mar 2016 03:43:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajMNy-0005Dy-9I for qemu-devel@nongnu.org; Fri, 25 Mar 2016 03:42:22 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D6AAB6438E; Fri, 25 Mar 2016 07:42:21 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (vpn1-7-152.pek2.redhat.com [10.72.7.152]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2P7gCkK012304; Fri, 25 Mar 2016 03:42:19 -0400 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 25 Mar 2016 15:42:05 +0800 Message-Id: <1458891729-28131-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1458891729-28131-1-git-send-email-jasowang@redhat.com> References: <1458891729-28131-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 25 Mar 2016 07:42:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: Jason Wang , Li Zhijian , Zhang Chen Subject: [Qemu-devel] [PULL 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 2e2ed27..1b1ec16 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -34,11 +34,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; @@ -50,14 +49,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; @@ -76,9 +75,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)); }