From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxsS-00069u-Oo for qemu-devel@nongnu.org; Mon, 09 May 2016 22:58:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azxsO-00063x-F5 for qemu-devel@nongnu.org; Mon, 09 May 2016 22:58:27 -0400 Received: from [59.151.112.132] (port=11724 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxsN-00061J-C7 for qemu-devel@nongnu.org; Mon, 09 May 2016 22:58:24 -0400 References: <1462532187-22787-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> From: Li Zhijian Message-ID: <57314E2F.4010305@cn.fujitsu.com> Date: Tue, 10 May 2016 10:57:51 +0800 MIME-Version: 1.0 In-Reply-To: <1462532187-22787-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] net/net: Add ReadState for reuse codes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhang Chen , qemu devel , Jason Wang Cc: Wen Congyang , "eddie . dong" , "Dr . David Alan Gilbert" On 05/06/2016 06:56 PM, Zhang Chen wrote: > Signed-off-by: Zhang Chen > Signed-off-by: Li Zhijian > Signed-off-by: Wen Congyang > --- > include/net/net.h | 8 ++++++ > net/filter-mirror.c | 60 ++++++++------------------------------------ > net/net.c | 56 ++++++++++++++++++++++++++++++++++++++++++ > net/socket.c | 71 +++++++++++++---------------------------------------- > 4 files changed, 91 insertions(+), 104 deletions(-) > > diff --git a/include/net/net.h b/include/net/net.h > index 73e4c46..1439cf9 100644 > --- a/include/net/net.h > +++ b/include/net/net.h > @@ -102,6 +102,14 @@ typedef struct NICState { > bool peer_deleted; > } NICState; > > +typedef struct ReadState { > + int state; /* 0 = getting length, 1 = getting data */ > + uint32_t index; > + uint32_t packet_len; > + uint8_t buf[NET_BUFSIZE]; > +} ReadState; > + > +int net_fill_rstate(ReadState *rs, const uint8_t *buf, int size); > char *qemu_mac_strdup_printf(const uint8_t *macaddr); > NetClientState *qemu_find_netdev(const char *id); > int qemu_find_net_clients_except(const char *id, NetClientState **ncs, > diff --git a/net/filter-mirror.c b/net/filter-mirror.c > index c0c4dc6..bcec509 100644 > --- a/net/filter-mirror.c > +++ b/net/filter-mirror.c > @@ -40,10 +40,7 @@ typedef struct MirrorState { > char *outdev; > CharDriverState *chr_in; > CharDriverState *chr_out; > - int state; /* 0 = getting length, 1 = getting data */ > - unsigned int index; > - unsigned int packet_len; > - uint8_t buf[REDIRECTOR_MAX_LEN]; you may need to remove 'REDIRECTOR_MAX_LEN' defination too. Thanks Li Zhijian