diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-15 21:39:31 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 15:53:35 -0400 |
commit | 01e97e6517053d7c0b9af5248e944a9209909cf5 (patch) | |
tree | 30f57eededa62a390543b3a596d81006deb22384 /net/rxrpc | |
parent | a2dd3793a1c3ac709f1d7b48ad7751563f4c654f (diff) |
new helper: msg_data_left()
convert open-coded instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/ar-output.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c index 7a31a3958364..c0042807bfc6 100644 --- a/net/rxrpc/ar-output.c +++ b/net/rxrpc/ar-output.c | |||
@@ -564,8 +564,8 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
564 | max &= ~(call->conn->size_align - 1UL); | 564 | max &= ~(call->conn->size_align - 1UL); |
565 | 565 | ||
566 | chunk = max; | 566 | chunk = max; |
567 | if (chunk > iov_iter_count(&msg->msg_iter) && !more) | 567 | if (chunk > msg_data_left(msg) && !more) |
568 | chunk = iov_iter_count(&msg->msg_iter); | 568 | chunk = msg_data_left(msg); |
569 | 569 | ||
570 | space = chunk + call->conn->size_align; | 570 | space = chunk + call->conn->size_align; |
571 | space &= ~(call->conn->size_align - 1UL); | 571 | space &= ~(call->conn->size_align - 1UL); |
@@ -608,11 +608,11 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
608 | sp = rxrpc_skb(skb); | 608 | sp = rxrpc_skb(skb); |
609 | 609 | ||
610 | /* append next segment of data to the current buffer */ | 610 | /* append next segment of data to the current buffer */ |
611 | if (iov_iter_count(&msg->msg_iter) > 0) { | 611 | if (msg_data_left(msg) > 0) { |
612 | int copy = skb_tailroom(skb); | 612 | int copy = skb_tailroom(skb); |
613 | ASSERTCMP(copy, >, 0); | 613 | ASSERTCMP(copy, >, 0); |
614 | if (copy > iov_iter_count(&msg->msg_iter)) | 614 | if (copy > msg_data_left(msg)) |
615 | copy = iov_iter_count(&msg->msg_iter); | 615 | copy = msg_data_left(msg); |
616 | if (copy > sp->remain) | 616 | if (copy > sp->remain) |
617 | copy = sp->remain; | 617 | copy = sp->remain; |
618 | 618 | ||
@@ -633,7 +633,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
633 | 633 | ||
634 | /* add the packet to the send queue if it's now full */ | 634 | /* add the packet to the send queue if it's now full */ |
635 | if (sp->remain <= 0 || | 635 | if (sp->remain <= 0 || |
636 | (iov_iter_count(&msg->msg_iter) == 0 && !more)) { | 636 | (msg_data_left(msg) == 0 && !more)) { |
637 | struct rxrpc_connection *conn = call->conn; | 637 | struct rxrpc_connection *conn = call->conn; |
638 | uint32_t seq; | 638 | uint32_t seq; |
639 | size_t pad; | 639 | size_t pad; |
@@ -663,7 +663,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
663 | sp->hdr.serviceId = conn->service_id; | 663 | sp->hdr.serviceId = conn->service_id; |
664 | 664 | ||
665 | sp->hdr.flags = conn->out_clientflag; | 665 | sp->hdr.flags = conn->out_clientflag; |
666 | if (iov_iter_count(&msg->msg_iter) == 0 && !more) | 666 | if (msg_data_left(msg) == 0 && !more) |
667 | sp->hdr.flags |= RXRPC_LAST_PACKET; | 667 | sp->hdr.flags |= RXRPC_LAST_PACKET; |
668 | else if (CIRC_SPACE(call->acks_head, call->acks_tail, | 668 | else if (CIRC_SPACE(call->acks_head, call->acks_tail, |
669 | call->acks_winsz) > 1) | 669 | call->acks_winsz) > 1) |
@@ -679,11 +679,10 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
679 | 679 | ||
680 | memcpy(skb->head, &sp->hdr, | 680 | memcpy(skb->head, &sp->hdr, |
681 | sizeof(struct rxrpc_header)); | 681 | sizeof(struct rxrpc_header)); |
682 | rxrpc_queue_packet(call, skb, | 682 | rxrpc_queue_packet(call, skb, !msg_data_left(msg) && !more); |
683 | iov_iter_count(&msg->msg_iter) == 0 && !more); | ||
684 | skb = NULL; | 683 | skb = NULL; |
685 | } | 684 | } |
686 | } while (iov_iter_count(&msg->msg_iter) > 0); | 685 | } while (msg_data_left(msg) > 0); |
687 | 686 | ||
688 | success: | 687 | success: |
689 | ret = copied; | 688 | ret = copied; |