[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/12] init/cleanup of netfilter object
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH 02/12] init/cleanup of netfilter object |
Date: |
Wed, 29 Jul 2015 09:58:35 -0400 (EDT) |
On Wednesday, July 29, 2015 3:50:02 PM,
"Yang Hongyang" <address@hidden> wrote:
>
> On 07/29/2015 09:33 PM, Thomas Huth wrote:
> > On Wednesday, July 29, 2015 12:51:46 PM,
> > "Yang Hongyang" <address@hidden> wrote:
> >>
> >> This is mostly the same with init/cleanup of netdev object.
> >>
> >> Signed-off-by: Yang Hongyang <address@hidden>
> >> ---
> >> 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!
Thomas
- [Qemu-devel] [PATCH 09/12] netfilter: add a netbuffer filter, (continued)
- [Qemu-devel] [PATCH 09/12] netfilter: add a netbuffer filter, Yang Hongyang, 2015/07/29
- [Qemu-devel] [PATCH 06/12] netfilter: provide a compat receive_iov, Yang Hongyang, 2015/07/29
- [Qemu-devel] [PATCH 05/12] netfilter: hook packets before receive, Yang Hongyang, 2015/07/29
- [Qemu-devel] [PATCH 12/12] filter/buffer: update command description and help, Yang Hongyang, 2015/07/29
- [Qemu-devel] [PATCH 10/12] netbuffer: add a public api filter_buffer_release_all, Yang Hongyang, 2015/07/29
- [Qemu-devel] [PATCH 11/12] filter/buffer: add an interval option to buffer filter, Yang Hongyang, 2015/07/29
- [Qemu-devel] [PATCH 04/12] net: add/remove filters from network backend, Yang Hongyang, 2015/07/29
- [Qemu-devel] [PATCH 02/12] init/cleanup of netfilter object, Yang Hongyang, 2015/07/29
[Qemu-devel] [PATCH 01/12] net: add a new object netfilter, Yang Hongyang, 2015/07/29
[Qemu-devel] [PATCH 03/12] netfilter: add netfilter_{add|del} commands, Yang Hongyang, 2015/07/29