genetlink: statically initialize families
Instead of providing macros/inline functions to initialize the families, make all users initialize them statically and get rid of the macros. This reduces the kernel code size by about 1.6k on x86-64 (with allyesconfig). Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
a07ea4d994
commit
489111e5c2
@@ -31,13 +31,7 @@
|
||||
#include "l2tp_core.h"
|
||||
|
||||
|
||||
static struct genl_family l2tp_nl_family = {
|
||||
.name = L2TP_GENL_NAME,
|
||||
.version = L2TP_GENL_VERSION,
|
||||
.hdrsize = 0,
|
||||
.maxattr = L2TP_ATTR_MAX,
|
||||
.netnsok = true,
|
||||
};
|
||||
static struct genl_family l2tp_nl_family;
|
||||
|
||||
static const struct genl_multicast_group l2tp_multicast_group[] = {
|
||||
{
|
||||
@@ -976,6 +970,19 @@ static const struct genl_ops l2tp_nl_ops[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct genl_family l2tp_nl_family = {
|
||||
.name = L2TP_GENL_NAME,
|
||||
.version = L2TP_GENL_VERSION,
|
||||
.hdrsize = 0,
|
||||
.maxattr = L2TP_ATTR_MAX,
|
||||
.netnsok = true,
|
||||
.module = THIS_MODULE,
|
||||
.ops = l2tp_nl_ops,
|
||||
.n_ops = ARRAY_SIZE(l2tp_nl_ops),
|
||||
.mcgrps = l2tp_multicast_group,
|
||||
.n_mcgrps = ARRAY_SIZE(l2tp_multicast_group),
|
||||
};
|
||||
|
||||
int l2tp_nl_register_ops(enum l2tp_pwtype pw_type, const struct l2tp_nl_cmd_ops *ops)
|
||||
{
|
||||
int ret;
|
||||
@@ -1012,9 +1019,7 @@ EXPORT_SYMBOL_GPL(l2tp_nl_unregister_ops);
|
||||
static int l2tp_nl_init(void)
|
||||
{
|
||||
pr_info("L2TP netlink interface\n");
|
||||
return genl_register_family_with_ops_groups(&l2tp_nl_family,
|
||||
l2tp_nl_ops,
|
||||
l2tp_multicast_group);
|
||||
return genl_register_family(&l2tp_nl_family);
|
||||
}
|
||||
|
||||
static void l2tp_nl_cleanup(void)
|
||||
|
Reference in New Issue
Block a user