]> git.neil.brown.name Git - history.git/commitdiff
[NET]: Kill old sklist_foo interfaces.
authorSteven Whitehouse <steve@gw.chygwyn.com>
Fri, 18 Oct 2002 10:45:39 +0000 (03:45 -0700)
committerDavid S. Miller <davem@nuts.ninka.net>
Fri, 18 Oct 2002 10:45:39 +0000 (03:45 -0700)
include/net/sock.h
net/core/sock.c
net/econet/af_econet.c
net/netsyms.c

index 7240f39e7cf9bfbb8663810df52805198e57bf08..d2790e2ca00af6441c87507b134694aed5280dca 100644 (file)
@@ -439,10 +439,6 @@ extern void sock_def_destruct(struct sock *);
 /* Initialise core socket variables */
 extern void sock_init_data(struct socket *sock, struct sock *sk);
 
-extern void sklist_remove_socket(struct sock **list, struct sock *sk);
-extern void sklist_insert_socket(struct sock **list, struct sock *sk);
-extern void sklist_destroy_socket(struct sock **list, struct sock *sk);
-
 #ifdef CONFIG_FILTER
 
 /**
index 173494edef833b21410b1c82fa90a03aa9463ce5..44f1f5e4e8593d902c71d9ab6af97ff21a3ec0d1 100644 (file)
@@ -888,94 +888,6 @@ void __release_sock(struct sock *sk)
        } while((skb = sk->backlog.head) != NULL);
 }
 
-/*
- *     Generic socket manager library. Most simpler socket families
- *     use this to manage their socket lists. At some point we should
- *     hash these. By making this generic we get the lot hashed for free.
- *
- *     It is broken by design. All the protocols using it must be fixed. --ANK
- */
-
-rwlock_t net_big_sklist_lock = RW_LOCK_UNLOCKED;
-void sklist_remove_socket(struct sock **list, struct sock *sk)
-{
-       struct sock *s;
-
-       write_lock_bh(&net_big_sklist_lock);
-
-       while ((s = *list) != NULL) {
-               if (s == sk) {
-                       *list = s->next;
-                       break;
-               }
-               list = &s->next;
-       }
-
-       write_unlock_bh(&net_big_sklist_lock);
-       if (s)
-               sock_put(s);
-}
-
-void sklist_insert_socket(struct sock **list, struct sock *sk)
-{
-       write_lock_bh(&net_big_sklist_lock);
-       sk->next= *list;
-       *list=sk;
-       sock_hold(sk);
-       write_unlock_bh(&net_big_sklist_lock);
-}
-
-/*
- *     This is only called from user mode. Thus it protects itself against
- *     interrupt users but doesn't worry about being called during work.
- *     Once it is removed from the queue no interrupt or bottom half will
- *     touch it and we are (fairly 8-) ) safe.
- */
-
-void sklist_destroy_socket(struct sock **list, struct sock *sk);
-
-/*
- *     Handler for deferred kills.
- */
-
-static void sklist_destroy_timer(unsigned long data)
-{
-       struct sock *sk=(struct sock *)data;
-       sklist_destroy_socket(NULL,sk);
-}
-
-/*
- *     Destroy a socket. We pass NULL for a list if we know the
- *     socket is not on a list.
- */
-void sklist_destroy_socket(struct sock **list,struct sock *sk)
-{
-       if(list)
-               sklist_remove_socket(list, sk);
-
-       skb_queue_purge(&sk->receive_queue);
-
-       if(atomic_read(&sk->wmem_alloc) == 0 &&
-          atomic_read(&sk->rmem_alloc) == 0 &&
-          sk->dead)
-       {
-               sock_put(sk);
-       }
-       else
-       {
-               /*
-                *      Someone is using our buffers still.. defer
-                */
-               init_timer(&sk->timer);
-               sk->timer.expires=jiffies+SOCK_DESTROY_TIME;
-               sk->timer.function=sklist_destroy_timer;
-               sk->timer.data = (unsigned long)sk;
-               add_timer(&sk->timer);
-       }
-}
-
 /*
  * Set of default routines for initialising struct proto_ops when
  * the protocol does not support a particular function. In certain
index d7ddb1a6e53042941c05ac33ede0be749884b1ca..68407cb6bc096eb8f144d980a62465895e315168 100644 (file)
@@ -46,6 +46,7 @@
 
 static struct proto_ops econet_ops;
 static struct sock *econet_sklist;
+static rwlock_t econet_lock = RW_LOCK_UNLOCKED;
 
 /* Since there are only 256 possible network numbers (or fewer, depends
    how you count) it makes sense to use a simple lookup table. */
@@ -92,6 +93,33 @@ struct ec_cb
 #endif
 };
 
+static void econet_remove_socket(struct sock **list, struct sock *sk)
+{
+       struct sock *s;
+
+       write_lock_bh(&econet_lock);
+
+       while ((s = *list) != NULL) {
+               if (s == sk) {
+                       *list = s->next;
+                       break;
+               }
+               list = &s->next;
+       }
+
+       write_unlock_bh(&econet_lock);
+       if (s)
+               sock_put(s);
+}
+
+static void econet_insert_socket(struct sock **list, struct sock *sk)
+{
+       write_lock_bh(&econet_lock);
+       sk->next = *list;
+       sock_hold(sk);
+       write_unlock_bh(&econet_lock);
+}
+
 /*
  *     Pull a packet from our receive queue and hand it to the user.
  *     If necessary we block.
@@ -494,7 +522,7 @@ static int econet_release(struct socket *sock)
        if (!sk)
                return 0;
 
-       sklist_remove_socket(&econet_sklist, sk);
+       econet_remove_socket(&econet_sklist, sk);
 
        /*
         *      Now the socket is dead. No more input will appear.
@@ -557,7 +585,7 @@ static int econet_create(struct socket *sock, int protocol)
        sk->family = PF_ECONET;
        eo->num = protocol;
 
-       sklist_insert_socket(&econet_sklist, sk);
+       econet_insert_socket(&econet_sklist, sk);
        return(0);
 
 out_free:
index 119c68c31db90342c7bc5426ef73f3bcc7bd9c31..4ac8523c1ecf9648df127473862cb18b1abcd5a5 100644 (file)
@@ -224,9 +224,6 @@ EXPORT_SYMBOL(dev_change_flags);
 EXPORT_SYMBOL(vlan_ioctl_hook);
 #endif
 
-EXPORT_SYMBOL(sklist_destroy_socket);
-EXPORT_SYMBOL(sklist_insert_socket);
-
 EXPORT_SYMBOL(scm_detach_fds);
 
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
@@ -434,7 +431,6 @@ EXPORT_SYMBOL(neigh_dump_info);
 
 EXPORT_SYMBOL(dev_set_allmulti);
 EXPORT_SYMBOL(dev_set_promiscuity);
-EXPORT_SYMBOL(sklist_remove_socket);
 EXPORT_SYMBOL(rtnl_sem);
 EXPORT_SYMBOL(rtnl_lock);
 EXPORT_SYMBOL(rtnl_unlock);