MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cuio_apply

Function cuio_apply

freebsd/opencrypto/criov.c:568–590  ·  view source on GitHub ↗

* Apply function f to the data in an iovec list starting "off" bytes from * the beginning, continuing for "len" bytes. */

Source from the content-addressed store, hash-verified

566 * the beginning, continuing for "len" bytes.
567 */
568static int
569cuio_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
592void
593crypto_copyback(struct cryptop *crp, int off, int size, const void *src)

Callers 1

crypto_apply_bufFunction · 0.85

Calls 1

minFunction · 0.85

Tested by

no test coverage detected