• Home
  • Raw
  • Download

Lines Matching refs:n

18 #define iterate_buf(i, n, base, len, off, __p, STEP) {		\  argument
20 len = n; \
24 n = len; \
28 #define iterate_iovec(i, n, base, len, off, __p, STEP) { \ argument
32 len = min(n, __p->iov_len - skip); \
38 n -= len; \
44 } while (n); \
46 n = off; \
49 #define iterate_bvec(i, n, base, len, off, p, STEP) { \ argument
52 while (n) { \
58 len = min(min(n, (size_t)(p->bv_len - skip)), \
69 n -= len; \
74 n = off; \
77 #define iterate_xarray(i, n, base, len, __off, STEP) { \ argument
99 len = min(n, len); \
104 n -= len; \
105 if (left || n == 0) \
114 n = __off; \
117 #define __iterate_and_advance(i, n, base, len, off, I, K) { \ argument
118 if (unlikely(i->count < n)) \
119 n = i->count; \
120 if (likely(n)) { \
124 iterate_buf(i, n, base, len, off, \
130 iterate_iovec(i, n, base, len, off, \
138 iterate_bvec(i, n, base, len, off, \
146 iterate_iovec(i, n, base, len, off, \
153 iterate_xarray(i, n, base, len, off, \
156 i->count -= n; \
159 #define iterate_and_advance(i, n, base, len, off, I, K) \ argument
160 __iterate_and_advance(i, n, base, len, off, I, ((void)(K),0))
162 static int copyout(void __user *to, const void *from, size_t n) in copyout() argument
165 return n; in copyout()
166 if (access_ok(to, n)) { in copyout()
167 instrument_copy_to_user(to, from, n); in copyout()
168 n = raw_copy_to_user(to, from, n); in copyout()
170 return n; in copyout()
173 static int copyout_nofault(void __user *to, const void *from, size_t n) in copyout_nofault() argument
178 return n; in copyout_nofault()
180 res = copy_to_user_nofault(to, from, n); in copyout_nofault()
182 return res < 0 ? n : res; in copyout_nofault()
185 static int copyin(void *to, const void __user *from, size_t n) in copyin() argument
187 size_t res = n; in copyin()
190 return n; in copyin()
191 if (access_ok(from, n)) { in copyin()
192 instrument_copy_from_user_before(to, from, n); in copyin()
193 res = raw_copy_from_user(to, from, n); in copyin()
194 instrument_copy_from_user_after(to, from, n, res); in copyin()
215 size_t n = min(size, iov_iter_count(i)); in fault_in_iov_iter_readable() local
216 n -= fault_in_readable(i->ubuf + i->iov_offset, n); in fault_in_iov_iter_readable()
217 return size - n; in fault_in_iov_iter_readable()
258 size_t n = min(size, iov_iter_count(i)); in fault_in_iov_iter_writeable() local
259 n -= fault_in_safe_writeable(i->ubuf + i->iov_offset, n); in fault_in_iov_iter_writeable()
260 return size - n; in fault_in_iov_iter_writeable()
326 static int copyout_mc(void __user *to, const void *from, size_t n) in copyout_mc() argument
328 if (access_ok(to, n)) { in copyout_mc()
329 instrument_copy_to_user(to, from, n); in copyout_mc()
330 n = copy_mc_to_user((__force void *) to, from, n); in copyout_mc()
332 return n; in copyout_mc()
445 static inline bool page_copy_sane(struct page *page, size_t offset, size_t n) in page_copy_sane() argument
448 size_t v = n + offset; in page_copy_sane()
457 if (n <= v && v <= PAGE_SIZE) in page_copy_sane()
463 if (WARN_ON(n > v || v > page_size(head))) in page_copy_sane()
480 size_t n = min(bytes, (size_t)PAGE_SIZE - offset); in copy_page_to_iter() local
481 n = _copy_to_iter(kaddr + offset, n, i); in copy_page_to_iter()
483 res += n; in copy_page_to_iter()
484 bytes -= n; in copy_page_to_iter()
485 if (!bytes || !n) in copy_page_to_iter()
487 offset += n; in copy_page_to_iter()
510 size_t n = min(bytes, (size_t)PAGE_SIZE - offset); in copy_page_to_iter_nofault() local
512 iterate_and_advance(i, n, base, len, off, in copy_page_to_iter_nofault()
517 res += n; in copy_page_to_iter_nofault()
518 bytes -= n; in copy_page_to_iter_nofault()
519 if (!bytes || !n) in copy_page_to_iter_nofault()
521 offset += n; in copy_page_to_iter_nofault()
541 size_t n = min(bytes, (size_t)PAGE_SIZE - offset); in copy_page_from_iter() local
542 n = _copy_from_iter(kaddr + offset, n, i); in copy_page_from_iter()
544 res += n; in copy_page_from_iter()
545 bytes -= n; in copy_page_from_iter()
546 if (!bytes || !n) in copy_page_from_iter()
548 offset += n; in copy_page_from_iter()
572 size_t n, copied = 0; in copy_page_from_iter_atomic() local
582 n = bytes - copied; in copy_page_from_iter_atomic()
586 n = min_t(size_t, n, PAGE_SIZE - offset); in copy_page_from_iter_atomic()
590 iterate_and_advance(i, n, base, len, off, in copy_page_from_iter_atomic()
595 copied += n; in copy_page_from_iter_atomic()
596 offset += n; in copy_page_from_iter_atomic()
597 } while (PageHighMem(page) && copied != bytes && n > 0); in copy_page_from_iter_atomic()
682 size_t n = (--bvec)->bv_len; in iov_iter_revert() local
684 if (unroll <= n) { in iov_iter_revert()
686 i->iov_offset = n - unroll; in iov_iter_revert()
689 unroll -= n; in iov_iter_revert()
694 size_t n = (--iov)->iov_len; in iov_iter_revert() local
696 if (unroll <= n) { in iov_iter_revert()
698 i->iov_offset = n - unroll; in iov_iter_revert()
701 unroll -= n; in iov_iter_revert()
1100 unsigned int n, gup_flags = 0; in __iov_iter_get_pages_alloc() local
1121 n = want_pages_array(pages, maxsize, *start, maxpages); in __iov_iter_get_pages_alloc()
1122 if (!n) in __iov_iter_get_pages_alloc()
1124 res = get_user_pages_fast(addr, n, gup_flags, *pages); in __iov_iter_get_pages_alloc()
1136 n = want_pages_array(pages, maxsize, *start, maxpages); in __iov_iter_get_pages_alloc()
1137 if (!n) in __iov_iter_get_pages_alloc()
1140 for (int k = 0; k < n; k++) in __iov_iter_get_pages_alloc()
1142 maxsize = min_t(size_t, maxsize, n * PAGE_SIZE - *start); in __iov_iter_get_pages_alloc()