mirror of
https://github.com/openvswitch/ovs
synced 2025-10-19 14:37:21 +00:00
With the latest change of separating vports into their own modules, it is necessary to export all public functions in linux/compat/ directory. Also, we should prefix functions which replace the upstream ones with 'rpl_' and others with 'ovs_'. This will prevent the linker error when vport modules use those functions in the future. e.g., the to be merged vport-stt module will use the flex_array_* functions which are not currently exported. Co-authored-by: Tuan Nguyen <tuan.nguyen@veriksystems.com> Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
44 lines
808 B
C
44 lines
808 B
C
#include <linux/if_vlan.h>
|
|
#include <linux/netdevice.h>
|
|
#include <net/net_namespace.h>
|
|
#include <net/netns/generic.h>
|
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
|
|
|
|
int ovs_compat_init_net(struct net *net, struct rpl_pernet_operations *pnet)
|
|
{
|
|
int err;
|
|
void *ovs_net = kzalloc(pnet->size, GFP_KERNEL);
|
|
|
|
if (!ovs_net)
|
|
return -ENOMEM;
|
|
|
|
err = net_assign_generic(net, *pnet->id, ovs_net);
|
|
if (err)
|
|
goto err;
|
|
|
|
if (pnet->init) {
|
|
err = pnet->init(net);
|
|
if (err)
|
|
goto err;
|
|
}
|
|
|
|
return 0;
|
|
err:
|
|
kfree(ovs_net);
|
|
return err;
|
|
}
|
|
EXPORT_SYMBOL_GPL(ovs_compat_init_net);
|
|
|
|
void ovs_compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet)
|
|
{
|
|
void *ovs_net = net_generic(net, *pnet->id);
|
|
|
|
if (pnet->exit)
|
|
pnet->exit(net);
|
|
kfree(ovs_net);
|
|
}
|
|
EXPORT_SYMBOL_GPL(ovs_compat_exit_net);
|
|
|
|
#endif
|