diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2014-03-12 11:31:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-12 15:53:49 -0400 |
commit | f9fef18c6d688697e72d1020a7c43a50c1331a58 (patch) | |
tree | c256dcf97aae43ab23c2a28cbf763e421f0dec64 /net/tipc/socket.c | |
parent | 978813ee89674fdb6bb6585153166b7603173cd2 (diff) |
tipc: remove redundant 'peer_name' field in struct tipc_sock
The field 'peer_name' in struct tipc_sock is redundant, since
this information already is available from tipc_port, to which
tipc_sock has a reference.
We remove the field, and ensure that peer node and peer port
info instead is fetched via the functions that already exist
for this purpose.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 336e18d6cf46..62655772adda 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -48,7 +48,6 @@ | |||
48 | struct tipc_sock { | 48 | struct tipc_sock { |
49 | struct sock sk; | 49 | struct sock sk; |
50 | struct tipc_port *p; | 50 | struct tipc_port *p; |
51 | struct tipc_portid peer_name; | ||
52 | unsigned int conn_timeout; | 51 | unsigned int conn_timeout; |
53 | }; | 52 | }; |
54 | 53 | ||
@@ -445,8 +444,9 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr, | |||
445 | if ((sock->state != SS_CONNECTED) && | 444 | if ((sock->state != SS_CONNECTED) && |
446 | ((peer != 2) || (sock->state != SS_DISCONNECTING))) | 445 | ((peer != 2) || (sock->state != SS_DISCONNECTING))) |
447 | return -ENOTCONN; | 446 | return -ENOTCONN; |
448 | addr->addr.id.ref = tsock->peer_name.ref; | 447 | |
449 | addr->addr.id.node = tsock->peer_name.node; | 448 | addr->addr.id.ref = tipc_port_peerport(tsock->p); |
449 | addr->addr.id.node = tipc_port_peernode(tsock->p); | ||
450 | } else { | 450 | } else { |
451 | addr->addr.id.ref = tsock->p->ref; | 451 | addr->addr.id.ref = tsock->p->ref; |
452 | addr->addr.id.node = tipc_own_addr; | 452 | addr->addr.id.node = tipc_own_addr; |
@@ -881,14 +881,16 @@ static int auto_connect(struct socket *sock, struct tipc_msg *msg) | |||
881 | { | 881 | { |
882 | struct tipc_sock *tsock = tipc_sk(sock->sk); | 882 | struct tipc_sock *tsock = tipc_sk(sock->sk); |
883 | struct tipc_port *p_ptr; | 883 | struct tipc_port *p_ptr; |
884 | struct tipc_portid peer; | ||
885 | |||
886 | peer.ref = msg_origport(msg); | ||
887 | peer.node = msg_orignode(msg); | ||
884 | 888 | ||
885 | tsock->peer_name.ref = msg_origport(msg); | ||
886 | tsock->peer_name.node = msg_orignode(msg); | ||
887 | p_ptr = tipc_port_deref(tsock->p->ref); | 889 | p_ptr = tipc_port_deref(tsock->p->ref); |
888 | if (!p_ptr) | 890 | if (!p_ptr) |
889 | return -EINVAL; | 891 | return -EINVAL; |
890 | 892 | ||
891 | __tipc_port_connect(tsock->p->ref, p_ptr, &tsock->peer_name); | 893 | __tipc_port_connect(p_ptr->ref, p_ptr, &peer); |
892 | 894 | ||
893 | if (msg_importance(msg) > TIPC_CRITICAL_IMPORTANCE) | 895 | if (msg_importance(msg) > TIPC_CRITICAL_IMPORTANCE) |
894 | return -EINVAL; | 896 | return -EINVAL; |
@@ -1662,6 +1664,7 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags) | |||
1662 | struct tipc_sock *new_tsock; | 1664 | struct tipc_sock *new_tsock; |
1663 | struct tipc_port *new_tport; | 1665 | struct tipc_port *new_tport; |
1664 | struct tipc_msg *msg; | 1666 | struct tipc_msg *msg; |
1667 | struct tipc_portid peer; | ||
1665 | u32 new_ref; | 1668 | u32 new_ref; |
1666 | long timeo; | 1669 | long timeo; |
1667 | int res; | 1670 | int res; |
@@ -1700,9 +1703,9 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags) | |||
1700 | reject_rx_queue(new_sk); | 1703 | reject_rx_queue(new_sk); |
1701 | 1704 | ||
1702 | /* Connect new socket to it's peer */ | 1705 | /* Connect new socket to it's peer */ |
1703 | new_tsock->peer_name.ref = msg_origport(msg); | 1706 | peer.ref = msg_origport(msg); |
1704 | new_tsock->peer_name.node = msg_orignode(msg); | 1707 | peer.node = msg_orignode(msg); |
1705 | tipc_port_connect(new_ref, &new_tsock->peer_name); | 1708 | tipc_port_connect(new_ref, &peer); |
1706 | new_sock->state = SS_CONNECTED; | 1709 | new_sock->state = SS_CONNECTED; |
1707 | 1710 | ||
1708 | tipc_set_portimportance(new_ref, msg_importance(msg)); | 1711 | tipc_set_portimportance(new_ref, msg_importance(msg)); |