]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/netrom/af_netrom.c
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[net-next-2.6.git] / net / netrom / af_netrom.c
index 71604c6613b50d72247c1cd79e0dd78a5ac35e6e..fa07f044b59977af946049b8a03fe64be5994966 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <linux/socket.h>
 #include <linux/in.h>
+#include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/timer.h>
@@ -1267,28 +1268,13 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 
 static void *nr_info_start(struct seq_file *seq, loff_t *pos)
 {
-       struct sock *s;
-       struct hlist_node *node;
-       int i = 1;
-
        spin_lock_bh(&nr_list_lock);
-       if (*pos == 0)
-               return SEQ_START_TOKEN;
-
-       sk_for_each(s, node, &nr_list) {
-               if (i == *pos)
-                       return s;
-               ++i;
-       }
-       return NULL;
+       return seq_hlist_start_head(&nr_list, *pos);
 }
 
 static void *nr_info_next(struct seq_file *seq, void *v, loff_t *pos)
 {
-       ++*pos;
-
-       return (v == SEQ_START_TOKEN) ? sk_head(&nr_list)
-               : sk_next((struct sock *)v);
+       return seq_hlist_next(v, &nr_list, pos);
 }
 
 static void nr_info_stop(struct seq_file *seq, void *v)
@@ -1298,7 +1284,7 @@ static void nr_info_stop(struct seq_file *seq, void *v)
 
 static int nr_info_show(struct seq_file *seq, void *v)
 {
-       struct sock *s = v;
+       struct sock *s = sk_entry(v);
        struct net_device *dev;
        struct nr_sock *nr;
        const char *devname;