qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>,
	Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Subject: [Qemu-devel] [PULL 3/7] net/filter-mirror: Change filter_mirror_send interface
Date: Fri, 25 Mar 2016 15:42:05 +0800	[thread overview]
Message-ID: <1458891729-28131-4-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1458891729-28131-1-git-send-email-jasowang@redhat.com>

From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>

Change filter_mirror_send interface to make it easier
to used by other filter

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 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));
     }
-- 
2.5.0

  parent reply	other threads:[~2016-03-25  7:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-25  7:42 [Qemu-devel] [PULL 0/7] Net patches Jason Wang
2016-03-25  7:42 ` [Qemu-devel] [PULL 1/7] net/filter-mirror:Add filter-mirror Jason Wang
2016-03-25  7:42 ` [Qemu-devel] [PULL 2/7] tests/test-filter-mirror:add filter-mirror unit test Jason Wang
2016-03-25  7:42 ` Jason Wang [this message]
2016-03-25  7:42 ` [Qemu-devel] [PULL 4/7] net/filter-mirror: implement filter-redirector Jason Wang
2016-03-25  7:42 ` [Qemu-devel] [PULL 5/7] tests/test-filter-redirector: Add unit test for filter-redirector Jason Wang
2016-03-25  7:42 ` [Qemu-devel] [PULL 6/7] e1000: Fixing interrupts pace Jason Wang
2016-03-25  7:42 ` [Qemu-devel] [PULL 7/7] Revert "e1000: fix hang of win2k12 shutdown with flood ping" Jason Wang
2016-03-29 16:39 ` [Qemu-devel] [PULL 0/7] Net patches Peter Maydell
2016-03-30  1:20   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458891729-28131-4-git-send-email-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhangchen.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).