diff mbox

[V3,1/3] net/filter-mirror: Change filter_mirror_send interface

Message ID 1457092906-19828-2-git-send-email-zhangchen.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhang Chen March 4, 2016, 12:01 p.m. UTC
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>
---
 net/filter-mirror.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Jason Wang March 7, 2016, 7:29 a.m. UTC | #1
On 03/04/2016 08:01 PM, Zhang Chen wrote:
> 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>
> ---
>  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 ee13d94..4ff7619 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,
> +static int filter_mirror_send(CharDriverState *chr_out,
>                                     const struct iovec *iov,
>                                     int iovcnt)

The indent looks odds here, please send an independent patch to fix this
by the way.

Thanks
Zhang Chen March 7, 2016, 8:13 a.m. UTC | #2
On 03/07/2016 03:29 PM, Jason Wang wrote:
>
> On 03/04/2016 08:01 PM, Zhang Chen wrote:
>> 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>
>> ---
>>   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 ee13d94..4ff7619 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,
>> +static int filter_mirror_send(CharDriverState *chr_out,
>>                                      const struct iovec *iov,
>>                                      int iovcnt)
> The indent looks odds here, please send an independent patch to fix this
> by the way.

OK, I will fix it and send an independent patch latter~~

Thanks
zhangchen

> Thanks
>
>
> .
>
diff mbox

Patch

diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index ee13d94..4ff7619 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,
+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));
     }