diff options
-rw-r--r-- | net/econet/af_econet.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 4d66aac13483..f2ce41434290 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -139,7 +139,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
139 | skb=skb_recv_datagram(sk,flags,flags&MSG_DONTWAIT,&err); | 139 | skb=skb_recv_datagram(sk,flags,flags&MSG_DONTWAIT,&err); |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * An error occurred so return it. Because skb_recv_datagram() | 142 | * An error occurred so return it. Because skb_recv_datagram() |
143 | * handles the blocking we don't see and worry about blocking | 143 | * handles the blocking we don't see and worry about blocking |
144 | * retries. | 144 | * retries. |
145 | */ | 145 | */ |
@@ -190,15 +190,15 @@ static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len | |||
190 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; | 190 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; |
191 | struct sock *sk; | 191 | struct sock *sk; |
192 | struct econet_sock *eo; | 192 | struct econet_sock *eo; |
193 | 193 | ||
194 | /* | 194 | /* |
195 | * Check legality | 195 | * Check legality |
196 | */ | 196 | */ |
197 | 197 | ||
198 | if (addr_len < sizeof(struct sockaddr_ec) || | 198 | if (addr_len < sizeof(struct sockaddr_ec) || |
199 | sec->sec_family != AF_ECONET) | 199 | sec->sec_family != AF_ECONET) |
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | 201 | ||
202 | mutex_lock(&econet_mutex); | 202 | mutex_lock(&econet_mutex); |
203 | 203 | ||
204 | sk = sock->sk; | 204 | sk = sock->sk; |
@@ -283,18 +283,18 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
283 | int i; | 283 | int i; |
284 | mm_segment_t oldfs; | 284 | mm_segment_t oldfs; |
285 | #endif | 285 | #endif |
286 | 286 | ||
287 | /* | 287 | /* |
288 | * Check the flags. | 288 | * Check the flags. |
289 | */ | 289 | */ |
290 | 290 | ||
291 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) | 291 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) |
292 | return -EINVAL; | 292 | return -EINVAL; |
293 | 293 | ||
294 | /* | 294 | /* |
295 | * Get and verify the address. | 295 | * Get and verify the address. |
296 | */ | 296 | */ |
297 | 297 | ||
298 | mutex_lock(&econet_mutex); | 298 | mutex_lock(&econet_mutex); |
299 | 299 | ||
300 | if (saddr == NULL) { | 300 | if (saddr == NULL) { |
@@ -339,17 +339,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
339 | unsigned short proto = 0; | 339 | unsigned short proto = 0; |
340 | 340 | ||
341 | dev_hold(dev); | 341 | dev_hold(dev); |
342 | 342 | ||
343 | skb = sock_alloc_send_skb(sk, len+LL_RESERVED_SPACE(dev), | 343 | skb = sock_alloc_send_skb(sk, len+LL_RESERVED_SPACE(dev), |
344 | msg->msg_flags & MSG_DONTWAIT, &err); | 344 | msg->msg_flags & MSG_DONTWAIT, &err); |
345 | if (skb==NULL) | 345 | if (skb==NULL) |
346 | goto out_unlock; | 346 | goto out_unlock; |
347 | 347 | ||
348 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 348 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
349 | skb->nh.raw = skb->data; | 349 | skb->nh.raw = skb->data; |
350 | 350 | ||
351 | eb = (struct ec_cb *)&skb->cb; | 351 | eb = (struct ec_cb *)&skb->cb; |
352 | 352 | ||
353 | /* BUG: saddr may be NULL */ | 353 | /* BUG: saddr may be NULL */ |
354 | eb->cookie = saddr->cookie; | 354 | eb->cookie = saddr->cookie; |
355 | eb->sec = *saddr; | 355 | eb->sec = *saddr; |
@@ -359,7 +359,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
359 | int res; | 359 | int res; |
360 | struct ec_framehdr *fh; | 360 | struct ec_framehdr *fh; |
361 | err = -EINVAL; | 361 | err = -EINVAL; |
362 | res = dev->hard_header(skb, dev, ntohs(proto), | 362 | res = dev->hard_header(skb, dev, ntohs(proto), |
363 | &addr, NULL, len); | 363 | &addr, NULL, len); |
364 | /* Poke in our control byte and | 364 | /* Poke in our control byte and |
365 | port number. Hack, hack. */ | 365 | port number. Hack, hack. */ |
@@ -372,7 +372,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
372 | } else if (res < 0) | 372 | } else if (res < 0) |
373 | goto out_free; | 373 | goto out_free; |
374 | } | 374 | } |
375 | 375 | ||
376 | /* Copy the data. Returns -EFAULT on error */ | 376 | /* Copy the data. Returns -EFAULT on error */ |
377 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); | 377 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); |
378 | skb->protocol = proto; | 378 | skb->protocol = proto; |
@@ -380,15 +380,15 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
380 | skb->priority = sk->sk_priority; | 380 | skb->priority = sk->sk_priority; |
381 | if (err) | 381 | if (err) |
382 | goto out_free; | 382 | goto out_free; |
383 | 383 | ||
384 | err = -ENETDOWN; | 384 | err = -ENETDOWN; |
385 | if (!(dev->flags & IFF_UP)) | 385 | if (!(dev->flags & IFF_UP)) |
386 | goto out_free; | 386 | goto out_free; |
387 | 387 | ||
388 | /* | 388 | /* |
389 | * Now send it | 389 | * Now send it |
390 | */ | 390 | */ |
391 | 391 | ||
392 | dev_queue_xmit(skb); | 392 | dev_queue_xmit(skb); |
393 | dev_put(dev); | 393 | dev_put(dev); |
394 | mutex_unlock(&econet_mutex); | 394 | mutex_unlock(&econet_mutex); |
@@ -414,7 +414,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
414 | mutex_unlock(&econet_mutex); | 414 | mutex_unlock(&econet_mutex); |
415 | return -ENETDOWN; /* No socket - can't send */ | 415 | return -ENETDOWN; /* No socket - can't send */ |
416 | } | 416 | } |
417 | 417 | ||
418 | /* Make up a UDP datagram and hand it off to some higher intellect. */ | 418 | /* Make up a UDP datagram and hand it off to some higher intellect. */ |
419 | 419 | ||
420 | memset(&udpdest, 0, sizeof(udpdest)); | 420 | memset(&udpdest, 0, sizeof(udpdest)); |
@@ -432,7 +432,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
432 | idev = __in_dev_get_rcu(dev); | 432 | idev = __in_dev_get_rcu(dev); |
433 | if (idev) { | 433 | if (idev) { |
434 | if (idev->ifa_list) | 434 | if (idev->ifa_list) |
435 | network = ntohl(idev->ifa_list->ifa_address) & | 435 | network = ntohl(idev->ifa_list->ifa_address) & |
436 | 0xffffff00; /* !!! */ | 436 | 0xffffff00; /* !!! */ |
437 | } | 437 | } |
438 | rcu_read_unlock(); | 438 | rcu_read_unlock(); |
@@ -470,7 +470,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
470 | } | 470 | } |
471 | 471 | ||
472 | /* Get a skbuff (no data, just holds our cb information) */ | 472 | /* Get a skbuff (no data, just holds our cb information) */ |
473 | if ((skb = sock_alloc_send_skb(sk, 0, | 473 | if ((skb = sock_alloc_send_skb(sk, 0, |
474 | msg->msg_flags & MSG_DONTWAIT, | 474 | msg->msg_flags & MSG_DONTWAIT, |
475 | &err)) == NULL) { | 475 | &err)) == NULL) { |
476 | mutex_unlock(&econet_mutex); | 476 | mutex_unlock(&econet_mutex); |
@@ -660,7 +660,7 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
660 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) | 660 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) |
661 | return -EFAULT; | 661 | return -EFAULT; |
662 | 662 | ||
663 | if ((dev = dev_get_by_name(ifr.ifr_name)) == NULL) | 663 | if ((dev = dev_get_by_name(ifr.ifr_name)) == NULL) |
664 | return -ENODEV; | 664 | return -ENODEV; |
665 | 665 | ||
666 | sec = (struct sockaddr_ec *)&ifr.ifr_addr; | 666 | sec = (struct sockaddr_ec *)&ifr.ifr_addr; |
@@ -754,7 +754,7 @@ static const struct proto_ops econet_ops = { | |||
754 | .connect = sock_no_connect, | 754 | .connect = sock_no_connect, |
755 | .socketpair = sock_no_socketpair, | 755 | .socketpair = sock_no_socketpair, |
756 | .accept = sock_no_accept, | 756 | .accept = sock_no_accept, |
757 | .getname = econet_getname, | 757 | .getname = econet_getname, |
758 | .poll = datagram_poll, | 758 | .poll = datagram_poll, |
759 | .ioctl = econet_ioctl, | 759 | .ioctl = econet_ioctl, |
760 | .listen = sock_no_listen, | 760 | .listen = sock_no_listen, |
@@ -780,7 +780,7 @@ static struct sock *ec_listening_socket(unsigned char port, unsigned char | |||
780 | 780 | ||
781 | sk_for_each(sk, node, &econet_sklist) { | 781 | sk_for_each(sk, node, &econet_sklist) { |
782 | struct econet_sock *opt = ec_sk(sk); | 782 | struct econet_sock *opt = ec_sk(sk); |
783 | if ((opt->port == port || opt->port == 0) && | 783 | if ((opt->port == port || opt->port == 0) && |
784 | (opt->station == station || opt->station == 0) && | 784 | (opt->station == station || opt->station == 0) && |
785 | (opt->net == net || opt->net == 0)) | 785 | (opt->net == net || opt->net == 0)) |
786 | goto found; | 786 | goto found; |
@@ -815,7 +815,7 @@ static int ec_queue_packet(struct sock *sk, struct sk_buff *skb, | |||
815 | 815 | ||
816 | #ifdef CONFIG_ECONET_AUNUDP | 816 | #ifdef CONFIG_ECONET_AUNUDP |
817 | /* | 817 | /* |
818 | * Send an AUN protocol response. | 818 | * Send an AUN protocol response. |
819 | */ | 819 | */ |
820 | 820 | ||
821 | static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb) | 821 | static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb) |
@@ -828,7 +828,7 @@ static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb) | |||
828 | struct aunhdr ah = {.code = code, .cb = cb, .handle = seq}; | 828 | struct aunhdr ah = {.code = code, .cb = cb, .handle = seq}; |
829 | struct kvec iov = {.iov_base = (void *)&ah, .iov_len = sizeof(ah)}; | 829 | struct kvec iov = {.iov_base = (void *)&ah, .iov_len = sizeof(ah)}; |
830 | struct msghdr udpmsg; | 830 | struct msghdr udpmsg; |
831 | 831 | ||
832 | udpmsg.msg_name = (void *)&sin; | 832 | udpmsg.msg_name = (void *)&sin; |
833 | udpmsg.msg_namelen = sizeof(sin); | 833 | udpmsg.msg_namelen = sizeof(sin); |
834 | udpmsg.msg_control = NULL; | 834 | udpmsg.msg_control = NULL; |
@@ -858,7 +858,7 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) | |||
858 | if ((sk = ec_listening_socket(ah->port, stn, edev->net)) == NULL) | 858 | if ((sk = ec_listening_socket(ah->port, stn, edev->net)) == NULL) |
859 | goto bad; /* Nobody wants it */ | 859 | goto bad; /* Nobody wants it */ |
860 | 860 | ||
861 | newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15, | 861 | newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15, |
862 | GFP_ATOMIC); | 862 | GFP_ATOMIC); |
863 | if (newskb == NULL) | 863 | if (newskb == NULL) |
864 | { | 864 | { |
@@ -867,7 +867,7 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) | |||
867 | goto bad; | 867 | goto bad; |
868 | } | 868 | } |
869 | 869 | ||
870 | memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah+1), | 870 | memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah+1), |
871 | len - sizeof(struct aunhdr)); | 871 | len - sizeof(struct aunhdr)); |
872 | 872 | ||
873 | if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port)) | 873 | if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port)) |
@@ -990,7 +990,7 @@ static void ab_cleanup(unsigned long h) | |||
990 | struct ec_cb *eb = (struct ec_cb *)&skb->cb; | 990 | struct ec_cb *eb = (struct ec_cb *)&skb->cb; |
991 | if ((jiffies - eb->start) > eb->timeout) | 991 | if ((jiffies - eb->start) > eb->timeout) |
992 | { | 992 | { |
993 | tx_result(skb->sk, eb->cookie, | 993 | tx_result(skb->sk, eb->cookie, |
994 | ECTYPE_TRANSMIT_NOT_PRESENT); | 994 | ECTYPE_TRANSMIT_NOT_PRESENT); |
995 | skb_unlink(skb, &aun_queue); | 995 | skb_unlink(skb, &aun_queue); |
996 | kfree_skb(skb); | 996 | kfree_skb(skb); |
@@ -1024,11 +1024,11 @@ static int __init aun_udp_initialise(void) | |||
1024 | printk("AUN: socket error %d\n", -error); | 1024 | printk("AUN: socket error %d\n", -error); |
1025 | return error; | 1025 | return error; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | udpsock->sk->sk_reuse = 1; | 1028 | udpsock->sk->sk_reuse = 1; |
1029 | udpsock->sk->sk_allocation = GFP_ATOMIC; /* we're going to call it | 1029 | udpsock->sk->sk_allocation = GFP_ATOMIC; /* we're going to call it |
1030 | from interrupts */ | 1030 | from interrupts */ |
1031 | 1031 | ||
1032 | error = udpsock->ops->bind(udpsock, (struct sockaddr *)&sin, | 1032 | error = udpsock->ops->bind(udpsock, (struct sockaddr *)&sin, |
1033 | sizeof(sin)); | 1033 | sizeof(sin)); |
1034 | if (error < 0) | 1034 | if (error < 0) |