* Apply function f to the data in a vm_page_t list starting "off" bytes from * the beginning, continuing for "len" bytes. */
| 155 | * the beginning, continuing for "len" bytes. |
| 156 | */ |
| 157 | static int |
| 158 | cvm_page_apply(vm_page_t *pages, int off, int len, |
| 159 | int (*f)(void *, const void *, u_int), void *arg) |
| 160 | { |
| 161 | int processed = 0; |
| 162 | unsigned count; |
| 163 | int rval; |
| 164 | |
| 165 | CVM_PAGE_SKIP(); |
| 166 | while (len > 0) { |
| 167 | char *kaddr = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(*pages)); |
| 168 | count = min(PAGE_SIZE - off, len); |
| 169 | rval = (*f)(arg, kaddr + off, count); |
| 170 | if (rval) |
| 171 | return (rval); |
| 172 | len -= count; |
| 173 | processed += count; |
| 174 | off = 0; |
| 175 | pages++; |
| 176 | } |
| 177 | return (0); |
| 178 | } |
| 179 | |
| 180 | static inline void * |
| 181 | cvm_page_contiguous_segment(vm_page_t *pages, size_t skip, int len) |
no test coverage detected