Commit 8e5f8471 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[LLC] remove not needed functions, use llc_sap_find in llc_sock

With this I'm slowly (real job hampering progress ;) ) going down
the road that will allow me to remove llc_ui_sockets and llc_opt->sk_list,
using only the per llc_sap linked lists.
parent 2ecd16f0
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <net/llc_pdu.h> #include <net/llc_pdu.h>
#include <net/llc_conn.h> #include <net/llc_conn.h>
#include <net/llc_mac.h> #include <net/llc_mac.h>
#include <net/llc_main.h>
#include <linux/llc.h> #include <linux/llc.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
...@@ -144,52 +145,6 @@ static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) ...@@ -144,52 +145,6 @@ static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock)
return rc; return rc;
} }
/**
* llc_ui_find_sap - returns sap struct that matches sap number specified
* @sap: Sap number to search for.
*
* Search the local socket list and return the first instance of the sap
* structure which matches the sap number the user specified.
* Returns llc_sap upon match, %NULL otherwise.
*/
static __inline__ struct llc_sap *llc_ui_find_sap(u8 sap)
{
struct sock *sk;
struct llc_sap *s = NULL;
read_lock_bh(&llc_ui_sockets_lock);
for (sk = llc_ui_sockets; sk; sk = sk->next) {
struct llc_opt *llc = llc_sk(sk);
if (!llc->sap)
continue;
if (llc->sap->laddr.lsap == sap) {
s = llc->sap;
break;
}
}
read_unlock_bh(&llc_ui_sockets_lock);
return s;
}
static struct sock *__llc_ui_find_sk_by_exact(struct llc_addr *laddr,
struct llc_addr *daddr)
{
struct sock *sk;
for (sk = llc_ui_sockets; sk; sk = sk->next) {
struct llc_opt *llc = llc_sk(sk);
if (llc->addr.sllc_ssap == laddr->lsap &&
llc->addr.sllc_dsap == daddr->lsap &&
llc_mac_null(llc->addr.sllc_mmac) &&
llc_mac_match(llc->addr.sllc_smac, laddr->mac) &&
llc_mac_match(llc->addr.sllc_dmac, daddr->mac))
break;
}
return sk;
}
/** /**
* __llc_ui_find_sk_by_addr - return socket matching local mac + sap. * __llc_ui_find_sk_by_addr - return socket matching local mac + sap.
* @addr: Local address to match. * @addr: Local address to match.
...@@ -204,7 +159,7 @@ static struct sock *__llc_ui_find_sk_by_addr(struct llc_addr *laddr, ...@@ -204,7 +159,7 @@ static struct sock *__llc_ui_find_sk_by_addr(struct llc_addr *laddr,
struct llc_addr *daddr, struct llc_addr *daddr,
struct net_device *dev) struct net_device *dev)
{ {
struct sock *sk, *tmp_sk; struct sock *sk;
for (sk = llc_ui_sockets; sk; sk = sk->next) { for (sk = llc_ui_sockets; sk; sk = sk->next) {
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
...@@ -226,11 +181,6 @@ static struct sock *__llc_ui_find_sk_by_addr(struct llc_addr *laddr, ...@@ -226,11 +181,6 @@ static struct sock *__llc_ui_find_sk_by_addr(struct llc_addr *laddr,
break; break;
if (!llc_mac_match(llc->addr.sllc_smac, laddr->mac)) if (!llc_mac_match(llc->addr.sllc_smac, laddr->mac))
continue; continue;
tmp_sk = __llc_ui_find_sk_by_exact(laddr, daddr);
if (tmp_sk) {
sk = tmp_sk;
break;
}
if (llc_mac_null(llc->addr.sllc_dmac)) if (llc_mac_null(llc->addr.sllc_dmac))
break; break;
} }
...@@ -388,7 +338,7 @@ static int llc_ui_autoport(void) ...@@ -388,7 +338,7 @@ static int llc_ui_autoport(void)
while (tries < LLC_SAP_DYN_TRIES) { while (tries < LLC_SAP_DYN_TRIES) {
for (i = llc_ui_sap_last_autoport; for (i = llc_ui_sap_last_autoport;
i < LLC_SAP_DYN_STOP; i += 2) { i < LLC_SAP_DYN_STOP; i += 2) {
sap = llc_ui_find_sap(i); sap = llc_sap_find(i);
if (!sap) { if (!sap) {
llc_ui_sap_last_autoport = i + 2; llc_ui_sap_last_autoport = i + 2;
goto out; goto out;
...@@ -446,7 +396,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) ...@@ -446,7 +396,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
if (!addr->sllc_ssap) if (!addr->sllc_ssap)
goto out; goto out;
} }
sap = llc_ui_find_sap(addr->sllc_ssap); sap = llc_sap_find(addr->sllc_ssap);
if (!sap) { if (!sap) {
sap = llc_sap_open(llc_ui_indicate, llc_ui_confirm, sap = llc_sap_open(llc_ui_indicate, llc_ui_confirm,
addr->sllc_ssap); addr->sllc_ssap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment