Lines Matching +full:byte +full:- +full:len
1 /* SPDX-License-Identifier: GPL-2.0 */
14 #include "highmem-internal.h"
17 * kmap - Map a page for long term usage
40 * kunmap - Unmap the virtual address mapped by kmap()
49 * kmap_to_page - Get the page for a kmap'ed address
57 * kmap_flush_unused - Flush all unused kmap mappings in order to
63 * kmap_local_page - Map a page for temporary usage
99 * kmap_local_folio - Map a page in this folio for temporary usage
101 * @offset: The byte offset within the folio which identifies the page.
135 * kmap_atomic - Atomically map a page for temporary usage - Deprecated!
212 * vma_alloc_zeroed_movable_folio - Allocate a zeroed page for a VMA.
231 clear_user_highpage(&folio->page, vaddr); in vma_alloc_zeroed_movable_folio()
278 memset(kaddr + start1, 0, end1 - start1); in zero_user_segments()
281 memset(kaddr + start2, 0, end2 - start2); in zero_user_segments()
396 size_t len) in memcpy_page() argument
401 VM_BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE); in memcpy_page()
402 memcpy(dst + dst_off, src + src_off, len); in memcpy_page()
408 size_t len) in memset_page() argument
412 VM_BUG_ON(offset + len > PAGE_SIZE); in memset_page()
413 memset(addr + offset, val, len); in memset_page()
418 size_t offset, size_t len) in memcpy_from_page() argument
422 VM_BUG_ON(offset + len > PAGE_SIZE); in memcpy_from_page()
423 memcpy(to, from + offset, len); in memcpy_from_page()
428 const char *from, size_t len) in memcpy_to_page() argument
432 VM_BUG_ON(offset + len > PAGE_SIZE); in memcpy_to_page()
433 memcpy(to + offset, from, len); in memcpy_to_page()
438 static inline void memzero_page(struct page *page, size_t offset, size_t len) in memzero_page() argument
442 VM_BUG_ON(offset + len > PAGE_SIZE); in memzero_page()
443 memset(addr + offset, 0, len); in memzero_page()
449 * memcpy_from_folio - Copy a range of bytes from a folio.
452 * @offset: The first byte in the folio to read.
453 * @len: The number of bytes to copy.
456 size_t offset, size_t len) in memcpy_from_folio() argument
458 VM_BUG_ON(offset + len > folio_size(folio)); in memcpy_from_folio()
462 size_t chunk = len; in memcpy_from_folio()
465 chunk > PAGE_SIZE - offset_in_page(offset)) in memcpy_from_folio()
466 chunk = PAGE_SIZE - offset_in_page(offset); in memcpy_from_folio()
472 len -= chunk; in memcpy_from_folio()
473 } while (len > 0); in memcpy_from_folio()
477 * memcpy_to_folio - Copy a range of bytes to a folio.
479 * @offset: The first byte in the folio to store to.
481 * @len: The number of bytes to copy.
484 const char *from, size_t len) in memcpy_to_folio() argument
486 VM_BUG_ON(offset + len > folio_size(folio)); in memcpy_to_folio()
490 size_t chunk = len; in memcpy_to_folio()
493 chunk > PAGE_SIZE - offset_in_page(offset)) in memcpy_to_folio()
494 chunk = PAGE_SIZE - offset_in_page(offset); in memcpy_to_folio()
500 len -= chunk; in memcpy_to_folio()
501 } while (len > 0); in memcpy_to_folio()
507 * folio_zero_tail - Zero the tail of a folio.
509 * @offset: The byte offset in the folio to start zeroing at.
523 size_t len = folio_size(folio) - offset; in folio_zero_tail() local
526 size_t max = PAGE_SIZE - offset_in_page(offset); in folio_zero_tail()
528 while (len > max) { in folio_zero_tail()
531 len -= max; in folio_zero_tail()
538 memset(kaddr, 0, len); in folio_zero_tail()
545 * folio_fill_tail - Copy some data to a folio and pad with zeroes.
549 * @len: How many bytes of data to copy.
557 const char *from, size_t len) in folio_fill_tail() argument
561 VM_BUG_ON(offset + len > folio_size(folio)); in folio_fill_tail()
564 size_t max = PAGE_SIZE - offset_in_page(offset); in folio_fill_tail()
566 while (len > max) { in folio_fill_tail()
569 len -= max; in folio_fill_tail()
577 memcpy(to, from, len); in folio_fill_tail()
578 to = folio_zero_tail(folio, offset + len, to + len); in folio_fill_tail()
583 * memcpy_from_file_folio - Copy some bytes from a file folio.
587 * @len: The maximum number of bytes to copy.
589 * Copy up to @len bytes from this folio. This may be limited by PAGE_SIZE
595 loff_t pos, size_t len) in memcpy_from_file_folio() argument
602 len = min_t(size_t, len, PAGE_SIZE - offset); in memcpy_from_file_folio()
604 len = min(len, folio_size(folio) - offset); in memcpy_from_file_folio()
606 memcpy(to, from, len); in memcpy_from_file_folio()
609 return len; in memcpy_from_file_folio()
613 * folio_zero_segments() - Zero two byte ranges in a folio.
615 * @start1: The first byte to zero.
616 * @xend1: One more than the last byte in the first range.
617 * @start2: The first byte to zero in the second range.
618 * @xend2: One more than the last byte in the second range.
623 zero_user_segments(&folio->page, start1, xend1, start2, xend2); in folio_zero_segments()
627 * folio_zero_segment() - Zero a byte range in a folio.
629 * @start: The first byte to zero.
630 * @xend: One more than the last byte to zero.
635 zero_user_segments(&folio->page, start, xend, 0, 0); in folio_zero_segment()
639 * folio_zero_range() - Zero a byte range in a folio.
641 * @start: The first byte to zero.
647 zero_user_segments(&folio->page, start, start + length, 0, 0); in folio_zero_range()
651 * folio_release_kmap - Unmap a folio and drop a refcount.