From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKS1z-0000wp-AH for qemu-devel@nongnu.org; Wed, 29 Jul 2015 10:08:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKS1v-0003bO-4U for qemu-devel@nongnu.org; Wed, 29 Jul 2015 10:08:27 -0400 Received: from [59.151.112.132] (port=25349 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKS1t-0003aS-TZ for qemu-devel@nongnu.org; Wed, 29 Jul 2015 10:08:23 -0400 Message-ID: <55B8DE50.6070207@cn.fujitsu.com> Date: Wed, 29 Jul 2015 22:08:16 +0800 From: Yang Hongyang MIME-Version: 1.0 References: <1438167116-29270-1-git-send-email-yanghy@cn.fujitsu.com> <1438167116-29270-3-git-send-email-yanghy@cn.fujitsu.com> <1012207755.363443.1438176811477.JavaMail.zimbra@redhat.com> <55B8DA0A.2040009@cn.fujitsu.com> <1260504275.383697.1438178315062.JavaMail.zimbra@redhat.com> In-Reply-To: <1260504275.383697.1438178315062.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/12] init/cleanup of netfilter object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: zhang zhanghailiang , jasowang@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, stefanha@redhat.com On 07/29/2015 09:58 PM, Thomas Huth wrote: > On Wednesday, July 29, 2015 3:50:02 PM, > "Yang Hongyang" wrote: >> >> On 07/29/2015 09:33 PM, Thomas Huth wrote: >>> On Wednesday, July 29, 2015 12:51:46 PM, >>> "Yang Hongyang" wrote: >>>> >>>> This is mostly the same with init/cleanup of netdev object. >>>> >>>> Signed-off-by: Yang Hongyang >>>> --- >>>> include/net/filter.h | 21 ++++++++ >>>> include/qemu/typedefs.h | 1 + >>>> net/filter.c | 131 >>>> ++++++++++++++++++++++++++++++++++++++++++++++++ >>>> qapi-schema.json | 30 +++++++++++ >>>> 4 files changed, 183 insertions(+) >>>> >>> [...] >>>> diff --git a/net/filter.c b/net/filter.c >>>> index 4e40f08..e6fdc26 100644 >>>> --- a/net/filter.c >>>> +++ b/net/filter.c >>>> @@ -6,10 +6,141 @@ >>>> */ >>>> >>>> #include "qemu-common.h" >>>> +#include "qapi-visit.h" >>>> +#include "qapi/qmp/qerror.h" >>>> +#include "qemu/error-report.h" >>>> +#include "qapi-visit.h" >>>> +#include "qapi/opts-visitor.h" >>>> +#include "qapi/dealloc-visitor.h" >>>> +#include "qemu/config-file.h" >>>> + >>>> #include "net/filter.h" >>>> +#include "net/net.h" >>>> + >>>> +static QTAILQ_HEAD(, NetFilterState) net_filters; >>>> + >>>> +NetFilterState *qemu_new_net_filter(NetFilterInfo *info, >>>> + NetClientState *netdev, >>>> + const char *model, >>>> + const char *name) >>>> +{ >>>> + NetFilterState *nf; >>>> + >>>> + assert(info->size >= sizeof(NetFilterState)); >>>> + >>>> + nf = g_malloc0(info->size); >>>> + nf->info = info; >>>> + nf->model = g_strdup(model); >>>> + nf->name = g_strdup(name); >>>> + nf->netdev = netdev; >>>> + QTAILQ_INSERT_TAIL(&net_filters, nf, next); >>>> + /* TODO: attach netfilter to netdev */ >>>> + >>>> + return nf; >>>> +} >>>> + >>>> +static __attribute__((unused)) void >>>> qemu_cleanup_net_filter(NetFilterState >>>> *nf) >>> >>> Maybe rather add this function in the patch you really need it? Then you >>> could >>> avoid the ugly attribute-unused here. >> >> It will be removed in the next patch. I put cleanup here in order to pair >> with the new function, and could be easy to review... > > You could also use another trick: Use "static inline" instead of "static > __attribute__((unused))" ... then GCC also does not complain about unused > static functions! Ok, thanks. > > Thomas > . > -- Thanks, Yang.