aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-11-12 00:59:20 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-12 14:51:59 -0500
commit4243cdc2c1e5a1375cc8397e8f9b06530f099c60 (patch)
tree7c7166a9814b03d19020d28a071eae1c51748ffc /net/ipv4/udp.c
parentfeed1a96604e2d067c556ec97a92f82ae0e449ad (diff)
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: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1b6e9d5fadef..4a16b9129079 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -144,7 +144,7 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
144 struct hlist_nulls_node *node; 144 struct hlist_nulls_node *node;
145 kuid_t uid = sock_i_uid(sk); 145 kuid_t uid = sock_i_uid(sk);
146 146
147 sk_nulls_for_each(sk2, node, &hslot->head) 147 sk_nulls_for_each(sk2, node, &hslot->head) {
148 if (net_eq(sock_net(sk2), net) && 148 if (net_eq(sock_net(sk2), net) &&
149 sk2 != sk && 149 sk2 != sk &&
150 (bitmap || udp_sk(sk2)->udp_port_hash == num) && 150 (bitmap || udp_sk(sk2)->udp_port_hash == num) &&
@@ -152,14 +152,13 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
152 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if || 152 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if ||
153 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && 153 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
154 (!sk2->sk_reuseport || !sk->sk_reuseport || 154 (!sk2->sk_reuseport || !sk->sk_reuseport ||
155 !uid_eq(uid, sock_i_uid(sk2))) && 155 !uid_eq(uid, sock_i_uid(sk2))) &&
156 (*saddr_comp)(sk, sk2)) { 156 saddr_comp(sk, sk2)) {
157 if (bitmap) 157 if (!bitmap)
158 __set_bit(udp_sk(sk2)->udp_port_hash >> log,
159 bitmap);
160 else
161 return 1; 158 return 1;
159 __set_bit(udp_sk(sk2)->udp_port_hash >> log, bitmap);
162 } 160 }
161 }
163 return 0; 162 return 0;
164} 163}
165 164
@@ -168,10 +167,10 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
168 * can insert/delete a socket with local_port == num 167 * can insert/delete a socket with local_port == num
169 */ 168 */
170static int udp_lib_lport_inuse2(struct net *net, __u16 num, 169static int udp_lib_lport_inuse2(struct net *net, __u16 num,
171 struct udp_hslot *hslot2, 170 struct udp_hslot *hslot2,
172 struct sock *sk, 171 struct sock *sk,
173 int (*saddr_comp)(const struct sock *sk1, 172 int (*saddr_comp)(const struct sock *sk1,
174 const struct sock *sk2)) 173 const struct sock *sk2))
175{ 174{
176 struct sock *sk2; 175 struct sock *sk2;
177 struct hlist_nulls_node *node; 176 struct hlist_nulls_node *node;
@@ -179,7 +178,7 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
179 int res = 0; 178 int res = 0;
180 179
181 spin_lock(&hslot2->lock); 180 spin_lock(&hslot2->lock);
182 udp_portaddr_for_each_entry(sk2, node, &hslot2->head) 181 udp_portaddr_for_each_entry(sk2, node, &hslot2->head) {
183 if (net_eq(sock_net(sk2), net) && 182 if (net_eq(sock_net(sk2), net) &&
184 sk2 != sk && 183 sk2 != sk &&
185 (udp_sk(sk2)->udp_port_hash == num) && 184 (udp_sk(sk2)->udp_port_hash == num) &&
@@ -187,11 +186,12 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
187 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if || 186 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if ||
188 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && 187 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
189 (!sk2->sk_reuseport || !sk->sk_reuseport || 188 (!sk2->sk_reuseport || !sk->sk_reuseport ||
190 !uid_eq(uid, sock_i_uid(sk2))) && 189 !uid_eq(uid, sock_i_uid(sk2))) &&
191 (*saddr_comp)(sk, sk2)) { 190 saddr_comp(sk, sk2)) {
192 res = 1; 191 res = 1;
193 break; 192 break;
194 } 193 }
194 }
195 spin_unlock(&hslot2->lock); 195 spin_unlock(&hslot2->lock);
196 return res; 196 return res;
197} 197}
@@ -206,8 +206,8 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
206 * with NULL address 206 * with NULL address
207 */ 207 */
208int udp_lib_get_port(struct sock *sk, unsigned short snum, 208int udp_lib_get_port(struct sock *sk, unsigned short snum,
209 int (*saddr_comp)(const struct sock *sk1, 209 int (*saddr_comp)(const struct sock *sk1,
210 const struct sock *sk2), 210 const struct sock *sk2),
211 unsigned int hash2_nulladdr) 211 unsigned int hash2_nulladdr)
212{ 212{
213 struct udp_hslot *hslot, *hslot2; 213 struct udp_hslot *hslot, *hslot2;
@@ -2033,7 +2033,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
2033 } else { 2033 } else {
2034 up->corkflag = 0; 2034 up->corkflag = 0;
2035 lock_sock(sk); 2035 lock_sock(sk);
2036 (*push_pending_frames)(sk); 2036 push_pending_frames(sk);
2037 release_sock(sk); 2037 release_sock(sk);
2038 } 2038 }
2039 break; 2039 break;