aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-16 03:46:52 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-16 03:46:52 -0400
commit669f87baab90183e13b95480aecf8d7bac92ca3c (patch)
treecca1b9347893cb8275dad19945b69371102d57b6 /net
parent3a931a80cb25f905da377d1bb0ba9b1641aa579a (diff)
[RTNL]: Introduce the rtnl_kill_links helper.
This one is responsible for calling ->dellink on each net device found in net to help with vlan net_exit hook in the nearest future. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/rtnetlink.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index edc6dbfe48f2..bc39e417694a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -269,6 +269,26 @@ int rtnl_link_register(struct rtnl_link_ops *ops)
269 269
270EXPORT_SYMBOL_GPL(rtnl_link_register); 270EXPORT_SYMBOL_GPL(rtnl_link_register);
271 271
272static void __rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops)
273{
274 struct net_device *dev;
275restart:
276 for_each_netdev(net, dev) {
277 if (dev->rtnl_link_ops == ops) {
278 ops->dellink(dev);
279 goto restart;
280 }
281 }
282}
283
284void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops)
285{
286 rtnl_lock();
287 __rtnl_kill_links(net, ops);
288 rtnl_unlock();
289}
290EXPORT_SYMBOL_GPL(rtnl_kill_links);
291
272/** 292/**
273 * __rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink. 293 * __rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink.
274 * @ops: struct rtnl_link_ops * to unregister 294 * @ops: struct rtnl_link_ops * to unregister
@@ -277,17 +297,10 @@ EXPORT_SYMBOL_GPL(rtnl_link_register);
277 */ 297 */
278void __rtnl_link_unregister(struct rtnl_link_ops *ops) 298void __rtnl_link_unregister(struct rtnl_link_ops *ops)
279{ 299{
280 struct net_device *dev;
281 struct net *net; 300 struct net *net;
282 301
283 for_each_net(net) { 302 for_each_net(net) {
284restart: 303 __rtnl_kill_links(net, ops);
285 for_each_netdev(net, dev) {
286 if (dev->rtnl_link_ops == ops) {
287 ops->dellink(dev);
288 goto restart;
289 }
290 }
291 } 304 }
292 list_del(&ops->list); 305 list_del(&ops->list);
293} 306}