2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-05 16:55:42 +00:00
Files
ovs/datapath/linux/compat/genetlink-openvswitch.c
Alex Wang bedf02f45b datapath: Prevent linker error of unknown symbol.
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>
2015-04-26 09:56:58 -07:00

59 lines
1.4 KiB
C

#include <net/genetlink.h>
#include <linux/version.h>
#ifndef HAVE_GENL_NOTIFY_TAKES_FAMILY
#undef genl_notify
void rpl_genl_notify(struct rpl_genl_family *family, struct sk_buff *skb,
struct net *net, u32 portid, u32 group,
struct nlmsghdr *nlh, gfp_t flags)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
struct sock *sk = net->genl_sock;
int report = 0;
if (nlh)
report = nlmsg_report(nlh);
nlmsg_notify(sk, skb, portid, group, report, flags);
#else
genl_notify(skb, net, portid, group, nlh, flags);
#endif
}
EXPORT_SYMBOL_GPL(rpl_genl_notify);
int rpl___genl_register_family(struct rpl_genl_family *f)
{
int err;
f->compat_family.id = f->id;
f->compat_family.hdrsize = f->hdrsize;
strncpy(f->compat_family.name, f->name, GENL_NAMSIZ);
f->compat_family.version = f->version;
f->compat_family.maxattr = f->maxattr;
f->compat_family.netnsok = f->netnsok;
#ifdef HAVE_PARALLEL_OPS
f->compat_family.parallel_ops = f->parallel_ops;
#endif
err = genl_register_family_with_ops(&f->compat_family,
(struct genl_ops *) f->ops, f->n_ops);
if (err)
goto error;
if (f->mcgrps) {
/* Need to Fix GROUP_ID() for more than one group. */
BUG_ON(f->n_mcgrps > 1);
err = genl_register_mc_group(&f->compat_family,
(struct genl_multicast_group *) f->mcgrps);
if (err)
goto error;
}
error:
return err;
}
EXPORT_SYMBOL_GPL(rpl___genl_register_family);
#endif /* kernel version < 3.13.0 */