Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0a3e78ac2c555441f5bc00588070058533bc8d6b
Commit:     0a3e78ac2c555441f5bc00588070058533bc8d6b
Parent:     51602b2a5e849babd94311e555bf1ba58151b8d4
Author:     Daniel Lezcano <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 11 02:23:18 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:57:10 2008 -0800

    [IPV6]: make flowlabel to return an error
    
    This patch makes the flowlab subsystem to return an error code and makes
    some cleanup with procfs ifdefs.
    The af_inet6 will use the flowlabel init return code to check the 
initialization
    was correct.
    
    Signed-off-by: Daniel Lezcano <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 include/net/ipv6.h       |    2 +-
 net/ipv6/af_inet6.c      |    5 ++++-
 net/ipv6/ip6_flowlabel.c |   30 +++++++++++++++++++++++-------
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 38df94b..4d91065 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -219,7 +219,7 @@ extern struct ipv6_txoptions        
*fl6_merge_options(struct ipv6_txoptions * opt_spac
                                                   struct ipv6_txoptions * 
fopt);
 extern void                    fl6_free_socklist(struct sock *sk);
 extern int                     ipv6_flowlabel_opt(struct sock *sk, char __user 
*optval, int optlen);
-extern void                    ip6_flowlabel_init(void);
+extern int                     ip6_flowlabel_init(void);
 extern void                    ip6_flowlabel_cleanup(void);
 
 static inline void fl6_sock_release(struct ip6_flowlabel *fl)
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 90d2f72..614f3d9 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -851,7 +851,9 @@ static int __init inet6_init(void)
        err = ip6_route_init();
        if (err)
                goto ip6_route_fail;
-       ip6_flowlabel_init();
+       err = ip6_flowlabel_init();
+       if (err)
+               goto ip6_flowlabel_fail;
        err = addrconf_init();
        if (err)
                goto addrconf_fail;
@@ -874,6 +876,7 @@ out:
 
 addrconf_fail:
        ip6_flowlabel_cleanup();
+ip6_flowlabel_fail:
        ip6_route_cleanup();
 ip6_route_fail:
 #ifdef CONFIG_PROC_FS
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index b12cc22..d0babea 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -692,20 +692,36 @@ static const struct file_operations ip6fl_seq_fops = {
        .llseek         =       seq_lseek,
        .release        =       seq_release_private,
 };
-#endif
 
+static int ip6_flowlabel_proc_init(struct net *net)
+{
+       if (!proc_net_fops_create(net, "ip6_flowlabel", S_IRUGO, 
&ip6fl_seq_fops))
+               return -ENOMEM;
+       return 0;
+}
 
-void ip6_flowlabel_init(void)
+static void ip6_flowlabel_proc_fini(struct net *net)
 {
-#ifdef CONFIG_PROC_FS
-       proc_net_fops_create(&init_net, "ip6_flowlabel", S_IRUGO, 
&ip6fl_seq_fops);
+       proc_net_remove(net, "ip6_flowlabel");
+}
+#else
+static inline int ip6_flowlabel_proc_init(struct net *net)
+{
+       return 0;
+}
+static inline void ip6_flowlabel_proc_fini(struct net *net)
+{
+       return ;
+}
 #endif
+
+int ip6_flowlabel_init(void)
+{
+       return ip6_flowlabel_proc_init(&init_net);
 }
 
 void ip6_flowlabel_cleanup(void)
 {
        del_timer(&ip6_fl_gc_timer);
-#ifdef CONFIG_PROC_FS
-       proc_net_remove(&init_net, "ip6_flowlabel");
-#endif
+       ip6_flowlabel_proc_fini(&init_net);
 }
-
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