aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/iucv/af_iucv.c44
-rw-r--r--net/iucv/iucv.c49
2 files changed, 45 insertions, 48 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 026704a47296..2f1373855a8b 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -45,7 +45,8 @@ static struct proto iucv_proto = {
45static void iucv_callback_rx(struct iucv_path *, struct iucv_message *); 45static void iucv_callback_rx(struct iucv_path *, struct iucv_message *);
46static void iucv_callback_txdone(struct iucv_path *, struct iucv_message *); 46static void iucv_callback_txdone(struct iucv_path *, struct iucv_message *);
47static void iucv_callback_connack(struct iucv_path *, u8 ipuser[16]); 47static void iucv_callback_connack(struct iucv_path *, u8 ipuser[16]);
48static int iucv_callback_connreq(struct iucv_path *, u8 ipvmid[8], u8 ipuser[16]); 48static int iucv_callback_connreq(struct iucv_path *, u8 ipvmid[8],
49 u8 ipuser[16]);
49static void iucv_callback_connrej(struct iucv_path *, u8 ipuser[16]); 50static void iucv_callback_connrej(struct iucv_path *, u8 ipuser[16]);
50 51
51static struct iucv_sock_list iucv_sk_list = { 52static struct iucv_sock_list iucv_sk_list = {
@@ -152,7 +153,7 @@ static void iucv_sock_close(struct sock *sk)
152 iucv_sock_clear_timer(sk); 153 iucv_sock_clear_timer(sk);
153 lock_sock(sk); 154 lock_sock(sk);
154 155
155 switch(sk->sk_state) { 156 switch (sk->sk_state) {
156 case IUCV_LISTEN: 157 case IUCV_LISTEN:
157 iucv_sock_cleanup_listen(sk); 158 iucv_sock_cleanup_listen(sk);
158 break; 159 break;
@@ -164,7 +165,7 @@ static void iucv_sock_close(struct sock *sk)
164 sk->sk_state = IUCV_CLOSING; 165 sk->sk_state = IUCV_CLOSING;
165 sk->sk_state_change(sk); 166 sk->sk_state_change(sk);
166 167
167 if(!skb_queue_empty(&iucv->send_skb_q)) { 168 if (!skb_queue_empty(&iucv->send_skb_q)) {
168 if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) 169 if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime)
169 timeo = sk->sk_lingertime; 170 timeo = sk->sk_lingertime;
170 else 171 else
@@ -292,7 +293,7 @@ struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock)
292 struct iucv_sock *isk, *n; 293 struct iucv_sock *isk, *n;
293 struct sock *sk; 294 struct sock *sk;
294 295
295 list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q){ 296 list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q) {
296 sk = (struct sock *) isk; 297 sk = (struct sock *) isk;
297 lock_sock(sk); 298 lock_sock(sk);
298 299
@@ -537,7 +538,7 @@ static int iucv_sock_accept(struct socket *sock, struct socket *newsock,
537 538
538 /* Wait for an incoming connection */ 539 /* Wait for an incoming connection */
539 add_wait_queue_exclusive(sk->sk_sleep, &wait); 540 add_wait_queue_exclusive(sk->sk_sleep, &wait);
540 while (!(nsk = iucv_accept_dequeue(sk, newsock))){ 541 while (!(nsk = iucv_accept_dequeue(sk, newsock))) {
541 set_current_state(TASK_INTERRUPTIBLE); 542 set_current_state(TASK_INTERRUPTIBLE);
542 if (!timeo) { 543 if (!timeo) {
543 err = -EAGAIN; 544 err = -EAGAIN;
@@ -618,13 +619,13 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
618 goto out; 619 goto out;
619 } 620 }
620 621
621 if (sk->sk_state == IUCV_CONNECTED){ 622 if (sk->sk_state == IUCV_CONNECTED) {
622 if(!(skb = sock_alloc_send_skb(sk, len, 623 if (!(skb = sock_alloc_send_skb(sk, len,
623 msg->msg_flags & MSG_DONTWAIT, 624 msg->msg_flags & MSG_DONTWAIT,
624 &err))) 625 &err)))
625 goto out; 626 goto out;
626 627
627 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)){ 628 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
628 err = -EFAULT; 629 err = -EFAULT;
629 goto fail; 630 goto fail;
630 } 631 }
@@ -710,7 +711,7 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
710 711
711 /* Queue backlog skbs */ 712 /* Queue backlog skbs */
712 rskb = skb_dequeue(&iucv_sk(sk)->backlog_skb_q); 713 rskb = skb_dequeue(&iucv_sk(sk)->backlog_skb_q);
713 while(rskb) { 714 while (rskb) {
714 if (sock_queue_rcv_skb(sk, rskb)) { 715 if (sock_queue_rcv_skb(sk, rskb)) {
715 skb_queue_head(&iucv_sk(sk)->backlog_skb_q, 716 skb_queue_head(&iucv_sk(sk)->backlog_skb_q,
716 rskb); 717 rskb);
@@ -731,7 +732,7 @@ static inline unsigned int iucv_accept_poll(struct sock *parent)
731 struct iucv_sock *isk, *n; 732 struct iucv_sock *isk, *n;
732 struct sock *sk; 733 struct sock *sk;
733 734
734 list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q){ 735 list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q) {
735 sk = (struct sock *) isk; 736 sk = (struct sock *) isk;
736 737
737 if (sk->sk_state == IUCV_CONNECTED) 738 if (sk->sk_state == IUCV_CONNECTED)
@@ -762,7 +763,7 @@ unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
762 mask |= POLLHUP; 763 mask |= POLLHUP;
763 764
764 if (!skb_queue_empty(&sk->sk_receive_queue) || 765 if (!skb_queue_empty(&sk->sk_receive_queue) ||
765 (sk->sk_shutdown & RCV_SHUTDOWN)) 766 (sk->sk_shutdown & RCV_SHUTDOWN))
766 mask |= POLLIN | POLLRDNORM; 767 mask |= POLLIN | POLLRDNORM;
767 768
768 if (sk->sk_state == IUCV_CLOSED) 769 if (sk->sk_state == IUCV_CLOSED)
@@ -793,7 +794,7 @@ static int iucv_sock_shutdown(struct socket *sock, int how)
793 return -EINVAL; 794 return -EINVAL;
794 795
795 lock_sock(sk); 796 lock_sock(sk);
796 switch(sk->sk_state) { 797 switch (sk->sk_state) {
797 case IUCV_CLOSED: 798 case IUCV_CLOSED:
798 err = -ENOTCONN; 799 err = -ENOTCONN;
799 goto fail; 800 goto fail;
@@ -809,7 +810,7 @@ static int iucv_sock_shutdown(struct socket *sock, int how)
809 err = iucv_message_send(iucv->path, &txmsg, IUCV_IPRMDATA, 0, 810 err = iucv_message_send(iucv->path, &txmsg, IUCV_IPRMDATA, 0,
810 (void *) prmmsg, 8); 811 (void *) prmmsg, 8);
811 if (err) { 812 if (err) {
812 switch(err) { 813 switch (err) {
813 case 1: 814 case 1:
814 err = -ENOTCONN; 815 err = -ENOTCONN;
815 break; 816 break;
@@ -912,7 +913,7 @@ static int iucv_callback_connreq(struct iucv_path *path,
912 913
913 /* Create the new socket */ 914 /* Create the new socket */
914 nsk = iucv_sock_alloc(NULL, SOCK_STREAM, GFP_ATOMIC); 915 nsk = iucv_sock_alloc(NULL, SOCK_STREAM, GFP_ATOMIC);
915 if (!nsk){ 916 if (!nsk) {
916 err = iucv_path_sever(path, user_data); 917 err = iucv_path_sever(path, user_data);
917 goto fail; 918 goto fail;
918 } 919 }
@@ -935,7 +936,7 @@ static int iucv_callback_connreq(struct iucv_path *path,
935 936
936 path->msglim = IUCV_QUEUELEN_DEFAULT; 937 path->msglim = IUCV_QUEUELEN_DEFAULT;
937 err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk); 938 err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk);
938 if (err){ 939 if (err) {
939 err = iucv_path_sever(path, user_data); 940 err = iucv_path_sever(path, user_data);
940 goto fail; 941 goto fail;
941 } 942 }
@@ -966,7 +967,7 @@ static int iucv_fragment_skb(struct sock *sk, struct sk_buff *skb, int len,
966 struct sk_buff *nskb; 967 struct sk_buff *nskb;
967 968
968 dataleft = len; 969 dataleft = len;
969 while(dataleft) { 970 while (dataleft) {
970 if (dataleft >= sk->sk_rcvbuf / 4) 971 if (dataleft >= sk->sk_rcvbuf / 4)
971 size = sk->sk_rcvbuf / 4; 972 size = sk->sk_rcvbuf / 4;
972 else 973 else
@@ -989,6 +990,7 @@ static int iucv_fragment_skb(struct sock *sk, struct sk_buff *skb, int len,
989 990
990 return 0; 991 return 0;
991} 992}
993
992static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg) 994static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
993{ 995{
994 struct sock *sk = path->private; 996 struct sock *sk = path->private;
@@ -1035,7 +1037,7 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
1035 } 1037 }
1036 /* Queue the fragmented skb */ 1038 /* Queue the fragmented skb */
1037 fskb = skb_dequeue(&fragmented_skb_q); 1039 fskb = skb_dequeue(&fragmented_skb_q);
1038 while(fskb) { 1040 while (fskb) {
1039 if (!skb_queue_empty(&iucv->backlog_skb_q)) 1041 if (!skb_queue_empty(&iucv->backlog_skb_q))
1040 skb_queue_tail(&iucv->backlog_skb_q, fskb); 1042 skb_queue_tail(&iucv->backlog_skb_q, fskb);
1041 else if (sock_queue_rcv_skb(sk, fskb)) 1043 else if (sock_queue_rcv_skb(sk, fskb))
@@ -1076,7 +1078,7 @@ static void iucv_callback_txdone(struct iucv_path *path,
1076 kfree_skb(this); 1078 kfree_skb(this);
1077 } 1079 }
1078 1080
1079 if (sk->sk_state == IUCV_CLOSING){ 1081 if (sk->sk_state == IUCV_CLOSING) {
1080 if (skb_queue_empty(&iucv_sk(sk)->send_skb_q)) { 1082 if (skb_queue_empty(&iucv_sk(sk)->send_skb_q)) {
1081 sk->sk_state = IUCV_CLOSED; 1083 sk->sk_state = IUCV_CLOSED;
1082 sk->sk_state_change(sk); 1084 sk->sk_state_change(sk);
@@ -1123,7 +1125,7 @@ static struct net_proto_family iucv_sock_family_ops = {
1123 .create = iucv_sock_create, 1125 .create = iucv_sock_create,
1124}; 1126};
1125 1127
1126static int afiucv_init(void) 1128static int __init afiucv_init(void)
1127{ 1129{
1128 int err; 1130 int err;
1129 1131
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 903bdb6eaaa1..fb3faf72e850 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -32,7 +32,6 @@
32 32
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35
36#include <linux/spinlock.h> 35#include <linux/spinlock.h>
37#include <linux/kernel.h> 36#include <linux/kernel.h>
38#include <linux/slab.h> 37#include <linux/slab.h>
@@ -69,7 +68,7 @@
69#define IUCV_IPNORPY 0x10 68#define IUCV_IPNORPY 0x10
70#define IUCV_IPALL 0x80 69#define IUCV_IPALL 0x80
71 70
72static int iucv_bus_match (struct device *dev, struct device_driver *drv) 71static int iucv_bus_match(struct device *dev, struct device_driver *drv)
73{ 72{
74 return 0; 73 return 0;
75} 74}
@@ -78,8 +77,11 @@ struct bus_type iucv_bus = {
78 .name = "iucv", 77 .name = "iucv",
79 .match = iucv_bus_match, 78 .match = iucv_bus_match,
80}; 79};
80EXPORT_SYMBOL(iucv_bus);
81 81
82struct device *iucv_root; 82struct device *iucv_root;
83EXPORT_SYMBOL(iucv_root);
84
83static int iucv_available; 85static int iucv_available;
84 86
85/* General IUCV interrupt structure */ 87/* General IUCV interrupt structure */
@@ -405,7 +407,7 @@ static void iucv_declare_cpu(void *data)
405 rc = iucv_call_b2f0(IUCV_DECLARE_BUFFER, parm); 407 rc = iucv_call_b2f0(IUCV_DECLARE_BUFFER, parm);
406 if (rc) { 408 if (rc) {
407 char *err = "Unknown"; 409 char *err = "Unknown";
408 switch(rc) { 410 switch (rc) {
409 case 0x03: 411 case 0x03:
410 err = "Directory error"; 412 err = "Directory error";
411 break; 413 break;
@@ -588,7 +590,7 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
588 return NOTIFY_OK; 590 return NOTIFY_OK;
589} 591}
590 592
591static struct notifier_block iucv_cpu_notifier = { 593static struct notifier_block __cpuinitdata iucv_cpu_notifier = {
592 .notifier_call = iucv_cpu_notify, 594 .notifier_call = iucv_cpu_notify,
593}; 595};
594 596
@@ -691,6 +693,7 @@ out_mutex:
691 mutex_unlock(&iucv_register_mutex); 693 mutex_unlock(&iucv_register_mutex);
692 return rc; 694 return rc;
693} 695}
696EXPORT_SYMBOL(iucv_register);
694 697
695/** 698/**
696 * iucv_unregister 699 * iucv_unregister
@@ -723,6 +726,7 @@ void iucv_unregister(struct iucv_handler *handler, int smp)
723 iucv_setmask_mp(); 726 iucv_setmask_mp();
724 mutex_unlock(&iucv_register_mutex); 727 mutex_unlock(&iucv_register_mutex);
725} 728}
729EXPORT_SYMBOL(iucv_unregister);
726 730
727/** 731/**
728 * iucv_path_accept 732 * iucv_path_accept
@@ -761,6 +765,7 @@ int iucv_path_accept(struct iucv_path *path, struct iucv_handler *handler,
761 local_bh_enable(); 765 local_bh_enable();
762 return rc; 766 return rc;
763} 767}
768EXPORT_SYMBOL(iucv_path_accept);
764 769
765/** 770/**
766 * iucv_path_connect 771 * iucv_path_connect
@@ -824,6 +829,7 @@ int iucv_path_connect(struct iucv_path *path, struct iucv_handler *handler,
824 spin_unlock_bh(&iucv_table_lock); 829 spin_unlock_bh(&iucv_table_lock);
825 return rc; 830 return rc;
826} 831}
832EXPORT_SYMBOL(iucv_path_connect);
827 833
828/** 834/**
829 * iucv_path_quiesce: 835 * iucv_path_quiesce:
@@ -850,6 +856,7 @@ int iucv_path_quiesce(struct iucv_path *path, u8 userdata[16])
850 local_bh_enable(); 856 local_bh_enable();
851 return rc; 857 return rc;
852} 858}
859EXPORT_SYMBOL(iucv_path_quiesce);
853 860
854/** 861/**
855 * iucv_path_resume: 862 * iucv_path_resume:
@@ -890,7 +897,6 @@ int iucv_path_sever(struct iucv_path *path, u8 userdata[16])
890{ 897{
891 int rc; 898 int rc;
892 899
893
894 preempt_disable(); 900 preempt_disable();
895 if (iucv_active_cpu != smp_processor_id()) 901 if (iucv_active_cpu != smp_processor_id())
896 spin_lock_bh(&iucv_table_lock); 902 spin_lock_bh(&iucv_table_lock);
@@ -904,6 +910,7 @@ int iucv_path_sever(struct iucv_path *path, u8 userdata[16])
904 preempt_enable(); 910 preempt_enable();
905 return rc; 911 return rc;
906} 912}
913EXPORT_SYMBOL(iucv_path_sever);
907 914
908/** 915/**
909 * iucv_message_purge 916 * iucv_message_purge
@@ -936,6 +943,7 @@ int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
936 local_bh_enable(); 943 local_bh_enable();
937 return rc; 944 return rc;
938} 945}
946EXPORT_SYMBOL(iucv_message_purge);
939 947
940/** 948/**
941 * iucv_message_receive 949 * iucv_message_receive
@@ -1006,6 +1014,7 @@ int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
1006 local_bh_enable(); 1014 local_bh_enable();
1007 return rc; 1015 return rc;
1008} 1016}
1017EXPORT_SYMBOL(iucv_message_receive);
1009 1018
1010/** 1019/**
1011 * iucv_message_reject 1020 * iucv_message_reject
@@ -1034,6 +1043,7 @@ int iucv_message_reject(struct iucv_path *path, struct iucv_message *msg)
1034 local_bh_enable(); 1043 local_bh_enable();
1035 return rc; 1044 return rc;
1036} 1045}
1046EXPORT_SYMBOL(iucv_message_reject);
1037 1047
1038/** 1048/**
1039 * iucv_message_reply 1049 * iucv_message_reply
@@ -1077,6 +1087,7 @@ int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
1077 local_bh_enable(); 1087 local_bh_enable();
1078 return rc; 1088 return rc;
1079} 1089}
1090EXPORT_SYMBOL(iucv_message_reply);
1080 1091
1081/** 1092/**
1082 * iucv_message_send 1093 * iucv_message_send
@@ -1125,6 +1136,7 @@ int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
1125 local_bh_enable(); 1136 local_bh_enable();
1126 return rc; 1137 return rc;
1127} 1138}
1139EXPORT_SYMBOL(iucv_message_send);
1128 1140
1129/** 1141/**
1130 * iucv_message_send2way 1142 * iucv_message_send2way
@@ -1181,6 +1193,7 @@ int iucv_message_send2way(struct iucv_path *path, struct iucv_message *msg,
1181 local_bh_enable(); 1193 local_bh_enable();
1182 return rc; 1194 return rc;
1183} 1195}
1196EXPORT_SYMBOL(iucv_message_send2way);
1184 1197
1185/** 1198/**
1186 * iucv_path_pending 1199 * iucv_path_pending
@@ -1572,7 +1585,7 @@ static void iucv_external_interrupt(u16 code)
1572 * 1585 *
1573 * Allocates and initializes various data structures. 1586 * Allocates and initializes various data structures.
1574 */ 1587 */
1575static int iucv_init(void) 1588static int __init iucv_init(void)
1576{ 1589{
1577 int rc; 1590 int rc;
1578 1591
@@ -1583,7 +1596,7 @@ static int iucv_init(void)
1583 rc = iucv_query_maxconn(); 1596 rc = iucv_query_maxconn();
1584 if (rc) 1597 if (rc)
1585 goto out; 1598 goto out;
1586 rc = register_external_interrupt (0x4000, iucv_external_interrupt); 1599 rc = register_external_interrupt(0x4000, iucv_external_interrupt);
1587 if (rc) 1600 if (rc)
1588 goto out; 1601 goto out;
1589 rc = bus_register(&iucv_bus); 1602 rc = bus_register(&iucv_bus);
@@ -1594,7 +1607,7 @@ static int iucv_init(void)
1594 rc = PTR_ERR(iucv_root); 1607 rc = PTR_ERR(iucv_root);
1595 goto out_bus; 1608 goto out_bus;
1596 } 1609 }
1597 /* Note: GFP_DMA used used to get memory below 2G */ 1610 /* Note: GFP_DMA used to get memory below 2G */
1598 iucv_irq_data = percpu_alloc(sizeof(struct iucv_irq_data), 1611 iucv_irq_data = percpu_alloc(sizeof(struct iucv_irq_data),
1599 GFP_KERNEL|GFP_DMA); 1612 GFP_KERNEL|GFP_DMA);
1600 if (!iucv_irq_data) { 1613 if (!iucv_irq_data) {
@@ -1632,7 +1645,7 @@ out:
1632 * 1645 *
1633 * Frees everything allocated from iucv_init. 1646 * Frees everything allocated from iucv_init.
1634 */ 1647 */
1635static void iucv_exit(void) 1648static void __exit iucv_exit(void)
1636{ 1649{
1637 struct iucv_irq_list *p, *n; 1650 struct iucv_irq_list *p, *n;
1638 1651
@@ -1653,24 +1666,6 @@ static void iucv_exit(void)
1653subsys_initcall(iucv_init); 1666subsys_initcall(iucv_init);
1654module_exit(iucv_exit); 1667module_exit(iucv_exit);
1655 1668
1656/**
1657 * Export all public stuff
1658 */
1659EXPORT_SYMBOL (iucv_bus);
1660EXPORT_SYMBOL (iucv_root);
1661EXPORT_SYMBOL (iucv_register);
1662EXPORT_SYMBOL (iucv_unregister);
1663EXPORT_SYMBOL (iucv_path_accept);
1664EXPORT_SYMBOL (iucv_path_connect);
1665EXPORT_SYMBOL (iucv_path_quiesce);
1666EXPORT_SYMBOL (iucv_path_sever);
1667EXPORT_SYMBOL (iucv_message_purge);
1668EXPORT_SYMBOL (iucv_message_receive);
1669EXPORT_SYMBOL (iucv_message_reject);
1670EXPORT_SYMBOL (iucv_message_reply);
1671EXPORT_SYMBOL (iucv_message_send);
1672EXPORT_SYMBOL (iucv_message_send2way);
1673
1674MODULE_AUTHOR("(C) 2001 IBM Corp. by Fritz Elfert (felfert@millenux.com)"); 1669MODULE_AUTHOR("(C) 2001 IBM Corp. by Fritz Elfert (felfert@millenux.com)");
1675MODULE_DESCRIPTION("Linux for S/390 IUCV lowlevel driver"); 1670MODULE_DESCRIPTION("Linux for S/390 IUCV lowlevel driver");
1676MODULE_LICENSE("GPL"); 1671MODULE_LICENSE("GPL");