Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: fib_rules: mark arguments to fib_rules_register const and __net_initdata

fib_rules_register() duplicates the template passed to it without modification,
mark the argument as const. Additionally the templates are only needed when
instantiating a new namespace, so mark them as __net_initdata, which means
they can be discarded when CONFIG_NET_NS=n.

Signed-off-by: Patrick McHardy <kaber@trash.net>

+6 -6
+1 -1
include/net/fib_rules.h
··· 104 104 return frh->table; 105 105 } 106 106 107 - extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *); 107 + extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); 108 108 extern void fib_rules_unregister(struct fib_rules_ops *); 109 109 extern void fib_rules_cleanup_ops(struct fib_rules_ops *); 110 110
+1 -1
net/core/fib_rules.c
··· 122 122 } 123 123 124 124 struct fib_rules_ops * 125 - fib_rules_register(struct fib_rules_ops *tmpl, struct net *net) 125 + fib_rules_register(const struct fib_rules_ops *tmpl, struct net *net) 126 126 { 127 127 struct fib_rules_ops *ops; 128 128 int err;
+1 -1
net/decnet/dn_rules.c
··· 216 216 dn_rt_cache_flush(-1); 217 217 } 218 218 219 - static struct fib_rules_ops dn_fib_rules_ops_template = { 219 + static const struct fib_rules_ops __net_initdata dn_fib_rules_ops_template = { 220 220 .family = FIB_RULES_DECNET, 221 221 .rule_size = sizeof(struct dn_fib_rule), 222 222 .addr_size = sizeof(u16),
+1 -1
net/ipv4/fib_rules.c
··· 245 245 rt_cache_flush(ops->fro_net, -1); 246 246 } 247 247 248 - static struct fib_rules_ops fib4_rules_ops_template = { 248 + static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = { 249 249 .family = FIB_RULES_IPV4, 250 250 .rule_size = sizeof(struct fib4_rule), 251 251 .addr_size = sizeof(u32),
+1 -1
net/ipv4/ipmr.c
··· 216 216 return 0; 217 217 } 218 218 219 - static struct fib_rules_ops ipmr_rules_ops_template = { 219 + static const struct fib_rules_ops __net_initdata ipmr_rules_ops_template = { 220 220 .family = FIB_RULES_IPMR, 221 221 .rule_size = sizeof(struct ipmr_rule), 222 222 .addr_size = sizeof(u32),
+1 -1
net/ipv6/fib6_rules.c
··· 237 237 + nla_total_size(16); /* src */ 238 238 } 239 239 240 - static struct fib_rules_ops fib6_rules_ops_template = { 240 + static const struct fib_rules_ops __net_initdata fib6_rules_ops_template = { 241 241 .family = FIB_RULES_IPV6, 242 242 .rule_size = sizeof(struct fib6_rule), 243 243 .addr_size = sizeof(struct in6_addr),