Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90746
b: refs/heads/master
c: 669f87b
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Apr 16, 2008
1 parent d2bc6bb commit 95815e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3a931a80cb25f905da377d1bb0ba9b1641aa579a
refs/heads/master: 669f87baab90183e13b95480aecf8d7bac92ca3c
1 change: 1 addition & 0 deletions trunk/include/net/rtnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct rtnl_link_ops {

extern int __rtnl_link_register(struct rtnl_link_ops *ops);
extern void __rtnl_link_unregister(struct rtnl_link_ops *ops);
extern void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops);

extern int rtnl_link_register(struct rtnl_link_ops *ops);
extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
Expand Down
29 changes: 21 additions & 8 deletions trunk/net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,26 @@ int rtnl_link_register(struct rtnl_link_ops *ops)

EXPORT_SYMBOL_GPL(rtnl_link_register);

static void __rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops)
{
struct net_device *dev;
restart:
for_each_netdev(net, dev) {
if (dev->rtnl_link_ops == ops) {
ops->dellink(dev);
goto restart;
}
}
}

void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops)
{
rtnl_lock();
__rtnl_kill_links(net, ops);
rtnl_unlock();
}
EXPORT_SYMBOL_GPL(rtnl_kill_links);

/**
* __rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink.
* @ops: struct rtnl_link_ops * to unregister
Expand All @@ -277,17 +297,10 @@ EXPORT_SYMBOL_GPL(rtnl_link_register);
*/
void __rtnl_link_unregister(struct rtnl_link_ops *ops)
{
struct net_device *dev;
struct net *net;

for_each_net(net) {
restart:
for_each_netdev(net, dev) {
if (dev->rtnl_link_ops == ops) {
ops->dellink(dev);
goto restart;
}
}
__rtnl_kill_links(net, ops);
}
list_del(&ops->list);
}
Expand Down

0 comments on commit 95815e4

Please sign in to comment.