aboutsummaryrefslogtreecommitdiffstats
path: root/net/llc/llc_conn.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-09-22 03:43:05 -0400
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-09-22 03:43:05 -0400
commit6e2144b76840be09924de1626e2dcd7b315f75b3 (patch)
tree33044cb63f368270229e2b40aa2ad024325c7e8b /net/llc/llc_conn.c
parent04e4223f44b89e50f275cb6b95a58ebe2c4909be (diff)
[LLC]: Use refcounting with struct llc_sap
Signed-off-by: Jochen Friedrich <jochen@scram.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/llc/llc_conn.c')
-rw-r--r--net/llc/llc_conn.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 9f0e10e0978d..ab9e6d7e2875 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -633,6 +633,7 @@ static int llc_find_offset(int state, int ev_type)
633 */ 633 */
634void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk) 634void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk)
635{ 635{
636 llc_sap_hold(sap);
636 write_lock_bh(&sap->sk_list.lock); 637 write_lock_bh(&sap->sk_list.lock);
637 llc_sk(sk)->sap = sap; 638 llc_sk(sk)->sap = sap;
638 sk_add_node(sk, &sap->sk_list.list); 639 sk_add_node(sk, &sap->sk_list.list);
@@ -652,6 +653,7 @@ void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk)
652 write_lock_bh(&sap->sk_list.lock); 653 write_lock_bh(&sap->sk_list.lock);
653 sk_del_node_init(sk); 654 sk_del_node_init(sk);
654 write_unlock_bh(&sap->sk_list.lock); 655 write_unlock_bh(&sap->sk_list.lock);
656 llc_sap_put(sap);
655} 657}
656 658
657/** 659/**
@@ -731,32 +733,6 @@ static atomic_t llc_sock_nr;
731#endif 733#endif
732 734
733/** 735/**
734 * llc_release_sockets - releases all sockets in a sap
735 * @sap: sap to release its sockets
736 *
737 * Releases all connections of a sap. Returns 0 if all actions complete
738 * successfully, nonzero otherwise
739 */
740int llc_release_sockets(struct llc_sap *sap)
741{
742 int rc = 0;
743 struct sock *sk;
744 struct hlist_node *node;
745
746 write_lock_bh(&sap->sk_list.lock);
747
748 sk_for_each(sk, node, &sap->sk_list.list) {
749 llc_sk(sk)->state = LLC_CONN_STATE_TEMP;
750
751 if (llc_send_disc(sk))
752 rc = 1;
753 }
754
755 write_unlock_bh(&sap->sk_list.lock);
756 return rc;
757}
758
759/**
760 * llc_backlog_rcv - Processes rx frames and expired timers. 736 * llc_backlog_rcv - Processes rx frames and expired timers.
761 * @sk: LLC sock (p8022 connection) 737 * @sk: LLC sock (p8022 connection)
762 * @skb: queued rx frame or event 738 * @skb: queued rx frame or event