diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-03-08 23:41:55 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:07 -0400 |
commit | 6516c65573fde5e421c6c92c4b180bbe2245b23b (patch) | |
tree | 8c319e78cebc128cc3363e12c7faaaebf454c568 /net/ipv4/udp.c | |
parent | a2a316fd068c455c609ecc155dcfaa7e208d29fe (diff) |
[UDP]: ipv4 whitespace cleanup
Fix whitespace around keywords.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 86368832d481..21901d2c5324 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -175,7 +175,8 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum, | |||
175 | ; | 175 | ; |
176 | } | 176 | } |
177 | result = best; | 177 | result = best; |
178 | for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { | 178 | for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; |
179 | i++, result += UDP_HTABLE_SIZE) { | ||
179 | if (result > sysctl_local_port_range[1]) | 180 | if (result > sysctl_local_port_range[1]) |
180 | result = sysctl_local_port_range[0] | 181 | result = sysctl_local_port_range[0] |
181 | + ((result - sysctl_local_port_range[0]) & | 182 | + ((result - sysctl_local_port_range[0]) & |
@@ -270,10 +271,10 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport, | |||
270 | continue; | 271 | continue; |
271 | score+=2; | 272 | score+=2; |
272 | } | 273 | } |
273 | if(score == 9) { | 274 | if (score == 9) { |
274 | result = sk; | 275 | result = sk; |
275 | break; | 276 | break; |
276 | } else if(score > badness) { | 277 | } else if (score > badness) { |
277 | result = sk; | 278 | result = sk; |
278 | badness = score; | 279 | badness = score; |
279 | } | 280 | } |
@@ -765,38 +766,38 @@ out: | |||
765 | 766 | ||
766 | int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) | 767 | int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) |
767 | { | 768 | { |
768 | switch(cmd) | 769 | switch (cmd) { |
770 | case SIOCOUTQ: | ||
769 | { | 771 | { |
770 | case SIOCOUTQ: | 772 | int amount = atomic_read(&sk->sk_wmem_alloc); |
771 | { | 773 | return put_user(amount, (int __user *)arg); |
772 | int amount = atomic_read(&sk->sk_wmem_alloc); | 774 | } |
773 | return put_user(amount, (int __user *)arg); | ||
774 | } | ||
775 | 775 | ||
776 | case SIOCINQ: | 776 | case SIOCINQ: |
777 | { | 777 | { |
778 | struct sk_buff *skb; | 778 | struct sk_buff *skb; |
779 | unsigned long amount; | 779 | unsigned long amount; |
780 | 780 | ||
781 | amount = 0; | 781 | amount = 0; |
782 | spin_lock_bh(&sk->sk_receive_queue.lock); | 782 | spin_lock_bh(&sk->sk_receive_queue.lock); |
783 | skb = skb_peek(&sk->sk_receive_queue); | 783 | skb = skb_peek(&sk->sk_receive_queue); |
784 | if (skb != NULL) { | 784 | if (skb != NULL) { |
785 | /* | 785 | /* |
786 | * We will only return the amount | 786 | * We will only return the amount |
787 | * of this packet since that is all | 787 | * of this packet since that is all |
788 | * that will be read. | 788 | * that will be read. |
789 | */ | 789 | */ |
790 | amount = skb->len - sizeof(struct udphdr); | 790 | amount = skb->len - sizeof(struct udphdr); |
791 | } | ||
792 | spin_unlock_bh(&sk->sk_receive_queue.lock); | ||
793 | return put_user(amount, (int __user *)arg); | ||
794 | } | 791 | } |
792 | spin_unlock_bh(&sk->sk_receive_queue.lock); | ||
793 | return put_user(amount, (int __user *)arg); | ||
794 | } | ||
795 | 795 | ||
796 | default: | 796 | default: |
797 | return -ENOIOCTLCMD; | 797 | return -ENOIOCTLCMD; |
798 | } | 798 | } |
799 | return(0); | 799 | |
800 | return 0; | ||
800 | } | 801 | } |
801 | 802 | ||
802 | /* | 803 | /* |
@@ -958,7 +959,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) | |||
958 | /* Check if this is a keepalive packet. If so, eat it. */ | 959 | /* Check if this is a keepalive packet. If so, eat it. */ |
959 | if (len == 1 && udpdata[0] == 0xff) { | 960 | if (len == 1 && udpdata[0] == 0xff) { |
960 | return 0; | 961 | return 0; |
961 | } else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0 ) { | 962 | } else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0) { |
962 | /* ESP Packet without Non-ESP header */ | 963 | /* ESP Packet without Non-ESP header */ |
963 | len = sizeof(struct udphdr); | 964 | len = sizeof(struct udphdr); |
964 | } else | 965 | } else |
@@ -1141,10 +1142,10 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb, | |||
1141 | 1142 | ||
1142 | sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr, | 1143 | sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr, |
1143 | uh->source, saddr, dif); | 1144 | uh->source, saddr, dif); |
1144 | if(sknext) | 1145 | if (sknext) |
1145 | skb1 = skb_clone(skb, GFP_ATOMIC); | 1146 | skb1 = skb_clone(skb, GFP_ATOMIC); |
1146 | 1147 | ||
1147 | if(skb1) { | 1148 | if (skb1) { |
1148 | int ret = udp_queue_rcv_skb(sk, skb1); | 1149 | int ret = udp_queue_rcv_skb(sk, skb1); |
1149 | if (ret > 0) | 1150 | if (ret > 0) |
1150 | /* we should probably re-process instead | 1151 | /* we should probably re-process instead |
@@ -1152,7 +1153,7 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb, | |||
1152 | kfree_skb(skb1); | 1153 | kfree_skb(skb1); |
1153 | } | 1154 | } |
1154 | sk = sknext; | 1155 | sk = sknext; |
1155 | } while(sknext); | 1156 | } while (sknext); |
1156 | } else | 1157 | } else |
1157 | kfree_skb(skb); | 1158 | kfree_skb(skb); |
1158 | read_unlock(&udp_hash_lock); | 1159 | read_unlock(&udp_hash_lock); |
@@ -1230,7 +1231,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1230 | if (udp4_csum_init(skb, uh, proto)) | 1231 | if (udp4_csum_init(skb, uh, proto)) |
1231 | goto csum_error; | 1232 | goto csum_error; |
1232 | 1233 | ||
1233 | if(rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) | 1234 | if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) |
1234 | return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); | 1235 | return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); |
1235 | 1236 | ||
1236 | sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, | 1237 | sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, |
@@ -1264,7 +1265,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1264 | * don't wanna listen. Ignore it. | 1265 | * don't wanna listen. Ignore it. |
1265 | */ | 1266 | */ |
1266 | kfree_skb(skb); | 1267 | kfree_skb(skb); |
1267 | return(0); | 1268 | return 0; |
1268 | 1269 | ||
1269 | short_packet: | 1270 | short_packet: |
1270 | LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %u.%u.%u.%u:%u %d/%d to %u.%u.%u.%u:%u\n", | 1271 | LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %u.%u.%u.%u:%u %d/%d to %u.%u.%u.%u:%u\n", |
@@ -1292,7 +1293,7 @@ csum_error: | |||
1292 | drop: | 1293 | drop: |
1293 | UDP_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); | 1294 | UDP_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); |
1294 | kfree_skb(skb); | 1295 | kfree_skb(skb); |
1295 | return(0); | 1296 | return 0; |
1296 | } | 1297 | } |
1297 | 1298 | ||
1298 | __inline__ int udp_rcv(struct sk_buff *skb) | 1299 | __inline__ int udp_rcv(struct sk_buff *skb) |
@@ -1319,13 +1320,13 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
1319 | int val; | 1320 | int val; |
1320 | int err = 0; | 1321 | int err = 0; |
1321 | 1322 | ||
1322 | if(optlen<sizeof(int)) | 1323 | if (optlen<sizeof(int)) |
1323 | return -EINVAL; | 1324 | return -EINVAL; |
1324 | 1325 | ||
1325 | if (get_user(val, (int __user *)optval)) | 1326 | if (get_user(val, (int __user *)optval)) |
1326 | return -EFAULT; | 1327 | return -EFAULT; |
1327 | 1328 | ||
1328 | switch(optname) { | 1329 | switch (optname) { |
1329 | case UDP_CORK: | 1330 | case UDP_CORK: |
1330 | if (val != 0) { | 1331 | if (val != 0) { |
1331 | up->corkflag = 1; | 1332 | up->corkflag = 1; |
@@ -1379,7 +1380,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
1379 | default: | 1380 | default: |
1380 | err = -ENOPROTOOPT; | 1381 | err = -ENOPROTOOPT; |
1381 | break; | 1382 | break; |
1382 | }; | 1383 | } |
1383 | 1384 | ||
1384 | return err; | 1385 | return err; |
1385 | } | 1386 | } |
@@ -1410,15 +1411,15 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, | |||
1410 | struct udp_sock *up = udp_sk(sk); | 1411 | struct udp_sock *up = udp_sk(sk); |
1411 | int val, len; | 1412 | int val, len; |
1412 | 1413 | ||
1413 | if(get_user(len,optlen)) | 1414 | if (get_user(len,optlen)) |
1414 | return -EFAULT; | 1415 | return -EFAULT; |
1415 | 1416 | ||
1416 | len = min_t(unsigned int, len, sizeof(int)); | 1417 | len = min_t(unsigned int, len, sizeof(int)); |
1417 | 1418 | ||
1418 | if(len < 0) | 1419 | if (len < 0) |
1419 | return -EINVAL; | 1420 | return -EINVAL; |
1420 | 1421 | ||
1421 | switch(optname) { | 1422 | switch (optname) { |
1422 | case UDP_CORK: | 1423 | case UDP_CORK: |
1423 | val = up->corkflag; | 1424 | val = up->corkflag; |
1424 | break; | 1425 | break; |
@@ -1439,11 +1440,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, | |||
1439 | 1440 | ||
1440 | default: | 1441 | default: |
1441 | return -ENOPROTOOPT; | 1442 | return -ENOPROTOOPT; |
1442 | }; | 1443 | } |
1443 | 1444 | ||
1444 | if(put_user(len, optlen)) | 1445 | if (put_user(len, optlen)) |
1445 | return -EFAULT; | 1446 | return -EFAULT; |
1446 | if(copy_to_user(optval, &val,len)) | 1447 | if (copy_to_user(optval, &val,len)) |
1447 | return -EFAULT; | 1448 | return -EFAULT; |
1448 | return 0; | 1449 | return 0; |
1449 | } | 1450 | } |
@@ -1575,7 +1576,7 @@ static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) | |||
1575 | struct sock *sk = udp_get_first(seq); | 1576 | struct sock *sk = udp_get_first(seq); |
1576 | 1577 | ||
1577 | if (sk) | 1578 | if (sk) |
1578 | while(pos && (sk = udp_get_next(seq, sk)) != NULL) | 1579 | while (pos && (sk = udp_get_next(seq, sk)) != NULL) |
1579 | --pos; | 1580 | --pos; |
1580 | return pos ? NULL : sk; | 1581 | return pos ? NULL : sk; |
1581 | } | 1582 | } |