]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
net: fib_rules: mark arguments to fib_rules_register const and __net_initdata
authorPatrick McHardy <kaber@trash.net>
Mon, 26 Apr 2010 14:02:04 +0000 (16:02 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 26 Apr 2010 14:02:04 +0000 (16:02 +0200)
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>
include/net/fib_rules.h
net/core/fib_rules.c
net/decnet/dn_rules.c
net/ipv4/fib_rules.c
net/ipv4/ipmr.c
net/ipv6/fib6_rules.c

index 52bd9e6c914187ae87895db63cbb20f5568718e6..e8923bc20f9ff8f28b586af3b795bcf6230df92f 100644 (file)
@@ -104,7 +104,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
        return frh->table;
 }
 
-extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *);
+extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *);
 extern void fib_rules_unregister(struct fib_rules_ops *);
 extern void                     fib_rules_cleanup_ops(struct fib_rules_ops *);
 
index 1bc66592453ca5cdffb71179a8c69eae7c2265c3..42e84e08a1becd4b64a65a74758bf4e13783a8ae 100644 (file)
@@ -122,7 +122,7 @@ errout:
 }
 
 struct fib_rules_ops *
-fib_rules_register(struct fib_rules_ops *tmpl, struct net *net)
+fib_rules_register(const struct fib_rules_ops *tmpl, struct net *net)
 {
        struct fib_rules_ops *ops;
        int err;
index af28dcc2184494b5528c8ad0cade76e1f450219f..1226bcad776bf77cb49a3ea8dbc1d07e51ae832e 100644 (file)
@@ -216,7 +216,7 @@ static void dn_fib_rule_flush_cache(struct fib_rules_ops *ops)
        dn_rt_cache_flush(-1);
 }
 
-static struct fib_rules_ops dn_fib_rules_ops_template = {
+static const struct fib_rules_ops __net_initdata dn_fib_rules_ops_template = {
        .family         = FIB_RULES_DECNET,
        .rule_size      = sizeof(struct dn_fib_rule),
        .addr_size      = sizeof(u16),
index 3ec84fea5b71bbc85891b55ba8c30a38472a075c..8ab62a56701cbd9c4dd99884535307efb8ab43a8 100644 (file)
@@ -245,7 +245,7 @@ static void fib4_rule_flush_cache(struct fib_rules_ops *ops)
        rt_cache_flush(ops->fro_net, -1);
 }
 
-static struct fib_rules_ops fib4_rules_ops_template = {
+static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = {
        .family         = FIB_RULES_IPV4,
        .rule_size      = sizeof(struct fib4_rule),
        .addr_size      = sizeof(u32),
index a2df5012a1d0a9b0e156c94582695ffd4a068b86..7d3e382aed640358a4ddfd611313a74a46e98cdb 100644 (file)
@@ -216,7 +216,7 @@ static int ipmr_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
        return 0;
 }
 
-static struct fib_rules_ops ipmr_rules_ops_template = {
+static const struct fib_rules_ops __net_initdata ipmr_rules_ops_template = {
        .family         = FIB_RULES_IPMR,
        .rule_size      = sizeof(struct ipmr_rule),
        .addr_size      = sizeof(u32),
index 8124f16f2ac2684e1c132eae686762e2848bae6e..35f6949446f0280054badcd3e9370e9e66ed7b4c 100644 (file)
@@ -237,7 +237,7 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule)
               + nla_total_size(16); /* src */
 }
 
-static struct fib_rules_ops fib6_rules_ops_template = {
+static const struct fib_rules_ops __net_initdata fib6_rules_ops_template = {
        .family                 = FIB_RULES_IPV6,
        .rule_size              = sizeof(struct fib6_rule),
        .addr_size              = sizeof(struct in6_addr),