Commit 5d8c0602 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[LLC] use the core lists to get info for /proc/net/llc

With this llc_ui_sockets is almost not needed anymore, next
changesets will deal with the dataunit/xid/test primitives, that
are still using it.
parent 1d84746d
......@@ -1320,18 +1320,26 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length)
{
off_t pos = 0;
off_t begin = 0;
struct sock *s;
struct llc_opt *llc;
struct llc_sap *sap;
struct list_head *sap_entry, *llc_entry;
struct llc_station *station = llc_station_get();
int len = sprintf(buffer, "SKt Mc local_mac_sap "
"remote_mac_sap tx_queue rx_queue st uid "
"link\n");
/* Output the LLC socket data for the /proc filesystem */
read_lock_bh(&llc_ui_sockets_lock);
for (s = llc_ui_sockets; s; s = s->next) {
struct llc_opt *llc = llc_sk(s);
spin_lock_bh(&station->sap_list.lock);
list_for_each(sap_entry, &station->sap_list.list) {
sap = list_entry(sap_entry, struct llc_sap, node);
len += sprintf(buffer + len, "%2X %2X ", s->type,
spin_lock_bh(&sap->sk_list.lock);
list_for_each(llc_entry, &sap->sk_list.list) {
llc = list_entry(llc_entry, struct llc_opt, node);
len += sprintf(buffer + len, "%2X %2X ",
llc->sk->type,
!llc_mac_null(llc->addr.sllc_mmac));
if (llc->sap) {
if (llc->dev && llc_mac_null(llc->addr.sllc_mmac))
llc_ui_format_mac(buffer + len,
llc->dev->dev_addr);
......@@ -1344,19 +1352,19 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length)
"00:00:00:00:00:00");
}
len += MAC_FORMATTED_SIZE;
len += sprintf(buffer + len, "@%02X ",
llc->sap->laddr.lsap);
} else
len += sprintf(buffer + len, "00:00:00:00:00:00@00 ");
len += sprintf(buffer + len, "@%02X ", sap->laddr.lsap);
llc_ui_format_mac(buffer + len, llc->addr.sllc_dmac);
len += MAC_FORMATTED_SIZE;
len += sprintf(buffer + len,
"@%02X %8d %8d %2d %-3d ",
"@%02X %8d %8d %2d %3d ",
llc->addr.sllc_dsap,
atomic_read(&s->wmem_alloc),
atomic_read(&s->rmem_alloc), s->state,
SOCK_INODE(s->socket)->i_uid);
len += sprintf(buffer + len, "%-4d\n", llc->link);
atomic_read(&llc->sk->wmem_alloc),
atomic_read(&llc->sk->rmem_alloc),
llc->sk->state,
llc->sk->socket ?
SOCK_INODE(llc->sk->socket)->i_uid :
-1);
len += sprintf(buffer + len, "%4d\n", llc->link);
/* Are we still dumping unwanted data then discard the record */
pos = begin + len;
......@@ -1367,7 +1375,9 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length)
if (pos > offset + length) /* We have dumped enough */
break;
}
read_unlock_bh(&llc_ui_sockets_lock);
spin_unlock_bh(&sap->sk_list.lock);
}
spin_unlock_bh(&station->sap_list.lock);
/* The data in question runs from begin to begin + len */
*start = buffer + offset - begin; /* Start of wanted data */
......
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