net: use net_eq to compare nets
Generated with the following semantic patch @@ struct net *n1; struct net *n2; @@ - n1 == n2 + net_eq(n1, n2) @@ struct net *n1; struct net *n2; @@ - n1 != n2 + !net_eq(n1, n2) applied over {include,net,drivers/net}. Signed-off-by: Octavian Purdila <opurdila@ixiacom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
4ba3eb034f
commit
09ad9bc752
@@ -985,7 +985,7 @@ rollback:
|
||||
/* For now only devices in the initial network namespace
|
||||
* are in sysfs.
|
||||
*/
|
||||
if (net == &init_net) {
|
||||
if (net_eq(net, &init_net)) {
|
||||
ret = device_rename(&dev->dev, dev->name);
|
||||
if (ret) {
|
||||
memcpy(dev->name, oldname, IFNAMSIZ);
|
||||
@@ -4792,7 +4792,7 @@ static void rollback_registered_many(struct list_head *head)
|
||||
list_for_each_entry_safe(dev, aux, head, unreg_list) {
|
||||
int new_net = 1;
|
||||
list_for_each_entry(fdev, &pernet_list, unreg_list) {
|
||||
if (dev_net(dev) == dev_net(fdev)) {
|
||||
if (net_eq(dev_net(dev), dev_net(fdev))) {
|
||||
new_net = 0;
|
||||
dev_put(dev);
|
||||
break;
|
||||
|
@@ -2092,7 +2092,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
|
||||
if (h > s_h)
|
||||
s_idx = 0;
|
||||
for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) {
|
||||
if (dev_net(n->dev) != net)
|
||||
if (!net_eq(dev_net(n->dev), net))
|
||||
continue;
|
||||
if (idx < s_idx)
|
||||
goto next;
|
||||
|
@@ -525,7 +525,7 @@ void netdev_unregister_kobject(struct net_device * net)
|
||||
|
||||
kobject_get(&dev->kobj);
|
||||
|
||||
if (dev_net(net) != &init_net)
|
||||
if (!net_eq(dev_net(net), &init_net))
|
||||
return;
|
||||
|
||||
device_del(dev);
|
||||
@@ -559,7 +559,7 @@ int netdev_register_kobject(struct net_device *net)
|
||||
#endif
|
||||
#endif /* CONFIG_SYSFS */
|
||||
|
||||
if (dev_net(net) != &init_net)
|
||||
if (!net_eq(dev_net(net), &init_net))
|
||||
return 0;
|
||||
|
||||
return device_add(dev);
|
||||
|
@@ -280,7 +280,7 @@ out_undo:
|
||||
list_del(&ops->list);
|
||||
if (ops->exit) {
|
||||
for_each_net(undo_net) {
|
||||
if (undo_net == net)
|
||||
if (net_eq(undo_net, net))
|
||||
goto undone;
|
||||
ops->exit(undo_net);
|
||||
}
|
||||
|
@@ -134,7 +134,7 @@ static __net_init int sysctl_core_net_init(struct net *net)
|
||||
net->core.sysctl_somaxconn = SOMAXCONN;
|
||||
|
||||
tbl = netns_core_table;
|
||||
if (net != &init_net) {
|
||||
if (!net_eq(net, &init_net)) {
|
||||
tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
|
||||
if (tbl == NULL)
|
||||
goto err_dup;
|
||||
|
Reference in New Issue
Block a user