1750{
1751 struct nl_seq_iter *iter = seq->private;
1752 int i, j;
1753 struct sock *s;
1754 struct hlist_node *node;
1755 loff_t off = 0;
1756
1757 for (i = 0; i < MAX_LINKS; i++) {
1758 struct nl_pid_hash *hash = &nl_table[i].hash;
1759
1760 for (j = 0; j <= hash->mask; j++) {
1761 sk_for_each(s, node, &hash->table[j]) {
1762 if (sock_net(s) != seq_file_net(seq))
1763 continue;
1764 if (off == pos) {
1765 iter->link = i;
1766 iter->hash_idx = j;
1767 return s;
1768 }
1769 ++off;
1770 }
1771 }
1772 }
1773 return NULL;
1774}
1775
1776static void *netlink_seq_start(struct seq_file *seq, loff_t *pos)
1777 __acquires(nl_table_lock)
1778{
1779 read_lock(&nl_table_lock);
1780 return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN;
1781}
1782
1783static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1784{
1785 struct sock *s;
1786 struct nl_seq_iter *iter;
1787 int i, j;
1788
1789 ++*pos;
1790