2 * linux/net/iucv/af_iucv.c
4 * IUCV protocol stack for Linux on zSeries
6 * Copyright 2006 IBM Corporation
8 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
11 #include <linux/module.h>
12 #include <linux/types.h>
13 #include <linux/list.h>
14 #include <linux/errno.h>
15 #include <linux/kernel.h>
16 #include <linux/sched.h>
17 #include <linux/slab.h>
18 #include <linux/skbuff.h>
19 #include <linux/init.h>
20 #include <linux/poll.h>
22 #include <asm/ebcdic.h>
23 #include <asm/cpcmd.h>
24 #include <linux/kmod.h>
26 #include <net/iucv/iucv.h>
27 #include <net/iucv/af_iucv.h>
29 #define CONFIG_IUCV_SOCK_DEBUG 1
34 static char iucv_userid[80];
36 static struct proto_ops iucv_sock_ops;
38 static struct proto iucv_proto = {
41 .obj_size = sizeof(struct iucv_sock),
44 /* Call Back functions */
45 static void iucv_callback_rx(struct iucv_path *, struct iucv_message *);
46 static void iucv_callback_txdone(struct iucv_path *, struct iucv_message *);
47 static void iucv_callback_connack(struct iucv_path *, u8 ipuser[16]);
48 static int iucv_callback_connreq(struct iucv_path *, u8 ipvmid[8], u8 ipuser[16]);
49 static void iucv_callback_connrej(struct iucv_path *, u8 ipuser[16]);
51 static struct iucv_sock_list iucv_sk_list = {
52 .lock = RW_LOCK_UNLOCKED,
53 .autobind_name = ATOMIC_INIT(0)
56 static struct iucv_handler af_iucv_handler = {
57 .path_pending = iucv_callback_connreq,
58 .path_complete = iucv_callback_connack,
59 .path_severed = iucv_callback_connrej,
60 .message_pending = iucv_callback_rx,
61 .message_complete = iucv_callback_txdone
64 static inline void high_nmcpy(unsigned char *dst, char *src)
69 static inline void low_nmcpy(unsigned char *dst, char *src)
71 memcpy(&dst[8], src, 8);
75 static void iucv_sock_timeout(unsigned long arg)
77 struct sock *sk = (struct sock *)arg;
80 sk->sk_err = ETIMEDOUT;
81 sk->sk_state_change(sk);
88 static void iucv_sock_clear_timer(struct sock *sk)
90 sk_stop_timer(sk, &sk->sk_timer);
93 static void iucv_sock_init_timer(struct sock *sk)
95 init_timer(&sk->sk_timer);
96 sk->sk_timer.function = iucv_sock_timeout;
97 sk->sk_timer.data = (unsigned long)sk;
100 static struct sock *__iucv_get_sock_by_name(char *nm)
103 struct hlist_node *node;
105 sk_for_each(sk, node, &iucv_sk_list.head)
106 if (!memcmp(&iucv_sk(sk)->src_name, nm, 8))
112 static void iucv_sock_destruct(struct sock *sk)
114 skb_queue_purge(&sk->sk_receive_queue);
115 skb_queue_purge(&sk->sk_write_queue);
119 static void iucv_sock_cleanup_listen(struct sock *parent)
123 /* Close non-accepted connections */
124 while ((sk = iucv_accept_dequeue(parent, NULL))) {
129 parent->sk_state = IUCV_CLOSED;
130 sock_set_flag(parent, SOCK_ZAPPED);
134 static void iucv_sock_kill(struct sock *sk)
136 if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
139 iucv_sock_unlink(&iucv_sk_list, sk);
140 sock_set_flag(sk, SOCK_DEAD);
144 /* Close an IUCV socket */
145 static void iucv_sock_close(struct sock *sk)
147 unsigned char user_data[16];
148 struct iucv_sock *iucv = iucv_sk(sk);
151 iucv_sock_clear_timer(sk);
154 switch(sk->sk_state) {
156 iucv_sock_cleanup_listen(sk);
163 low_nmcpy(user_data, iucv->src_name);
164 high_nmcpy(user_data, iucv->dst_name);
165 ASCEBC(user_data, sizeof(user_data));
166 err = iucv_path_sever(iucv->path, user_data);
167 iucv_path_free(iucv->path);
171 sk->sk_state = IUCV_CLOSED;
172 sk->sk_state_change(sk);
173 sk->sk_err = ECONNRESET;
174 sk->sk_state_change(sk);
176 skb_queue_purge(&iucv->send_skb_q);
178 sock_set_flag(sk, SOCK_ZAPPED);
182 sock_set_flag(sk, SOCK_ZAPPED);
190 static void iucv_sock_init(struct sock *sk, struct sock *parent)
193 sk->sk_type = parent->sk_type;
196 static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio)
200 sk = sk_alloc(PF_IUCV, prio, &iucv_proto, 1);
204 sock_init_data(sock, sk);
205 INIT_LIST_HEAD(&iucv_sk(sk)->accept_q);
206 skb_queue_head_init(&iucv_sk(sk)->send_skb_q);
207 iucv_sk(sk)->send_tag = 0;
209 sk->sk_destruct = iucv_sock_destruct;
210 sk->sk_sndtimeo = IUCV_CONN_TIMEOUT;
211 sk->sk_allocation = GFP_DMA;
213 sock_reset_flag(sk, SOCK_ZAPPED);
215 sk->sk_protocol = proto;
216 sk->sk_state = IUCV_OPEN;
218 iucv_sock_init_timer(sk);
220 iucv_sock_link(&iucv_sk_list, sk);
224 /* Create an IUCV socket */
225 static int iucv_sock_create(struct socket *sock, int protocol)
229 if (sock->type != SOCK_STREAM)
230 return -ESOCKTNOSUPPORT;
232 sock->state = SS_UNCONNECTED;
233 sock->ops = &iucv_sock_ops;
235 sk = iucv_sock_alloc(sock, protocol, GFP_KERNEL);
239 iucv_sock_init(sk, NULL);
244 void iucv_sock_link(struct iucv_sock_list *l, struct sock *sk)
246 write_lock_bh(&l->lock);
247 sk_add_node(sk, &l->head);
248 write_unlock_bh(&l->lock);
251 void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *sk)
253 write_lock_bh(&l->lock);
254 sk_del_node_init(sk);
255 write_unlock_bh(&l->lock);
258 void iucv_accept_enqueue(struct sock *parent, struct sock *sk)
261 list_add_tail(&iucv_sk(sk)->accept_q, &iucv_sk(parent)->accept_q);
262 iucv_sk(sk)->parent = parent;
263 parent->sk_ack_backlog++;
266 void iucv_accept_unlink(struct sock *sk)
268 list_del_init(&iucv_sk(sk)->accept_q);
269 iucv_sk(sk)->parent->sk_ack_backlog--;
270 iucv_sk(sk)->parent = NULL;
274 struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock)
276 struct iucv_sock *isk, *n;
279 list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q){
280 sk = (struct sock *) isk;
283 if (sk->sk_state == IUCV_CLOSED) {
285 iucv_accept_unlink(sk);
289 if (sk->sk_state == IUCV_CONNECTED ||
290 sk->sk_state == IUCV_SEVERED ||
292 iucv_accept_unlink(sk);
294 sock_graft(sk, newsock);
296 if (sk->sk_state == IUCV_SEVERED)
297 sk->sk_state = IUCV_DISCONN;
308 int iucv_sock_wait_state(struct sock *sk, int state, int state2,
311 DECLARE_WAITQUEUE(wait, current);
314 add_wait_queue(sk->sk_sleep, &wait);
315 while (sk->sk_state != state && sk->sk_state != state2) {
316 set_current_state(TASK_INTERRUPTIBLE);
323 if (signal_pending(current)) {
324 err = sock_intr_errno(timeo);
329 timeo = schedule_timeout(timeo);
332 err = sock_error(sk);
336 set_current_state(TASK_RUNNING);
337 remove_wait_queue(sk->sk_sleep, &wait);
341 /* Bind an unbound socket */
342 static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
345 struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr;
346 struct sock *sk = sock->sk;
347 struct iucv_sock *iucv;
350 /* Verify the input sockaddr */
351 if (!addr || addr->sa_family != AF_IUCV)
355 if (sk->sk_state != IUCV_OPEN) {
360 write_lock_bh(&iucv_sk_list.lock);
363 if (__iucv_get_sock_by_name(sa->siucv_name)) {
372 /* Bind the socket */
373 memcpy(iucv->src_name, sa->siucv_name, 8);
375 /* Copy the user id */
376 memcpy(iucv->src_user_id, iucv_userid, 8);
377 sk->sk_state = IUCV_BOUND;
381 /* Release the socket list lock */
382 write_unlock_bh(&iucv_sk_list.lock);
388 /* Automatically bind an unbound socket */
389 static int iucv_sock_autobind(struct sock *sk)
391 struct iucv_sock *iucv = iucv_sk(sk);
392 char query_buffer[80];
396 /* Set the userid and name */
397 cpcmd("QUERY USERID", query_buffer, sizeof(query_buffer), &err);
401 memcpy(iucv->src_user_id, query_buffer, 8);
403 write_lock_bh(&iucv_sk_list.lock);
405 sprintf(name, "%08x", atomic_inc_return(&iucv_sk_list.autobind_name));
406 while (__iucv_get_sock_by_name(name)) {
407 sprintf(name, "%08x",
408 atomic_inc_return(&iucv_sk_list.autobind_name));
411 write_unlock_bh(&iucv_sk_list.lock);
413 memcpy(&iucv->src_name, name, 8);
418 /* Connect an unconnected socket */
419 static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
422 struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr;
423 struct sock *sk = sock->sk;
424 struct iucv_sock *iucv;
425 unsigned char user_data[16];
428 if (addr->sa_family != AF_IUCV || alen < sizeof(struct sockaddr_iucv))
431 if (sk->sk_state != IUCV_OPEN && sk->sk_state != IUCV_BOUND)
434 if (sk->sk_type != SOCK_STREAM)
439 if (sk->sk_state == IUCV_OPEN) {
440 err = iucv_sock_autobind(sk);
447 /* Set the destination information */
448 memcpy(iucv_sk(sk)->dst_user_id, sa->siucv_user_id, 8);
449 memcpy(iucv_sk(sk)->dst_name, sa->siucv_name, 8);
451 high_nmcpy(user_data, sa->siucv_name);
452 low_nmcpy(user_data, iucv_sk(sk)->src_name);
453 ASCEBC(user_data, sizeof(user_data));
457 iucv->path = iucv_path_alloc(IUCV_QUEUELEN_DEFAULT,
458 IPRMDATA, GFP_KERNEL);
459 err = iucv_path_connect(iucv->path, &af_iucv_handler,
460 sa->siucv_user_id, NULL, user_data, sk);
462 iucv_path_free(iucv->path);
468 if (sk->sk_state != IUCV_CONNECTED) {
469 err = iucv_sock_wait_state(sk, IUCV_CONNECTED, IUCV_DISCONN,
470 sock_sndtimeo(sk, flags & O_NONBLOCK));
473 if (sk->sk_state == IUCV_DISCONN) {
475 return -ECONNREFUSED;
482 /* Move a socket into listening state. */
483 static int iucv_sock_listen(struct socket *sock, int backlog)
485 struct sock *sk = sock->sk;
491 if (sk->sk_state != IUCV_BOUND || sock->type != SOCK_STREAM)
494 sk->sk_max_ack_backlog = backlog;
495 sk->sk_ack_backlog = 0;
496 sk->sk_state = IUCV_LISTEN;
504 /* Accept a pending connection */
505 static int iucv_sock_accept(struct socket *sock, struct socket *newsock,
508 DECLARE_WAITQUEUE(wait, current);
509 struct sock *sk = sock->sk, *nsk;
515 if (sk->sk_state != IUCV_LISTEN) {
520 timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
522 /* Wait for an incoming connection */
523 add_wait_queue_exclusive(sk->sk_sleep, &wait);
524 while (!(nsk = iucv_accept_dequeue(sk, newsock))){
525 set_current_state(TASK_INTERRUPTIBLE);
532 timeo = schedule_timeout(timeo);
535 if (sk->sk_state != IUCV_LISTEN) {
540 if (signal_pending(current)) {
541 err = sock_intr_errno(timeo);
546 set_current_state(TASK_RUNNING);
547 remove_wait_queue(sk->sk_sleep, &wait);
552 newsock->state = SS_CONNECTED;
559 static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr,
562 struct sockaddr_iucv *siucv = (struct sockaddr_iucv *) addr;
563 struct sock *sk = sock->sk;
565 addr->sa_family = AF_IUCV;
566 *len = sizeof(struct sockaddr_iucv);
569 memcpy(siucv->siucv_user_id, iucv_sk(sk)->dst_user_id, 8);
570 memcpy(siucv->siucv_name, &iucv_sk(sk)->dst_name, 8);
572 memcpy(siucv->siucv_user_id, iucv_sk(sk)->src_user_id, 8);
573 memcpy(siucv->siucv_name, iucv_sk(sk)->src_name, 8);
575 memset(&siucv->siucv_port, 0, sizeof(siucv->siucv_port));
576 memset(&siucv->siucv_addr, 0, sizeof(siucv->siucv_addr));
577 memset(siucv->siucv_nodeid, 0, sizeof(siucv->siucv_nodeid));
582 static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
583 struct msghdr *msg, size_t len)
585 struct sock *sk = sock->sk;
586 struct iucv_sock *iucv = iucv_sk(sk);
588 struct iucv_message txmsg;
591 err = sock_error(sk);
595 if (msg->msg_flags & MSG_OOB)
600 if (sk->sk_shutdown & SEND_SHUTDOWN) {
605 if (sk->sk_state == IUCV_CONNECTED){
606 if(!(skb = sock_alloc_send_skb(sk, len,
607 msg->msg_flags & MSG_DONTWAIT,
611 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)){
617 txmsg.tag = iucv->send_tag++;
618 memcpy(skb->cb, &txmsg.tag, 4);
619 skb_queue_tail(&iucv->send_skb_q, skb);
620 err = iucv_message_send(iucv->path, &txmsg, 0, 0,
621 (void *) skb->data, skb->len);
624 printk(KERN_ERR "AF_IUCV msg limit exceeded\n");
625 skb_unlink(skb, &iucv->send_skb_q);
645 static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
646 struct msghdr *msg, size_t len, int flags)
648 int noblock = flags & MSG_DONTWAIT;
649 struct sock *sk = sock->sk;
650 int target, copied = 0;
654 if (flags & (MSG_OOB))
657 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
659 skb = skb_recv_datagram(sk, flags, noblock, &err);
661 if (sk->sk_shutdown & RCV_SHUTDOWN)
666 copied = min_t(unsigned int, skb->len, len);
668 if (memcpy_toiovec(msg->msg_iov, skb->data, copied)) {
669 skb_queue_head(&sk->sk_receive_queue, skb);
676 /* Mark read part of skb as used */
677 if (!(flags & MSG_PEEK)) {
678 skb_pull(skb, copied);
681 skb_queue_head(&sk->sk_receive_queue, skb);
687 skb_queue_head(&sk->sk_receive_queue, skb);
690 return err ? : copied;
693 static inline unsigned int iucv_accept_poll(struct sock *parent)
695 struct iucv_sock *isk, *n;
698 list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q){
699 sk = (struct sock *) isk;
701 if (sk->sk_state == IUCV_CONNECTED)
702 return POLLIN | POLLRDNORM;
708 unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
711 struct sock *sk = sock->sk;
712 unsigned int mask = 0;
714 poll_wait(file, sk->sk_sleep, wait);
716 if (sk->sk_state == IUCV_LISTEN)
717 return iucv_accept_poll(sk);
719 if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
722 if (sk->sk_shutdown & RCV_SHUTDOWN)
725 if (sk->sk_shutdown == SHUTDOWN_MASK)
728 if (!skb_queue_empty(&sk->sk_receive_queue) ||
729 (sk->sk_shutdown & RCV_SHUTDOWN))
730 mask |= POLLIN | POLLRDNORM;
732 if (sk->sk_state == IUCV_CLOSED)
735 if (sock_writeable(sk))
736 mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
738 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
743 static int iucv_sock_shutdown(struct socket *sock, int how)
745 struct sock *sk = sock->sk;
746 struct iucv_sock *iucv = iucv_sk(sk);
747 struct iucv_message txmsg;
749 u8 prmmsg[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
753 if ((how & ~SHUTDOWN_MASK) || !how)
757 switch(sk->sk_state) {
763 sk->sk_shutdown |= how;
767 if (how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) {
770 err = iucv_message_send(iucv->path, &txmsg, IUCV_IPRMDATA, 0,
787 if (how == RCV_SHUTDOWN || how == SHUTDOWN_MASK) {
788 err = iucv_path_quiesce(iucv_sk(sk)->path, NULL);
792 skb_queue_purge(&sk->sk_receive_queue);
795 /* Wake up anyone sleeping in poll */
796 sk->sk_state_change(sk);
803 static int iucv_sock_release(struct socket *sock)
805 struct sock *sk = sock->sk;
813 /* Unregister with IUCV base support */
814 if (iucv_sk(sk)->path) {
815 iucv_path_sever(iucv_sk(sk)->path, NULL);
816 iucv_path_free(iucv_sk(sk)->path);
817 iucv_sk(sk)->path = NULL;
820 if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime){
822 err = iucv_sock_wait_state(sk, IUCV_CLOSED, 0,
832 /* Callback wrappers - called from iucv base support */
833 static int iucv_callback_connreq(struct iucv_path *path,
834 u8 ipvmid[8], u8 ipuser[16])
836 unsigned char user_data[16];
837 unsigned char nuser_data[16];
838 unsigned char src_name[8];
839 struct hlist_node *node;
840 struct sock *sk, *nsk;
841 struct iucv_sock *iucv, *niucv;
844 memcpy(src_name, ipuser, 8);
846 /* Find out if this path belongs to af_iucv. */
847 read_lock(&iucv_sk_list.lock);
849 sk_for_each(sk, node, &iucv_sk_list.head)
850 if (sk->sk_state == IUCV_LISTEN &&
851 !memcmp(&iucv_sk(sk)->src_name, src_name, 8)) {
853 * Found a listening socket with
854 * src_name == ipuser[0-7].
859 read_unlock(&iucv_sk_list.lock);
861 /* No socket found, not one of our paths. */
866 /* Check if parent socket is listening */
867 low_nmcpy(user_data, iucv->src_name);
868 high_nmcpy(user_data, iucv->dst_name);
869 ASCEBC(user_data, sizeof(user_data));
870 if (sk->sk_state != IUCV_LISTEN) {
871 err = iucv_path_sever(path, user_data);
875 /* Check for backlog size */
876 if (sk_acceptq_is_full(sk)) {
877 err = iucv_path_sever(path, user_data);
881 /* Create the new socket */
882 nsk = iucv_sock_alloc(NULL, SOCK_STREAM, GFP_ATOMIC);
884 err = iucv_path_sever(path, user_data);
888 niucv = iucv_sk(nsk);
889 iucv_sock_init(nsk, sk);
891 /* Set the new iucv_sock */
892 memcpy(niucv->dst_name, ipuser + 8, 8);
893 EBCASC(niucv->dst_name, 8);
894 memcpy(niucv->dst_user_id, ipvmid, 8);
895 memcpy(niucv->src_name, iucv->src_name, 8);
896 memcpy(niucv->src_user_id, iucv->src_user_id, 8);
899 /* Call iucv_accept */
900 high_nmcpy(nuser_data, ipuser + 8);
901 memcpy(nuser_data + 8, niucv->src_name, 8);
902 ASCEBC(nuser_data + 8, 8);
904 path->msglim = IUCV_QUEUELEN_DEFAULT;
905 err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk);
907 err = iucv_path_sever(path, user_data);
911 iucv_accept_enqueue(sk, nsk);
914 nsk->sk_state = IUCV_CONNECTED;
915 sk->sk_data_ready(sk, 1);
922 static void iucv_callback_connack(struct iucv_path *path, u8 ipuser[16])
924 struct sock *sk = path->private;
926 sk->sk_state = IUCV_CONNECTED;
927 sk->sk_state_change(sk);
930 static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
932 struct sock *sk = path->private;
936 if (sk->sk_shutdown & RCV_SHUTDOWN)
939 skb = alloc_skb(msg->length, GFP_ATOMIC | GFP_DMA);
941 iucv_message_reject(path, msg);
945 if (msg->flags & IPRMDATA) {
949 rc = iucv_message_receive(path, msg, 0, skb->data,
956 skb_reset_transport_header(skb);
957 skb_reset_network_header(skb);
958 skb->len = msg->length;
961 if (sock_queue_rcv_skb(sk, skb))
965 static void iucv_callback_txdone(struct iucv_path *path,
966 struct iucv_message *msg)
968 struct sock *sk = path->private;
969 struct sk_buff *this;
970 struct sk_buff_head *list = &iucv_sk(sk)->send_skb_q;
971 struct sk_buff *list_skb = list->next;
974 spin_lock_irqsave(&list->lock, flags);
978 list_skb = list_skb->next;
979 } while (memcmp(&msg->tag, this->cb, 4));
981 spin_unlock_irqrestore(&list->lock, flags);
983 skb_unlink(this, &iucv_sk(sk)->send_skb_q);
987 static void iucv_callback_connrej(struct iucv_path *path, u8 ipuser[16])
989 struct sock *sk = path->private;
991 if (!list_empty(&iucv_sk(sk)->accept_q))
992 sk->sk_state = IUCV_SEVERED;
994 sk->sk_state = IUCV_DISCONN;
996 sk->sk_state_change(sk);
999 static struct proto_ops iucv_sock_ops = {
1001 .owner = THIS_MODULE,
1002 .release = iucv_sock_release,
1003 .bind = iucv_sock_bind,
1004 .connect = iucv_sock_connect,
1005 .listen = iucv_sock_listen,
1006 .accept = iucv_sock_accept,
1007 .getname = iucv_sock_getname,
1008 .sendmsg = iucv_sock_sendmsg,
1009 .recvmsg = iucv_sock_recvmsg,
1010 .poll = iucv_sock_poll,
1011 .ioctl = sock_no_ioctl,
1012 .mmap = sock_no_mmap,
1013 .socketpair = sock_no_socketpair,
1014 .shutdown = iucv_sock_shutdown,
1015 .setsockopt = sock_no_setsockopt,
1016 .getsockopt = sock_no_getsockopt
1019 static struct net_proto_family iucv_sock_family_ops = {
1021 .owner = THIS_MODULE,
1022 .create = iucv_sock_create,
1025 static int afiucv_init(void)
1029 if (!MACHINE_IS_VM) {
1030 printk(KERN_ERR "AF_IUCV connection needs VM as base\n");
1031 err = -EPROTONOSUPPORT;
1034 cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err);
1035 if (unlikely(err)) {
1036 printk(KERN_ERR "AF_IUCV needs the VM userid\n");
1037 err = -EPROTONOSUPPORT;
1041 err = iucv_register(&af_iucv_handler, 0);
1044 err = proto_register(&iucv_proto, 0);
1047 err = sock_register(&iucv_sock_family_ops);
1050 printk(KERN_INFO "AF_IUCV lowlevel driver initialized\n");
1054 proto_unregister(&iucv_proto);
1056 iucv_unregister(&af_iucv_handler, 0);
1061 static void __exit afiucv_exit(void)
1063 sock_unregister(PF_IUCV);
1064 proto_unregister(&iucv_proto);
1065 iucv_unregister(&af_iucv_handler, 0);
1067 printk(KERN_INFO "AF_IUCV lowlevel driver unloaded\n");
1070 module_init(afiucv_init);
1071 module_exit(afiucv_exit);
1073 MODULE_AUTHOR("Jennifer Hunt <jenhunt@us.ibm.com>");
1074 MODULE_DESCRIPTION("IUCV Sockets ver " VERSION);
1075 MODULE_VERSION(VERSION);
1076 MODULE_LICENSE("GPL");
1077 MODULE_ALIAS_NETPROTO(PF_IUCV);