aboutsummaryrefslogtreecommitdiffstats
path: root/net/iucv/af_iucv.c
diff options
context:
space:
mode:
authorUrsula Braun <ursula.braun@de.ibm.com>2011-08-07 21:33:52 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-13 04:10:16 -0400
commit493d3971a65c921fad5c3369c7582214c91c965a (patch)
tree92e11e5fcdaf79772f39f8aac5efb2649671da1e /net/iucv/af_iucv.c
parent6fcd61f7bf5d56a83cbf26c14915138d1a64ca4e (diff)
af_iucv: cleanup - use iucv_sk(sk) early
Code cleanup making make use of local variable for struct iucv_sock. Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/iucv/af_iucv.c')
-rw-r--r--net/iucv/af_iucv.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 2270e25a0298..1d8cb72da3a4 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -446,23 +446,25 @@ static void iucv_sock_init(struct sock *sk, struct sock *parent)
446static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio) 446static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio)
447{ 447{
448 struct sock *sk; 448 struct sock *sk;
449 struct iucv_sock *iucv;
449 450
450 sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto); 451 sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto);
451 if (!sk) 452 if (!sk)
452 return NULL; 453 return NULL;
454 iucv = iucv_sk(sk);
453 455
454 sock_init_data(sock, sk); 456 sock_init_data(sock, sk);
455 INIT_LIST_HEAD(&iucv_sk(sk)->accept_q); 457 INIT_LIST_HEAD(&iucv->accept_q);
456 spin_lock_init(&iucv_sk(sk)->accept_q_lock); 458 spin_lock_init(&iucv->accept_q_lock);
457 skb_queue_head_init(&iucv_sk(sk)->send_skb_q); 459 skb_queue_head_init(&iucv->send_skb_q);
458 INIT_LIST_HEAD(&iucv_sk(sk)->message_q.list); 460 INIT_LIST_HEAD(&iucv->message_q.list);
459 spin_lock_init(&iucv_sk(sk)->message_q.lock); 461 spin_lock_init(&iucv->message_q.lock);
460 skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q); 462 skb_queue_head_init(&iucv->backlog_skb_q);
461 iucv_sk(sk)->send_tag = 0; 463 iucv->send_tag = 0;
462 iucv_sk(sk)->flags = 0; 464 iucv->flags = 0;
463 iucv_sk(sk)->msglimit = IUCV_QUEUELEN_DEFAULT; 465 iucv->msglimit = IUCV_QUEUELEN_DEFAULT;
464 iucv_sk(sk)->path = NULL; 466 iucv->path = NULL;
465 memset(&iucv_sk(sk)->src_user_id , 0, 32); 467 memset(&iucv->src_user_id , 0, 32);
466 468
467 sk->sk_destruct = iucv_sock_destruct; 469 sk->sk_destruct = iucv_sock_destruct;
468 sk->sk_sndtimeo = IUCV_CONN_TIMEOUT; 470 sk->sk_sndtimeo = IUCV_CONN_TIMEOUT;
@@ -669,7 +671,7 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
669{ 671{
670 struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr; 672 struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr;
671 struct sock *sk = sock->sk; 673 struct sock *sk = sock->sk;
672 struct iucv_sock *iucv; 674 struct iucv_sock *iucv = iucv_sk(sk);
673 unsigned char user_data[16]; 675 unsigned char user_data[16];
674 int err; 676 int err;
675 677
@@ -691,14 +693,13 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
691 lock_sock(sk); 693 lock_sock(sk);
692 694
693 /* Set the destination information */ 695 /* Set the destination information */
694 memcpy(iucv_sk(sk)->dst_user_id, sa->siucv_user_id, 8); 696 memcpy(iucv->dst_user_id, sa->siucv_user_id, 8);
695 memcpy(iucv_sk(sk)->dst_name, sa->siucv_name, 8); 697 memcpy(iucv->dst_name, sa->siucv_name, 8);
696 698
697 high_nmcpy(user_data, sa->siucv_name); 699 high_nmcpy(user_data, sa->siucv_name);
698 low_nmcpy(user_data, iucv_sk(sk)->src_name); 700 low_nmcpy(user_data, iucv->src_name);
699 ASCEBC(user_data, sizeof(user_data)); 701 ASCEBC(user_data, sizeof(user_data));
700 702
701 iucv = iucv_sk(sk);
702 /* Create path. */ 703 /* Create path. */
703 iucv->path = iucv_path_alloc(iucv->msglimit, 704 iucv->path = iucv_path_alloc(iucv->msglimit,
704 IUCV_IPRMDATA, GFP_KERNEL); 705 IUCV_IPRMDATA, GFP_KERNEL);
@@ -836,20 +837,21 @@ static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr,
836{ 837{
837 struct sockaddr_iucv *siucv = (struct sockaddr_iucv *) addr; 838 struct sockaddr_iucv *siucv = (struct sockaddr_iucv *) addr;
838 struct sock *sk = sock->sk; 839 struct sock *sk = sock->sk;
840 struct iucv_sock *iucv = iucv_sk(sk);
839 841
840 addr->sa_family = AF_IUCV; 842 addr->sa_family = AF_IUCV;
841 *len = sizeof(struct sockaddr_iucv); 843 *len = sizeof(struct sockaddr_iucv);
842 844
843 if (peer) { 845 if (peer) {
844 memcpy(siucv->siucv_user_id, iucv_sk(sk)->dst_user_id, 8); 846 memcpy(siucv->siucv_user_id, iucv->dst_user_id, 8);
845 memcpy(siucv->siucv_name, &iucv_sk(sk)->dst_name, 8); 847 memcpy(siucv->siucv_name, iucv->dst_name, 8);
846 } else { 848 } else {
847 memcpy(siucv->siucv_user_id, iucv_sk(sk)->src_user_id, 8); 849 memcpy(siucv->siucv_user_id, iucv->src_user_id, 8);
848 memcpy(siucv->siucv_name, iucv_sk(sk)->src_name, 8); 850 memcpy(siucv->siucv_name, iucv->src_name, 8);
849 } 851 }
850 memset(&siucv->siucv_port, 0, sizeof(siucv->siucv_port)); 852 memset(&siucv->siucv_port, 0, sizeof(siucv->siucv_port));
851 memset(&siucv->siucv_addr, 0, sizeof(siucv->siucv_addr)); 853 memset(&siucv->siucv_addr, 0, sizeof(siucv->siucv_addr));
852 memset(siucv->siucv_nodeid, 0, sizeof(siucv->siucv_nodeid)); 854 memset(&siucv->siucv_nodeid, 0, sizeof(siucv->siucv_nodeid));
853 855
854 return 0; 856 return 0;
855} 857}