Commit 4243cdc2 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

udp: Neaten function pointer calls and add braces

Standardize function pointer uses.

Convert calling style from:
	(*foo)(args...);
to:
	foo(args...);

Other miscellanea:

o Add braces around loops with single ifs on multiple lines
o Realign arguments around these functions
o Invert logic in if to return immediately.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent feed1a96
...@@ -144,7 +144,7 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num, ...@@ -144,7 +144,7 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
struct hlist_nulls_node *node; struct hlist_nulls_node *node;
kuid_t uid = sock_i_uid(sk); kuid_t uid = sock_i_uid(sk);
sk_nulls_for_each(sk2, node, &hslot->head) sk_nulls_for_each(sk2, node, &hslot->head) {
if (net_eq(sock_net(sk2), net) && if (net_eq(sock_net(sk2), net) &&
sk2 != sk && sk2 != sk &&
(bitmap || udp_sk(sk2)->udp_port_hash == num) && (bitmap || udp_sk(sk2)->udp_port_hash == num) &&
...@@ -153,12 +153,11 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num, ...@@ -153,12 +153,11 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
(!sk2->sk_reuseport || !sk->sk_reuseport || (!sk2->sk_reuseport || !sk->sk_reuseport ||
!uid_eq(uid, sock_i_uid(sk2))) && !uid_eq(uid, sock_i_uid(sk2))) &&
(*saddr_comp)(sk, sk2)) { saddr_comp(sk, sk2)) {
if (bitmap) if (!bitmap)
__set_bit(udp_sk(sk2)->udp_port_hash >> log,
bitmap);
else
return 1; return 1;
__set_bit(udp_sk(sk2)->udp_port_hash >> log, bitmap);
}
} }
return 0; return 0;
} }
...@@ -179,7 +178,7 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num, ...@@ -179,7 +178,7 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
int res = 0; int res = 0;
spin_lock(&hslot2->lock); spin_lock(&hslot2->lock);
udp_portaddr_for_each_entry(sk2, node, &hslot2->head) udp_portaddr_for_each_entry(sk2, node, &hslot2->head) {
if (net_eq(sock_net(sk2), net) && if (net_eq(sock_net(sk2), net) &&
sk2 != sk && sk2 != sk &&
(udp_sk(sk2)->udp_port_hash == num) && (udp_sk(sk2)->udp_port_hash == num) &&
...@@ -188,10 +187,11 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num, ...@@ -188,10 +187,11 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
(!sk2->sk_reuseport || !sk->sk_reuseport || (!sk2->sk_reuseport || !sk->sk_reuseport ||
!uid_eq(uid, sock_i_uid(sk2))) && !uid_eq(uid, sock_i_uid(sk2))) &&
(*saddr_comp)(sk, sk2)) { saddr_comp(sk, sk2)) {
res = 1; res = 1;
break; break;
} }
}
spin_unlock(&hslot2->lock); spin_unlock(&hslot2->lock);
return res; return res;
} }
...@@ -2033,7 +2033,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, ...@@ -2033,7 +2033,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
} else { } else {
up->corkflag = 0; up->corkflag = 0;
lock_sock(sk); lock_sock(sk);
(*push_pending_frames)(sk); push_pending_frames(sk);
release_sock(sk); release_sock(sk);
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment