aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/xdr.h2
-rw-r--r--net/sunrpc/xdr.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index f1e7f884d1c3..2489bce1fb88 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -223,7 +223,7 @@ extern void xdr_init_decode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
223 struct page **pages, unsigned int len); 223 struct page **pages, unsigned int len);
224extern void xdr_set_scratch_buffer(struct xdr_stream *xdr, void *buf, size_t buflen); 224extern void xdr_set_scratch_buffer(struct xdr_stream *xdr, void *buf, size_t buflen);
225extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); 225extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
226extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); 226extern unsigned int xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
227extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len); 227extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
228extern int xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len, int (*actor)(struct scatterlist *, void *), void *data); 228extern int xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len, int (*actor)(struct scatterlist *, void *), void *data);
229 229
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 */
749void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) 751unsigned 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}
791EXPORT_SYMBOL_GPL(xdr_read_pages); 794EXPORT_SYMBOL_GPL(xdr_read_pages);
792 795
@@ -802,7 +805,7 @@ EXPORT_SYMBOL_GPL(xdr_read_pages);
802 */ 805 */
803void xdr_enter_page(struct xdr_stream *xdr, unsigned int len) 806void 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.