You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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
@@ -186,7 +186,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
|
||||
struct ethhdr *eth;
|
||||
struct bpqdev *bpq;
|
||||
|
||||
if (dev_net(dev) != &init_net)
|
||||
if (!net_eq(dev_net(dev), &init_net))
|
||||
goto drop;
|
||||
|
||||
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
|
||||
@@ -552,7 +552,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)ptr;
|
||||
|
||||
if (dev_net(dev) != &init_net)
|
||||
if (!net_eq(dev_net(dev), &init_net))
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (!dev_is_ethdev(dev))
|
||||
|
||||
@@ -207,7 +207,7 @@ static __net_init int loopback_net_init(struct net *net)
|
||||
out_free_netdev:
|
||||
free_netdev(dev);
|
||||
out:
|
||||
if (net == &init_net)
|
||||
if (net_eq(net, &init_net))
|
||||
panic("loopback: Failed to register netdevice: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
{
|
||||
struct hdlc_device *hdlc = dev_to_hdlc(dev);
|
||||
|
||||
if (dev_net(dev) != &init_net) {
|
||||
if (!net_eq(dev_net(dev), &init_net)) {
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
|
||||
unsigned long flags;
|
||||
int on;
|
||||
|
||||
if (dev_net(dev) != &init_net)
|
||||
if (!net_eq(dev_net(dev), &init_net))
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (!(dev->priv_flags & IFF_WAN_HDLC))
|
||||
|
||||
+1
-1
@@ -1023,7 +1023,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
|
||||
struct sock *sk;
|
||||
int rc = -ESOCKTNOSUPPORT;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -655,7 +655,7 @@ static int svc_create(struct net *net, struct socket *sock, int protocol,
|
||||
{
|
||||
int error;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
sock->ops = &svc_proto_ops;
|
||||
|
||||
+1
-1
@@ -805,7 +805,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
|
||||
struct sock *sk;
|
||||
ax25_cb *ax25;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
switch (sock->type) {
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
|
||||
if (protocol < 0 || protocol >= CAN_NPROTO)
|
||||
return -EINVAL;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
#ifdef CONFIG_MODULES
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+1
-1
@@ -1126,7 +1126,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
u32 pid = skb ? NETLINK_CB(skb).pid : 0;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EINVAL;
|
||||
|
||||
ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
|
||||
|
||||
@@ -680,7 +680,7 @@ static int dn_create(struct net *net, struct socket *sock, int protocol,
|
||||
{
|
||||
struct sock *sk;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
switch(sock->type) {
|
||||
|
||||
+3
-3
@@ -636,7 +636,7 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
struct dn_ifaddr *ifa, **ifap;
|
||||
int err = -EINVAL;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
goto errout;
|
||||
|
||||
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
|
||||
@@ -675,7 +675,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
struct dn_ifaddr *ifa;
|
||||
int err;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EINVAL;
|
||||
|
||||
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
|
||||
@@ -789,7 +789,7 @@ static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
struct dn_dev *dn_db;
|
||||
struct dn_ifaddr *ifa;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return 0;
|
||||
|
||||
skip_ndevs = cb->args[0];
|
||||
|
||||
+2
-2
@@ -509,7 +509,7 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
|
||||
struct rtattr **rta = arg;
|
||||
struct rtmsg *r = NLMSG_DATA(nlh);
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EINVAL;
|
||||
|
||||
if (dn_fib_check_attr(r, rta))
|
||||
@@ -529,7 +529,7 @@ static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
|
||||
struct rtattr **rta = arg;
|
||||
struct rtmsg *r = NLMSG_DATA(nlh);
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EINVAL;
|
||||
|
||||
if (dn_fib_check_attr(r, rta))
|
||||
|
||||
@@ -1517,7 +1517,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
|
||||
struct sk_buff *skb;
|
||||
struct flowi fl;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EINVAL;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
@@ -1602,7 +1602,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
int h, s_h;
|
||||
int idx, s_idx;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return 0;
|
||||
|
||||
if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg))
|
||||
|
||||
@@ -471,7 +471,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
struct hlist_node *node;
|
||||
int dumped = 0;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return 0;
|
||||
|
||||
if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) &&
|
||||
|
||||
@@ -612,7 +612,7 @@ static int econet_create(struct net *net, struct socket *sock, int protocol,
|
||||
struct econet_sock *eo;
|
||||
int err;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
/* Econet only provides datagram services. */
|
||||
|
||||
@@ -241,7 +241,7 @@ static int ieee802154_create(struct net *net, struct socket *sock,
|
||||
struct proto *proto;
|
||||
const struct proto_ops *ops;
|
||||
|
||||
if (net != &init_net)
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
switch (sock->type) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user