* Apply function f to the data in an iovec list starting "off" bytes from * the beginning, continuing for "len" bytes. */
| 566 | * the beginning, continuing for "len" bytes. |
| 567 | */ |
| 568 | static int |
| 569 | cuio_apply(struct uio *uio, int off, int len, |
| 570 | int (*f)(void *, const void *, u_int), void *arg) |
| 571 | { |
| 572 | struct iovec *iov = uio->uio_iov; |
| 573 | int iol = uio->uio_iovcnt; |
| 574 | unsigned count; |
| 575 | int rval; |
| 576 | |
| 577 | CUIO_SKIP(); |
| 578 | while (len > 0) { |
| 579 | KASSERT(iol >= 0, ("%s: empty", __func__)); |
| 580 | count = min(iov->iov_len - off, len); |
| 581 | rval = (*f)(arg, ((caddr_t)iov->iov_base) + off, count); |
| 582 | if (rval) |
| 583 | return (rval); |
| 584 | len -= count; |
| 585 | off = 0; |
| 586 | iol--; |
| 587 | iov++; |
| 588 | } |
| 589 | return (0); |
| 590 | } |
| 591 | |
| 592 | void |
| 593 | crypto_copyback(struct cryptop *crp, int off, int size, const void *src) |
no test coverage detected