summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorZhang Chen <zhangchen.fnst@cn.fujitsu.com>2016-03-15 18:02:51 +0800
committerJason Wang <jasowang@redhat.com>2016-03-30 08:57:23 +0800
commitba8940dd8691f16c0180241dab0d1c0da35a71e3 (patch)
tree2602d702690c8e63fff22822406a9c4d2d76f51c /net
parent06809ecf7312c8653964de661f932a0ed7cd0076 (diff)
downloadqemu-ba8940dd8691f16c0180241dab0d1c0da35a71e3.zip
net/filter-mirror: Change filter_mirror_send interface
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>
Diffstat (limited to 'net')
-rw-r--r--net/filter-mirror.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 37bfe80392..78969e8026 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));
}