Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=87c3efbfdd1f98af14a1f60ff19f73d9a8d8da98
Commit:     87c3efbfdd1f98af14a1f60ff19f73d9a8d8da98
Parent:     853cbbaaa4ccdf221be5ab6afe967aa9998546b7
Author:     Daniel Lezcano <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 11 02:25:01 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:57:12 2008 -0800

    [IPV6]: make inet6_register_protosw to return an error code
    
    This patch makes the inet6_register_protosw to return an error code.
    The different protocols can be aware the registration was successful or
    not and can pass the error to the initial caller, af_inet6.
    
    Signed-off-by: Daniel Lezcano <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 include/net/protocol.h |    2 +-
 net/ipv6/af_inet6.c    |   11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/net/protocol.h b/include/net/protocol.h
index 1166ffb..ad8c584 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -102,7 +102,7 @@ extern void inet_unregister_protosw(struct inet_protosw *p);
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 extern int     inet6_add_protocol(struct inet6_protocol *prot, unsigned char 
num);
 extern int     inet6_del_protocol(struct inet6_protocol *prot, unsigned char 
num);
-extern void    inet6_register_protosw(struct inet_protosw *p);
+extern int     inet6_register_protosw(struct inet_protosw *p);
 extern void    inet6_unregister_protosw(struct inet_protosw *p);
 #endif
 
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index a75c4bc..53b06de 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -565,21 +565,23 @@ static struct inet_protosw rawv6_protosw = {
        .flags          = INET_PROTOSW_REUSE,
 };
 
-void
-inet6_register_protosw(struct inet_protosw *p)
+int inet6_register_protosw(struct inet_protosw *p)
 {
        struct list_head *lh;
        struct inet_protosw *answer;
-       int protocol = p->protocol;
        struct list_head *last_perm;
+       int protocol = p->protocol;
+       int ret;
 
        spin_lock_bh(&inetsw6_lock);
 
+       ret = -EINVAL;
        if (p->type >= SOCK_MAX)
                goto out_illegal;
 
        /* If we are trying to override a permanent protocol, bail. */
        answer = NULL;
+       ret = -EPERM;
        last_perm = &inetsw6[p->type];
        list_for_each(lh, &inetsw6[p->type]) {
                answer = list_entry(lh, struct inet_protosw, list);
@@ -603,9 +605,10 @@ inet6_register_protosw(struct inet_protosw *p)
         * system automatically returns to the old behavior.
         */
        list_add_rcu(&p->list, last_perm);
+       ret = 0;
 out:
        spin_unlock_bh(&inetsw6_lock);
-       return;
+       return ret;
 
 out_permanent:
        printk(KERN_ERR "Attempt to override permanent protocol %d.\n",
-
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