24#include <net/llc_c_ev.h>
25#include <net/llc_c_st.h>
26#include <net/llc_conn.h>
27
28static void llc_ui_format_mac(struct seq_file *seq, u8 *addr)
29{
30 DECLARE_MAC_BUF(mac);
31 seq_printf(seq, "%s", print_mac(mac, addr));
32}
33
34static struct sock *llc_get_sk_idx(loff_t pos)
35{
36 struct list_head *sap_entry;
37 struct llc_sap *sap;
38 struct hlist_node *node;
39 struct sock *sk = NULL;
40
41 list_for_each(sap_entry, &llc_sap_list) {
42 sap = list_entry(sap_entry, struct llc_sap, node);
43
44 read_lock_bh(&sap->sk_list.lock);
45 sk_for_each(sk, node, &sap->sk_list.list) {
46 if (!pos)
47 goto found;
48 --pos;
49 }
50 read_unlock_bh(&sap->sk_list.lock);
51 }
52 sk = NULL;
53found:
54 return sk;
55}
56
57static void *llc_seq_start(struct seq_file *seq, loff_t *pos)
58{
59 loff_t l = *pos;
60
61 read_lock_bh(&llc_sap_list_lock);
62 return l ? llc_get_sk_idx(--l) : SEQ_START_TOKEN;
63}
64