aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlanproc.c
diff options
context:
space:
mode:
authorPavel Emelianov <xemul@openvz.org>2007-05-03 18:13:45 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-03 18:13:45 -0400
commit7562f876cd93800f2f8c89445f2a563590b24e09 (patch)
tree78a34c011af275efa0d55ba59c3bd49b771dd533 /net/8021q/vlanproc.c
parent03fba0479600114f32d29eee74ca3eaa364606bf (diff)
[NET]: Rework dev_base via list_head (v3)
Cleanup of dev_base list use, with the aim to simplify making device list per-namespace. In almost every occasion, use of dev_base variable and dev->next pointer could be easily replaced by for_each_netdev loop. A few most complicated places were converted to using first_netdev()/next_netdev(). Signed-off-by: Pavel Emelianov <xemul@openvz.org> Acked-by: Kirill Korotaev <dev@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlanproc.c')
-rw-r--r--net/8021q/vlanproc.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 5e24f72602a1..d216a64421cd 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -237,13 +237,9 @@ int vlan_proc_rem_dev(struct net_device *vlandev)
237 * The following few functions build the content of /proc/net/vlan/config 237 * The following few functions build the content of /proc/net/vlan/config
238 */ 238 */
239 239
240/* starting at dev, find a VLAN device */ 240static inline int is_vlan_dev(struct net_device *dev)
241static struct net_device *vlan_skip(struct net_device *dev)
242{ 241{
243 while (dev && !(dev->priv_flags & IFF_802_1Q_VLAN)) 242 return dev->priv_flags & IFF_802_1Q_VLAN;
244 dev = dev->next;
245
246 return dev;
247} 243}
248 244
249/* start read of /proc/net/vlan/config */ 245/* start read of /proc/net/vlan/config */
@@ -257,19 +253,35 @@ static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
257 if (*pos == 0) 253 if (*pos == 0)
258 return SEQ_START_TOKEN; 254 return SEQ_START_TOKEN;
259 255
260 for (dev = vlan_skip(dev_base); dev && i < *pos; 256 for_each_netdev(dev) {
261 dev = vlan_skip(dev->next), ++i); 257 if (!is_vlan_dev(dev))
258 continue;
259
260 if (i++ == *pos)
261 return dev;
262 }
262 263
263 return (i == *pos) ? dev : NULL; 264 return NULL;
264} 265}
265 266
266static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) 267static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos)
267{ 268{
269 struct net_device *dev;
270
268 ++*pos; 271 ++*pos;
269 272
270 return vlan_skip((v == SEQ_START_TOKEN) 273 dev = (struct net_device *)v;
271 ? dev_base 274 if (v == SEQ_START_TOKEN)
272 : ((struct net_device *)v)->next); 275 dev = net_device_entry(&dev_base_head);
276
277 for_each_netdev_continue(dev) {
278 if (!is_vlan_dev(dev))
279 continue;
280
281 return dev;
282 }
283
284 return NULL;
273} 285}
274 286
275static void vlan_seq_stop(struct seq_file *seq, void *v) 287static void vlan_seq_stop(struct seq_file *seq, void *v)