diff options
Diffstat (limited to 'net/x25/x25_proc.c')
-rw-r--r-- | net/x25/x25_proc.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c index 0a04e62e0e18..c4cd3226a053 100644 --- a/net/x25/x25_proc.c +++ b/net/x25/x25_proc.c | |||
@@ -93,40 +93,16 @@ out: | |||
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
95 | 95 | ||
96 | static __inline__ struct sock *x25_get_socket_idx(loff_t pos) | ||
97 | { | ||
98 | struct sock *s; | ||
99 | struct hlist_node *node; | ||
100 | |||
101 | sk_for_each(s, node, &x25_list) | ||
102 | if (!pos--) | ||
103 | goto found; | ||
104 | s = NULL; | ||
105 | found: | ||
106 | return s; | ||
107 | } | ||
108 | |||
109 | static void *x25_seq_socket_start(struct seq_file *seq, loff_t *pos) | 96 | static void *x25_seq_socket_start(struct seq_file *seq, loff_t *pos) |
110 | __acquires(x25_list_lock) | 97 | __acquires(x25_list_lock) |
111 | { | 98 | { |
112 | loff_t l = *pos; | ||
113 | |||
114 | read_lock_bh(&x25_list_lock); | 99 | read_lock_bh(&x25_list_lock); |
115 | return l ? x25_get_socket_idx(--l) : SEQ_START_TOKEN; | 100 | return seq_hlist_start_head(&x25_list, *pos); |
116 | } | 101 | } |
117 | 102 | ||
118 | static void *x25_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos) | 103 | static void *x25_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos) |
119 | { | 104 | { |
120 | struct sock *s; | 105 | return seq_hlist_next(v, &x25_list, pos); |
121 | |||
122 | ++*pos; | ||
123 | if (v == SEQ_START_TOKEN) { | ||
124 | s = sk_head(&x25_list); | ||
125 | goto out; | ||
126 | } | ||
127 | s = sk_next(v); | ||
128 | out: | ||
129 | return s; | ||
130 | } | 106 | } |
131 | 107 | ||
132 | static void x25_seq_socket_stop(struct seq_file *seq, void *v) | 108 | static void x25_seq_socket_stop(struct seq_file *seq, void *v) |
@@ -148,7 +124,7 @@ static int x25_seq_socket_show(struct seq_file *seq, void *v) | |||
148 | goto out; | 124 | goto out; |
149 | } | 125 | } |
150 | 126 | ||
151 | s = v; | 127 | s = sk_entry(v); |
152 | x25 = x25_sk(s); | 128 | x25 = x25_sk(s); |
153 | 129 | ||
154 | if (!x25->neighbour || (dev = x25->neighbour->dev) == NULL) | 130 | if (!x25->neighbour || (dev = x25->neighbour->dev) == NULL) |