diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-15 01:16:27 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-24 05:16:41 -0500 |
commit | 45dcc687f764f89e1e7c41dace52b105494e5dbb (patch) | |
tree | 569dd194d3e7107c930da7762330b32f6efdd013 /net | |
parent | 562640f3c3fb64fca24253868dab6e900e305c46 (diff) |
tipc_msg_build(): pass msghdr instead of its ->msg_iov
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/tipc/msg.c | 8 | ||||
-rw-r--r-- | net/tipc/msg.h | 2 | ||||
-rw-r--r-- | net/tipc/socket.c | 7 |
3 files changed, 8 insertions, 9 deletions
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index ec18076e81ec..9155496b8a8a 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c | |||
@@ -162,14 +162,14 @@ err: | |||
162 | /** | 162 | /** |
163 | * tipc_msg_build - create buffer chain containing specified header and data | 163 | * tipc_msg_build - create buffer chain containing specified header and data |
164 | * @mhdr: Message header, to be prepended to data | 164 | * @mhdr: Message header, to be prepended to data |
165 | * @iov: User data | 165 | * @m: User message |
166 | * @offset: Posision in iov to start copying from | 166 | * @offset: Posision in iov to start copying from |
167 | * @dsz: Total length of user data | 167 | * @dsz: Total length of user data |
168 | * @pktmax: Max packet size that can be used | 168 | * @pktmax: Max packet size that can be used |
169 | * @chain: Buffer or chain of buffers to be returned to caller | 169 | * @chain: Buffer or chain of buffers to be returned to caller |
170 | * Returns message data size or errno: -ENOMEM, -EFAULT | 170 | * Returns message data size or errno: -ENOMEM, -EFAULT |
171 | */ | 171 | */ |
172 | int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov, | 172 | int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, |
173 | int offset, int dsz, int pktmax , struct sk_buff **chain) | 173 | int offset, int dsz, int pktmax , struct sk_buff **chain) |
174 | { | 174 | { |
175 | int mhsz = msg_hdr_sz(mhdr); | 175 | int mhsz = msg_hdr_sz(mhdr); |
@@ -194,7 +194,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov, | |||
194 | skb_copy_to_linear_data(buf, mhdr, mhsz); | 194 | skb_copy_to_linear_data(buf, mhdr, mhsz); |
195 | pktpos = buf->data + mhsz; | 195 | pktpos = buf->data + mhsz; |
196 | TIPC_SKB_CB(buf)->chain_sz = 1; | 196 | TIPC_SKB_CB(buf)->chain_sz = 1; |
197 | if (!dsz || !memcpy_fromiovecend(pktpos, iov, offset, dsz)) | 197 | if (!dsz || !memcpy_fromiovecend(pktpos, m->msg_iov, offset, dsz)) |
198 | return dsz; | 198 | return dsz; |
199 | rc = -EFAULT; | 199 | rc = -EFAULT; |
200 | goto error; | 200 | goto error; |
@@ -223,7 +223,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov, | |||
223 | if (drem < pktrem) | 223 | if (drem < pktrem) |
224 | pktrem = drem; | 224 | pktrem = drem; |
225 | 225 | ||
226 | if (memcpy_fromiovecend(pktpos, iov, offset, pktrem)) { | 226 | if (memcpy_fromiovecend(pktpos, m->msg_iov, offset, pktrem)) { |
227 | rc = -EFAULT; | 227 | rc = -EFAULT; |
228 | goto error; | 228 | goto error; |
229 | } | 229 | } |
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 0ea7b695ac4d..d7d2ba2afe6c 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -743,7 +743,7 @@ bool tipc_msg_bundle(struct sk_buff *bbuf, struct sk_buff *buf, u32 mtu); | |||
743 | 743 | ||
744 | bool tipc_msg_make_bundle(struct sk_buff **buf, u32 mtu, u32 dnode); | 744 | bool tipc_msg_make_bundle(struct sk_buff **buf, u32 mtu, u32 dnode); |
745 | 745 | ||
746 | int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov, | 746 | int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, |
747 | int offset, int dsz, int mtu , struct sk_buff **chain); | 747 | int offset, int dsz, int mtu , struct sk_buff **chain); |
748 | 748 | ||
749 | struct sk_buff *tipc_msg_reassemble(struct sk_buff *chain); | 749 | struct sk_buff *tipc_msg_reassemble(struct sk_buff *chain); |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 2d4b2fa7d628..b3415a78da2e 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -727,7 +727,7 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq, | |||
727 | 727 | ||
728 | new_mtu: | 728 | new_mtu: |
729 | mtu = tipc_bclink_get_mtu(); | 729 | mtu = tipc_bclink_get_mtu(); |
730 | rc = tipc_msg_build(mhdr, msg->msg_iov, 0, dsz, mtu, &buf); | 730 | rc = tipc_msg_build(mhdr, msg, 0, dsz, mtu, &buf); |
731 | if (unlikely(rc < 0)) | 731 | if (unlikely(rc < 0)) |
732 | return rc; | 732 | return rc; |
733 | 733 | ||
@@ -905,7 +905,6 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
905 | struct sock *sk = sock->sk; | 905 | struct sock *sk = sock->sk; |
906 | struct tipc_sock *tsk = tipc_sk(sk); | 906 | struct tipc_sock *tsk = tipc_sk(sk); |
907 | struct tipc_msg *mhdr = &tsk->phdr; | 907 | struct tipc_msg *mhdr = &tsk->phdr; |
908 | struct iovec *iov = m->msg_iov; | ||
909 | u32 dnode, dport; | 908 | u32 dnode, dport; |
910 | struct sk_buff *buf; | 909 | struct sk_buff *buf; |
911 | struct tipc_name_seq *seq = &dest->addr.nameseq; | 910 | struct tipc_name_seq *seq = &dest->addr.nameseq; |
@@ -982,7 +981,7 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
982 | 981 | ||
983 | new_mtu: | 982 | new_mtu: |
984 | mtu = tipc_node_get_mtu(dnode, tsk->ref); | 983 | mtu = tipc_node_get_mtu(dnode, tsk->ref); |
985 | rc = tipc_msg_build(mhdr, iov, 0, dsz, mtu, &buf); | 984 | rc = tipc_msg_build(mhdr, m, 0, dsz, mtu, &buf); |
986 | if (rc < 0) | 985 | if (rc < 0) |
987 | goto exit; | 986 | goto exit; |
988 | 987 | ||
@@ -1094,7 +1093,7 @@ static int tipc_send_stream(struct kiocb *iocb, struct socket *sock, | |||
1094 | next: | 1093 | next: |
1095 | mtu = tsk->max_pkt; | 1094 | mtu = tsk->max_pkt; |
1096 | send = min_t(uint, dsz - sent, TIPC_MAX_USER_MSG_SIZE); | 1095 | send = min_t(uint, dsz - sent, TIPC_MAX_USER_MSG_SIZE); |
1097 | rc = tipc_msg_build(mhdr, m->msg_iov, sent, send, mtu, &buf); | 1096 | rc = tipc_msg_build(mhdr, m, sent, send, mtu, &buf); |
1098 | if (unlikely(rc < 0)) | 1097 | if (unlikely(rc < 0)) |
1099 | goto exit; | 1098 | goto exit; |
1100 | do { | 1099 | do { |