[ovs-dev] [PATCH v6] datapath: Add support for namespace.
Pravin Shelar
pshelar at nicira.com
Mon Jan 30 15:41:18 UTC 2012
On Fri, Jan 20, 2012 at 6:51 PM, Jesse Gross <jesse at nicira.com> wrote:
> On Wed, Jan 18, 2012 at 2:49 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
>> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
>> +#define net_assign_generic rpl_net_assign_generic
>> +int net_assign_generic(struct net *net, int id, void *data);
>> +#endif /* 2.6.32 */
>
> I think this is only used in net_namespace.c, so it's probably better
> to put in there. If it actually is used somewhere else then it came
> from generic.h in 2.6.32.
>
>> diff --git a/datapath/linux/compat/net_namespace.c b/datapath/linux/compat/net_namespace.c
>> new file mode 100644
>> index 0000000..7b0c1bd
>> --- /dev/null
>> +++ b/datapath/linux/compat/net_namespace.c
>> +#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,32)
>> +#define DEFINE_PNET_REG_FUNC(PNET_TYPE) \
>> + static struct rpl_pernet_operations *pnet_##PNET_TYPE; \
>> +static int __net_init compat_init_net_##PNET_TYPE(struct net *net) \
>> +{ \
>> + return compat_init_net(net, pnet_##PNET_TYPE); \
>> +} \
>> +\
>> +static void __net_exit compat_exit_net_##PNET_TYPE(struct net *net) \
>> +{ \
>> + compat_exit_net(net, pnet_##PNET_TYPE); \
>> +} \
>> +\
>> +static struct pernet_operations pnet_compat_##PNET_TYPE = { \
>> + .init = compat_init_net_##PNET_TYPE, \
>> + .exit = compat_exit_net_##PNET_TYPE, \
>> +}; \
>> +\
>> +int rpl_register_pernet_##PNET_TYPE(struct rpl_pernet_operations *rpl_pnet) \
>> +{ \
>> + pnet_##PNET_TYPE = rpl_pnet; \
>> + return register_pernet_##PNET_TYPE(pnet_##PNET_TYPE->id, &pnet_compat_##PNET_TYPE); \
>> +} \
>> +\
>> +void rpl_unregister_pernet_##PNET_TYPE(struct rpl_pernet_operations *pnet) \
>> +{ \
>> + unregister_pernet_##PNET_TYPE(*pnet->id, &pnet_compat_##PNET_TYPE); \
>> +}
>
> Can you line up the backslashes here? At first glance, I missed some of them.
>
>> +int rpl_register_pernet_gen_device(struct rpl_pernet_operations *rpl_pnet)
>> +{
>> + *rpl_pnet->id = count++;
>> + return compat_init_net(net, rpl_pnet);
>
> Extra space.
>
> I think this basically looks good though, so:
> Acked-by: Jesse Gross <jesse at nicira.com>
>
Thanks,
Fixed patch pushed to master.
> When you are ready, can you also provide a version of this for the
> upstream tree?
ok, I will post it soon.
More information about the dev
mailing list