]> git.hungrycats.org Git - linux/commitdiff
o LLC: move the sockets release function outside of llc_sap_close
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>
Tue, 16 Sep 2003 11:32:26 +0000 (08:32 -0300)
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>
Tue, 16 Sep 2003 11:32:26 +0000 (08:32 -0300)
include/net/llc_conn.h
include/net/llc_if.h
include/net/llc_sap.h
net/802/psnap.c
net/llc/af_llc.c
net/llc/llc_conn.c
net/llc/llc_sap.c

index 202ee73ad2bebea88208c1d3d5eacbde9b48b9a1..b10900c62fa1c7dcd44f609daa2abb20c146068c 100644 (file)
@@ -105,4 +105,5 @@ extern struct sock *llc_lookup_dgram(struct llc_sap *sap,
 extern void llc_save_primitive(struct sk_buff* skb, u8 prim);
 extern u8 llc_data_accept_state(u8 state);
 extern void llc_build_offset_table(void);
+extern int llc_release_sockets(struct llc_sap *sap);
 #endif /* LLC_CONN_H */
index bebc983cae16b5fddb1abdf86379269bbb99091d..615fc3c671b0999b74a5718a3d309e5c7e485a87 100644 (file)
@@ -100,22 +100,8 @@ static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2)
        return !memcmp(mac1, mac2, IFHWADDRLEN);
 }
 
-struct llc_sap;
-
-extern struct llc_sap *llc_sap_open(u8 lsap,
-                                   int (*func)(struct sk_buff *skb,
-                                               struct net_device *dev,
-                                               struct packet_type *pt));
-extern void llc_sap_close(struct llc_sap *sap);
-
 extern int llc_establish_connection(struct sock *sk, u8 *lmac,
                                    u8 *dmac, u8 dsap);
 extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
-extern void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
-                                     u8 *dmac, u8 dsap);
-extern void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
-                                      u8 *dmac, u8 dsap);
-extern void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb,
-                                       u8 *dmac, u8 dsap);
 extern int llc_send_disc(struct sock *sk);
 #endif /* LLC_IF_H */
index b46c853893882b490e32c934b24bc64ba85a671d..2fffd961897e07c07325deb42f6fc055a6b76299 100644 (file)
@@ -44,4 +44,17 @@ extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk);
 extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk);
 extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb);
 extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
+extern struct llc_sap *llc_sap_open(u8 lsap,
+                                   int (*rcv)(struct sk_buff *skb,
+                                              struct net_device *dev,
+                                              struct packet_type *pt));
+extern void llc_sap_close(struct llc_sap *sap);
+
+extern void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
+                                     u8 *dmac, u8 dsap);
+extern void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
+                                      u8 *dmac, u8 dsap);
+extern void llc_build_and_send_test_pkt(struct llc_sap *sap,
+                                       struct sk_buff *skb, u8 *dmac, u8 dsap);
+
 #endif /* LLC_SAP_H */
index c689454484b1a7ab03f7d7b9f1745a16fdd39edd..e09f992aecfbd55b8349bfa0e1507e6d93f99bf3 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/skbuff.h>
 #include <net/datalink.h>
 #include <net/psnap.h>
-#include <net/llc_if.h>
 #include <net/llc_sap.h>
 #include <linux/mm.h>
 #include <linux/in.h>
index ff2710542e4b33e150872363f50f0855243b59c4..e7bcc35de9f515efa4a21b3e185325e4c8683c13 100644 (file)
@@ -184,8 +184,10 @@ static int llc_ui_release(struct socket *sock)
        if (!sk->sk_zapped)
                llc_sap_unassign_sock(llc->sap, sk);
        release_sock(sk);
-       if (llc->sap && hlist_empty(&llc->sap->sk_list.list))
+       if (llc->sap && hlist_empty(&llc->sap->sk_list.list)) {
+               llc_release_sockets(llc->sap);
                llc_sap_close(llc->sap);
+       }
        sock_put(sk);
        llc_sk_free(sk);
 out:
index 0dddbbe18afeb4af82757458305e2b039f9d3c6d..09ddaa1b4f378c85f5df3192845eb961f740e8cf 100644 (file)
@@ -736,13 +736,13 @@ static atomic_t llc_sock_nr;
 #endif
 
 /**
- *     llc_release_conns - releases all connections of a sap
- *     @sap: sap to release its connections
+ *     llc_release_sockets - releases all sockets in a sap
+ *     @sap: sap to release its sockets
  *
  *     Releases all connections of a sap. Returns 0 if all actions complete
  *     successfully, nonzero otherwise
  */
-int llc_release_connections(struct llc_sap *sap)
+int llc_release_sockets(struct llc_sap *sap)
 {
        int rc = 0;
        struct sock *sk;
index ab2b96bccb560f722ba3aa8c80590c2cd9fad28e..c927418c8a4a5323a8cc651d0d926ca953ffd159 100644 (file)
@@ -245,28 +245,6 @@ struct llc_sap *llc_sap_alloc(void)
        return sap;
 }
 
-/*
- * FIXME: this will go away as soon as sap->release_connections is introduced
- * in the next changesets.
- */
-extern int llc_release_connections(struct llc_sap *sap);
-
-/**
- *     llc_free_sap - frees a sap
- *     @sap: Address of the sap
- *
- *     Frees all associated connections (if any), removes this sap from
- *     the list of saps in te station and them frees the memory for this sap.
- */
-void llc_free_sap(struct llc_sap *sap)
-{
-       llc_release_connections(sap);
-       write_lock_bh(&sap->station->sap_list.lock);
-       list_del(&sap->node);
-       write_unlock_bh(&sap->station->sap_list.lock);
-       kfree(sap);
-}
-
 /**
  *     llc_sap_open - open interface to the upper layers.
  *     @lsap: SAP number.
@@ -308,10 +286,16 @@ out:
  *
  *     Close interface function to upper layer. Each one who wants to
  *     close an open SAP (for example NetBEUI) should call this function.
+ *     Removes this sap from the list of saps in the station and then
+ *     frees the memory for this sap.
  */
 void llc_sap_close(struct llc_sap *sap)
 {
-       llc_free_sap(sap);
+       WARN_ON(!hlist_empty(&sap->sk_list.list));
+       write_lock_bh(&sap->station->sap_list.lock);
+       list_del(&sap->node);
+       write_unlock_bh(&sap->station->sap_list.lock);
+       kfree(sap);
 }
 
 EXPORT_SYMBOL(llc_sap_open);