aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-02-29 14:44:14 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-29 14:44:14 -0500
commit95a363582b69bec53bc73ff2100dfc344bd23098 (patch)
tree8ec3fc592df5eb5e06a9e4e4c221d9ace39c3a34 /net/core
parentfd80eb942ad9761f241c9b287b3b9a342b20690d (diff)
[NET]: Use existing device list walker for /proc/dev_mcast.
The seq_file_operations' dev_mc_seq_xxx callbacks do the same thing as the dev_seq_xxx ones do, but skip the SEQ_START_TOKEN. So use the existing exported dev_seq_xxx calls and handle the SEQ_START_TOKEN in the dev_mc_seq_show(). Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev_mcast.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index cec582563e0..f8a3455f449 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -156,39 +156,14 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
156EXPORT_SYMBOL(dev_mc_unsync); 156EXPORT_SYMBOL(dev_mc_unsync);
157 157
158#ifdef CONFIG_PROC_FS 158#ifdef CONFIG_PROC_FS
159static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
160 __acquires(dev_base_lock)
161{
162 struct net *net = seq_file_net(seq);
163 struct net_device *dev;
164 loff_t off = 0;
165
166 read_lock(&dev_base_lock);
167 for_each_netdev(net, dev) {
168 if (off++ == *pos)
169 return dev;
170 }
171 return NULL;
172}
173
174static void *dev_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
175{
176 ++*pos;
177 return next_net_device((struct net_device *)v);
178}
179
180static void dev_mc_seq_stop(struct seq_file *seq, void *v)
181 __releases(dev_base_lock)
182{
183 read_unlock(&dev_base_lock);
184}
185
186
187static int dev_mc_seq_show(struct seq_file *seq, void *v) 159static int dev_mc_seq_show(struct seq_file *seq, void *v)
188{ 160{
189 struct dev_addr_list *m; 161 struct dev_addr_list *m;
190 struct net_device *dev = v; 162 struct net_device *dev = v;
191 163
164 if (v == SEQ_START_TOKEN)
165 return 0;
166
192 netif_tx_lock_bh(dev); 167 netif_tx_lock_bh(dev);
193 for (m = dev->mc_list; m; m = m->next) { 168 for (m = dev->mc_list; m; m = m->next) {
194 int i; 169 int i;
@@ -206,9 +181,9 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v)
206} 181}
207 182
208static const struct seq_operations dev_mc_seq_ops = { 183static const struct seq_operations dev_mc_seq_ops = {
209 .start = dev_mc_seq_start, 184 .start = dev_seq_start,
210 .next = dev_mc_seq_next, 185 .next = dev_seq_next,
211 .stop = dev_mc_seq_stop, 186 .stop = dev_seq_stop,
212 .show = dev_mc_seq_show, 187 .show = dev_mc_seq_show,
213}; 188};
214 189