Lines Matching refs:base
228 struct page **pages, unsigned int base, unsigned int len) in xdr_inline_pages() argument
238 xdr->page_base = base; in xdr_inline_pages()
474 static void xdr_buf_iov_zero(const struct kvec *iov, unsigned int base, in xdr_buf_iov_zero() argument
477 if (base >= iov->iov_len) in xdr_buf_iov_zero()
479 if (len > iov->iov_len - base) in xdr_buf_iov_zero()
480 len = iov->iov_len - base; in xdr_buf_iov_zero()
481 memset(iov->iov_base + base, 0, len); in xdr_buf_iov_zero()
585 unsigned int base, unsigned int len, in xdr_buf_tail_copy_right() argument
589 unsigned int to = base + shift; in xdr_buf_tail_copy_right()
595 memmove(tail->iov_base + to, tail->iov_base + base, len); in xdr_buf_tail_copy_right()
599 unsigned int base, unsigned int len, in xdr_buf_pages_copy_right() argument
603 unsigned int to = base + shift; in xdr_buf_pages_copy_right()
607 if (base >= buf->page_len) in xdr_buf_pages_copy_right()
609 if (len > buf->page_len - base) in xdr_buf_pages_copy_right()
610 len = buf->page_len - base; in xdr_buf_pages_copy_right()
626 buf->page_base + base + pglen, talen); in xdr_buf_pages_copy_right()
628 buf->page_base + base, pglen); in xdr_buf_pages_copy_right()
632 unsigned int base, unsigned int len, in xdr_buf_head_copy_right() argument
637 unsigned int to = base + shift; in xdr_buf_head_copy_right()
641 if (base >= head->iov_len) in xdr_buf_head_copy_right()
643 if (len > head->iov_len - base) in xdr_buf_head_copy_right()
644 len = head->iov_len - base; in xdr_buf_head_copy_right()
664 base += len; in xdr_buf_head_copy_right()
667 memcpy(tail->iov_base + tato, head->iov_base + base, talen); in xdr_buf_head_copy_right()
670 base -= pglen; in xdr_buf_head_copy_right()
671 _copy_to_pages(buf->pages, buf->page_base + pgto, head->iov_base + base, in xdr_buf_head_copy_right()
674 base -= len; in xdr_buf_head_copy_right()
675 memmove(head->iov_base + to, head->iov_base + base, len); in xdr_buf_head_copy_right()
679 unsigned int base, unsigned int len, in xdr_buf_tail_shift_right() argument
684 if (base >= tail->iov_len || !shift || !len) in xdr_buf_tail_shift_right()
686 xdr_buf_tail_copy_right(buf, base, len, shift); in xdr_buf_tail_shift_right()
690 unsigned int base, unsigned int len, in xdr_buf_pages_shift_right() argument
695 if (base >= buf->page_len) { in xdr_buf_pages_shift_right()
696 xdr_buf_tail_shift_right(buf, base - buf->page_len, len, shift); in xdr_buf_pages_shift_right()
699 if (base + len > buf->page_len) in xdr_buf_pages_shift_right()
700 xdr_buf_tail_shift_right(buf, 0, base + len - buf->page_len, in xdr_buf_pages_shift_right()
702 xdr_buf_pages_copy_right(buf, base, len, shift); in xdr_buf_pages_shift_right()
706 unsigned int base, unsigned int len, in xdr_buf_head_shift_right() argument
713 if (base >= head->iov_len) { in xdr_buf_head_shift_right()
714 xdr_buf_pages_shift_right(buf, head->iov_len - base, len, in xdr_buf_head_shift_right()
718 if (base + len > head->iov_len) in xdr_buf_head_shift_right()
719 xdr_buf_pages_shift_right(buf, 0, base + len - head->iov_len, in xdr_buf_head_shift_right()
721 xdr_buf_head_copy_right(buf, base, len, shift); in xdr_buf_head_shift_right()
724 static void xdr_buf_tail_copy_left(const struct xdr_buf *buf, unsigned int base, in xdr_buf_tail_copy_left() argument
729 if (base >= tail->iov_len) in xdr_buf_tail_copy_left()
731 if (len > tail->iov_len - base) in xdr_buf_tail_copy_left()
732 len = tail->iov_len - base; in xdr_buf_tail_copy_left()
734 if (shift > buf->page_len + base) { in xdr_buf_tail_copy_left()
737 head->iov_len + buf->page_len + base - shift; in xdr_buf_tail_copy_left()
740 if (WARN_ONCE(shift > head->iov_len + buf->page_len + base, in xdr_buf_tail_copy_left()
745 memcpy(head->iov_base + hdto, tail->iov_base + base, hdlen); in xdr_buf_tail_copy_left()
746 base += hdlen; in xdr_buf_tail_copy_left()
752 if (shift > base) { in xdr_buf_tail_copy_left()
753 unsigned int pgto = buf->page_len + base - shift; in xdr_buf_tail_copy_left()
759 tail->iov_base + base, pglen); in xdr_buf_tail_copy_left()
760 base += pglen; in xdr_buf_tail_copy_left()
765 memmove(tail->iov_base + base - shift, tail->iov_base + base, len); in xdr_buf_tail_copy_left()
769 unsigned int base, unsigned int len, in xdr_buf_pages_copy_left() argument
774 if (base >= buf->page_len) in xdr_buf_pages_copy_left()
776 if (len > buf->page_len - base) in xdr_buf_pages_copy_left()
777 len = buf->page_len - base; in xdr_buf_pages_copy_left()
779 if (shift > base) { in xdr_buf_pages_copy_left()
781 unsigned int hdto = head->iov_len + base - shift; in xdr_buf_pages_copy_left()
784 if (WARN_ONCE(shift > head->iov_len + base, in xdr_buf_pages_copy_left()
790 buf->page_base + base, hdlen); in xdr_buf_pages_copy_left()
791 base += hdlen; in xdr_buf_pages_copy_left()
796 pgto = base - shift; in xdr_buf_pages_copy_left()
798 buf->page_base + base, len); in xdr_buf_pages_copy_left()
802 unsigned int base, unsigned int len, in xdr_buf_tail_shift_left() argument
807 xdr_buf_tail_copy_left(buf, base, len, shift); in xdr_buf_tail_shift_left()
811 unsigned int base, unsigned int len, in xdr_buf_pages_shift_left() argument
816 if (base >= buf->page_len) { in xdr_buf_pages_shift_left()
817 xdr_buf_tail_shift_left(buf, base - buf->page_len, len, shift); in xdr_buf_pages_shift_left()
820 xdr_buf_pages_copy_left(buf, base, len, shift); in xdr_buf_pages_shift_left()
821 len += base; in xdr_buf_pages_shift_left()
828 unsigned int base, unsigned int len, in xdr_buf_head_shift_left() argument
837 if (shift > base) { in xdr_buf_head_shift_left()
838 bytes = (shift - base); in xdr_buf_head_shift_left()
841 base += bytes; in xdr_buf_head_shift_left()
845 if (base < head->iov_len) { in xdr_buf_head_shift_left()
846 bytes = min_t(unsigned int, len, head->iov_len - base); in xdr_buf_head_shift_left()
847 memmove(head->iov_base + (base - shift), in xdr_buf_head_shift_left()
848 head->iov_base + base, bytes); in xdr_buf_head_shift_left()
849 base += bytes; in xdr_buf_head_shift_left()
852 xdr_buf_pages_shift_left(buf, base - head->iov_len, len, shift); in xdr_buf_head_shift_left()
1290 void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, unsigned int base, in xdr_write_pages() argument
1297 buf->page_base = base; in xdr_write_pages()
1319 unsigned int base, unsigned int len) in xdr_set_iov() argument
1323 if (unlikely(base > len)) in xdr_set_iov()
1324 base = len; in xdr_set_iov()
1325 xdr->p = (__be32*)(iov->iov_base + base); in xdr_set_iov()
1329 return len - base; in xdr_set_iov()
1333 unsigned int base, unsigned int len) in xdr_set_tail_base() argument
1337 xdr_stream_set_pos(xdr, base + buf->page_len + buf->head->iov_len); in xdr_set_tail_base()
1338 return xdr_set_iov(xdr, buf->tail, base, len); in xdr_set_tail_base()
1350 unsigned int base, unsigned int len) in xdr_set_page_base() argument
1359 if (base >= maxlen) in xdr_set_page_base()
1362 maxlen -= base; in xdr_set_page_base()
1367 xdr_stream_page_set_pos(xdr, base); in xdr_set_page_base()
1368 base += xdr->buf->page_base; in xdr_set_page_base()
1370 pgnr = base >> PAGE_SHIFT; in xdr_set_page_base()
1379 pgoff = base & ~PAGE_MASK; in xdr_set_page_base()
1390 static void xdr_set_page(struct xdr_stream *xdr, unsigned int base, in xdr_set_page() argument
1393 if (xdr_set_page_base(xdr, base, len) == 0) { in xdr_set_page()
1394 base -= xdr->buf->page_len; in xdr_set_page()
1395 xdr_set_tail_base(xdr, base, len); in xdr_set_page()
1595 unsigned int base, end, pglen; in xdr_read_pages() local
1601 base = (nwords << 2) - pglen; in xdr_read_pages()
1604 xdr_set_tail_base(xdr, base, end); in xdr_read_pages()
1624 size_t base = 0; in xdr_set_pagelen() local
1627 base = buf->page_len - len; in xdr_set_pagelen()
1635 xdr_set_tail_base(xdr, base, remaining); in xdr_set_pagelen()
1687 unsigned int base, unsigned int len) in xdr_buf_subsegment() argument
1690 if (base < buf->head[0].iov_len) { in xdr_buf_subsegment()
1691 subbuf->head[0].iov_base = buf->head[0].iov_base + base; in xdr_buf_subsegment()
1693 buf->head[0].iov_len - base); in xdr_buf_subsegment()
1695 base = 0; in xdr_buf_subsegment()
1697 base -= buf->head[0].iov_len; in xdr_buf_subsegment()
1702 if (base < buf->page_len) { in xdr_buf_subsegment()
1703 subbuf->page_len = min(buf->page_len - base, len); in xdr_buf_subsegment()
1704 base += buf->page_base; in xdr_buf_subsegment()
1705 subbuf->page_base = base & ~PAGE_MASK; in xdr_buf_subsegment()
1706 subbuf->pages = &buf->pages[base >> PAGE_SHIFT]; in xdr_buf_subsegment()
1708 base = 0; in xdr_buf_subsegment()
1710 base -= buf->page_len; in xdr_buf_subsegment()
1716 if (base < buf->tail[0].iov_len) { in xdr_buf_subsegment()
1717 subbuf->tail[0].iov_base = buf->tail[0].iov_base + base; in xdr_buf_subsegment()
1719 buf->tail[0].iov_len - base); in xdr_buf_subsegment()
1721 base = 0; in xdr_buf_subsegment()
1723 base -= buf->tail[0].iov_len; in xdr_buf_subsegment()
1728 if (base || len) in xdr_buf_subsegment()
1894 int read_bytes_from_xdr_buf(const struct xdr_buf *buf, unsigned int base, in read_bytes_from_xdr_buf() argument
1900 status = xdr_buf_subsegment(buf, &subbuf, base, len); in read_bytes_from_xdr_buf()
1926 int write_bytes_to_xdr_buf(const struct xdr_buf *buf, unsigned int base, in write_bytes_to_xdr_buf() argument
1932 status = xdr_buf_subsegment(buf, &subbuf, base, len); in write_bytes_to_xdr_buf()
1940 int xdr_decode_word(const struct xdr_buf *buf, unsigned int base, u32 *obj) in xdr_decode_word() argument
1945 status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj)); in xdr_decode_word()
1953 int xdr_encode_word(const struct xdr_buf *buf, unsigned int base, u32 obj) in xdr_encode_word() argument
1957 return write_bytes_to_xdr_buf(buf, base, &raw, sizeof(obj)); in xdr_encode_word()
1962 static int xdr_xcode_array2(const struct xdr_buf *buf, unsigned int base, in xdr_xcode_array2() argument
1971 if (xdr_encode_word(buf, base, desc->array_len) != 0) in xdr_xcode_array2()
1974 if (xdr_decode_word(buf, base, &desc->array_len) != 0 || in xdr_xcode_array2()
1976 (unsigned long) base + 4 + desc->array_len * in xdr_xcode_array2()
1980 base += 4; in xdr_xcode_array2()
1988 if (todo && base < buf->head->iov_len) { in xdr_xcode_array2()
1989 c = buf->head->iov_base + base; in xdr_xcode_array2()
1991 buf->head->iov_len - base); in xdr_xcode_array2()
2017 base = buf->head->iov_len; /* align to start of pages */ in xdr_xcode_array2()
2021 base -= buf->head->iov_len; in xdr_xcode_array2()
2022 if (todo && base < buf->page_len) { in xdr_xcode_array2()
2025 avail_here = min(todo, buf->page_len - base); in xdr_xcode_array2()
2028 base += buf->page_base; in xdr_xcode_array2()
2029 ppages = buf->pages + (base >> PAGE_SHIFT); in xdr_xcode_array2()
2030 base &= ~PAGE_MASK; in xdr_xcode_array2()
2031 avail_page = min_t(unsigned int, PAGE_SIZE - base, in xdr_xcode_array2()
2033 c = kmap(*ppages) + base; in xdr_xcode_array2()
2117 base = buf->page_len; /* align to start of tail */ in xdr_xcode_array2()
2121 base -= buf->page_len; in xdr_xcode_array2()
2123 c = buf->tail->iov_base + base; in xdr_xcode_array2()
2155 int xdr_decode_array2(const struct xdr_buf *buf, unsigned int base, in xdr_decode_array2() argument
2158 if (base >= buf->len) in xdr_decode_array2()
2161 return xdr_xcode_array2(buf, base, desc, 0); in xdr_decode_array2()
2165 int xdr_encode_array2(const struct xdr_buf *buf, unsigned int base, in xdr_encode_array2() argument
2168 if ((unsigned long) base + 4 + desc->array_len * desc->elem_size > in xdr_encode_array2()
2172 return xdr_xcode_array2(buf, base, desc, 1); in xdr_encode_array2()