Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9eb87f3f7e0686a256c5bb4f886dede0171245f2
Commit:     9eb87f3f7e0686a256c5bb4f886dede0171245f2
Parent:     0013cabab30ec55830ce63d34c0bdd887eb87644
Author:     Daniel Lezcano <[EMAIL PROTECTED]>
AuthorDate: Fri Dec 7 00:42:52 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:56:46 2008 -0800

    [IPV6]: Make fib6_rules_init to return an error code.
    
    When the fib_rules initialization finished, no return code is provided
    so there is no way to know, for the caller, if the initialization has
    been successful or has failed. This patch fix that.
    
    Signed-off-by: Daniel Lezcano <[EMAIL PROTECTED]>
    Acked-by: Benjamin Thery <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 include/net/fib_rules.h |    1 +
 include/net/ip6_fib.h   |    2 +-
 net/core/fib_rules.c    |    5 +++--
 net/ipv6/fib6_rules.c   |   19 ++++++++++++++++---
 4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 41a301e..2364db1 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -103,6 +103,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, 
struct nlattr **nla)
 
 extern int                     fib_rules_register(struct fib_rules_ops *);
 extern int                     fib_rules_unregister(struct fib_rules_ops *);
+extern void                     fib_rules_cleanup_ops(struct fib_rules_ops *);
 
 extern int                     fib_rules_lookup(struct fib_rules_ops *,
                                                 struct flowi *, int flags,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 5d39ce9..eaa3158 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -226,7 +226,7 @@ extern void                 fib6_gc_cleanup(void);
 
 extern int                     fib6_init(void);
 
-extern void                    fib6_rules_init(void);
+extern int                     fib6_rules_init(void);
 extern void                    fib6_rules_cleanup(void);
 
 #endif
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 0af0538..fcbf41c 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -102,7 +102,7 @@ errout:
 
 EXPORT_SYMBOL_GPL(fib_rules_register);
 
-static void cleanup_ops(struct fib_rules_ops *ops)
+void fib_rules_cleanup_ops(struct fib_rules_ops *ops)
 {
        struct fib_rule *rule, *tmp;
 
@@ -111,6 +111,7 @@ static void cleanup_ops(struct fib_rules_ops *ops)
                fib_rule_put(rule);
        }
 }
+EXPORT_SYMBOL_GPL(fib_rules_cleanup_ops);
 
 int fib_rules_unregister(struct fib_rules_ops *ops)
 {
@@ -121,7 +122,7 @@ int fib_rules_unregister(struct fib_rules_ops *ops)
        list_for_each_entry(o, &rules_ops, list) {
                if (o == ops) {
                        list_del_rcu(&o->list);
-                       cleanup_ops(ops);
+                       fib_rules_cleanup_ops(ops);
                        goto out;
                }
        }
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 428c6b0..9ce2e0a 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -265,10 +265,23 @@ static int __init fib6_default_rules_init(void)
        return 0;
 }
 
-void __init fib6_rules_init(void)
+int __init fib6_rules_init(void)
 {
-       BUG_ON(fib6_default_rules_init());
-       fib_rules_register(&fib6_rules_ops);
+       int ret;
+
+       ret = fib6_default_rules_init();
+       if (ret)
+               goto out;
+
+       ret = fib_rules_register(&fib6_rules_ops);
+       if (ret)
+               goto out_default_rules_init;
+out:
+       return ret;
+
+out_default_rules_init:
+       fib_rules_cleanup_ops(&fib6_rules_ops);
+       goto out;
 }
 
 void fib6_rules_cleanup(void)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to