168static __inline__ struct sock *ipx_get_socket_idx(loff_t pos)
169{
170 struct sock *s = NULL;
171 struct hlist_node *node;
172 struct ipx_interface *i;
173
174 list_for_each_entry(i, &ipx_interfaces, node) {
175 spin_lock_bh(&i->if_sklist_lock);
176 sk_for_each(s, node, &i->if_sklist) {
177 if (!pos)
178 break;
179 --pos;
180 }
181 spin_unlock_bh(&i->if_sklist_lock);
182 if (!pos) {
183 if (node)
184 goto found;
185 break;
186 }
187 }
188 s = NULL;
189found:
190 return s;
191}
192
193static void *ipx_seq_socket_start(struct seq_file *seq, loff_t *pos)
194{
195 loff_t l = *pos;
196
197 spin_lock_bh(&ipx_interfaces_lock);
198 return l ? ipx_get_socket_idx(--l) : SEQ_START_TOKEN;
199}
200
201static void *ipx_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos)
202{
203 struct sock* sk, *next;
204 struct ipx_interface *i;
205 struct ipx_sock *ipxs;
206
207 ++*pos;
208 if (v == SEQ_START_TOKEN) {