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) ...@@ -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 pos = 0;
off_t begin = 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 " int len = sprintf(buffer, "SKt Mc local_mac_sap "
"remote_mac_sap tx_queue rx_queue st uid " "remote_mac_sap tx_queue rx_queue st uid "
"link\n"); "link\n");
/* Output the LLC socket data for the /proc filesystem */ /* Output the LLC socket data for the /proc filesystem */
read_lock_bh(&llc_ui_sockets_lock); spin_lock_bh(&station->sap_list.lock);
for (s = llc_ui_sockets; s; s = s->next) { list_for_each(sap_entry, &station->sap_list.list) {
struct llc_opt *llc = llc_sk(s); sap = list_entry(sap_entry, struct llc_sap, node);
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 ", s->type, len += sprintf(buffer + len, "%2X %2X ",
!llc_mac_null(llc->addr.sllc_mmac)); llc->sk->type,
if (llc->sap) { !llc_mac_null(llc->addr.sllc_mmac));
if (llc->dev && llc_mac_null(llc->addr.sllc_mmac)) if (llc->dev && llc_mac_null(llc->addr.sllc_mmac))
llc_ui_format_mac(buffer + len, llc_ui_format_mac(buffer + len,
llc->dev->dev_addr); llc->dev->dev_addr);
...@@ -1344,30 +1352,32 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1344,30 +1352,32 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length)
"00:00:00:00:00:00"); "00:00:00:00:00:00");
} }
len += MAC_FORMATTED_SIZE; len += MAC_FORMATTED_SIZE;
len += sprintf(buffer + len, "@%02X ", len += sprintf(buffer + len, "@%02X ", sap->laddr.lsap);
llc->sap->laddr.lsap); llc_ui_format_mac(buffer + len, llc->addr.sllc_dmac);
} else len += MAC_FORMATTED_SIZE;
len += sprintf(buffer + len, "00:00:00:00:00:00@00 "); len += sprintf(buffer + len,
llc_ui_format_mac(buffer + len, llc->addr.sllc_dmac); "@%02X %8d %8d %2d %3d ",
len += MAC_FORMATTED_SIZE; llc->addr.sllc_dsap,
len += sprintf(buffer + len, atomic_read(&llc->sk->wmem_alloc),
"@%02X %8d %8d %2d %-3d ", atomic_read(&llc->sk->rmem_alloc),
llc->addr.sllc_dsap, llc->sk->state,
atomic_read(&s->wmem_alloc), llc->sk->socket ?
atomic_read(&s->rmem_alloc), s->state, SOCK_INODE(llc->sk->socket)->i_uid :
SOCK_INODE(s->socket)->i_uid); -1);
len += sprintf(buffer + len, "%-4d\n", llc->link); len += sprintf(buffer + len, "%4d\n", llc->link);
/* Are we still dumping unwanted data then discard the record */ /* Are we still dumping unwanted data then discard the record */
pos = begin + len; pos = begin + len;
if (pos < offset) { if (pos < offset) {
len = 0; /* Keep dumping into the buffer start */ len = 0; /* Keep dumping into the buffer start */
begin = pos; begin = pos;
}
if (pos > offset + length) /* We have dumped enough */
break;
} }
if (pos > offset + length) /* We have dumped enough */ spin_unlock_bh(&sap->sk_list.lock);
break;
} }
read_unlock_bh(&llc_ui_sockets_lock); spin_unlock_bh(&station->sap_list.lock);
/* The data in question runs from begin to begin + len */ /* The data in question runs from begin to begin + len */
*start = buffer + offset - begin; /* Start of wanted data */ *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