diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-21 17:05:37 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-28 17:20:43 -0400 |
commit | c337d3655ce85e12c7c476cb81406521926cacd2 (patch) | |
tree | 2d0f0caa7b4f2b3d366ac7a37fc4d2f82b7706c7 /net/sunrpc | |
parent | bfeea1dc1c9238f9e5a17a265489ecd0d19f66bb (diff) |
SUNRPC: xdr_read_pages should return the amount of XDR encoded page data
Callers of xdr_read_pages() will want to know exactly how much XDR
data is encoded in the pages after the data realignment.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xdr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 5643feb6c645..80d518644cf8 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c | |||
@@ -745,8 +745,10 @@ EXPORT_SYMBOL_GPL(xdr_inline_decode); | |||
745 | * Moves data beyond the current pointer position from the XDR head[] buffer | 745 | * Moves data beyond the current pointer position from the XDR head[] buffer |
746 | * into the page list. Any data that lies beyond current position + "len" | 746 | * into the page list. Any data that lies beyond current position + "len" |
747 | * bytes is moved into the XDR tail[]. | 747 | * bytes is moved into the XDR tail[]. |
748 | * | ||
749 | * Returns the number of XDR encoded bytes now contained in the pages | ||
748 | */ | 750 | */ |
749 | void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) | 751 | unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len) |
750 | { | 752 | { |
751 | struct xdr_buf *buf = xdr->buf; | 753 | struct xdr_buf *buf = xdr->buf; |
752 | struct kvec *iov; | 754 | struct kvec *iov; |
@@ -756,7 +758,7 @@ void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) | |||
756 | int padding; | 758 | int padding; |
757 | 759 | ||
758 | if (xdr->nwords == 0) | 760 | if (xdr->nwords == 0) |
759 | return; | 761 | return 0; |
760 | if (nwords > xdr->nwords) { | 762 | if (nwords > xdr->nwords) { |
761 | nwords = xdr->nwords; | 763 | nwords = xdr->nwords; |
762 | len = nwords << 2; | 764 | len = nwords << 2; |
@@ -787,6 +789,7 @@ void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) | |||
787 | xdr->end = (__be32 *)((char *)iov->iov_base + end); | 789 | xdr->end = (__be32 *)((char *)iov->iov_base + end); |
788 | xdr->page_ptr = NULL; | 790 | xdr->page_ptr = NULL; |
789 | xdr->nwords = XDR_QUADLEN(end - padding); | 791 | xdr->nwords = XDR_QUADLEN(end - padding); |
792 | return len; | ||
790 | } | 793 | } |
791 | EXPORT_SYMBOL_GPL(xdr_read_pages); | 794 | EXPORT_SYMBOL_GPL(xdr_read_pages); |
792 | 795 | ||
@@ -802,7 +805,7 @@ EXPORT_SYMBOL_GPL(xdr_read_pages); | |||
802 | */ | 805 | */ |
803 | void xdr_enter_page(struct xdr_stream *xdr, unsigned int len) | 806 | void xdr_enter_page(struct xdr_stream *xdr, unsigned int len) |
804 | { | 807 | { |
805 | xdr_read_pages(xdr, len); | 808 | len = xdr_read_pages(xdr, len); |
806 | /* | 809 | /* |
807 | * Position current pointer at beginning of tail, and | 810 | * Position current pointer at beginning of tail, and |
808 | * set remaining message length. | 811 | * set remaining message length. |