* Return the index and offset of location in iovec list. */
| 125 | * Return the index and offset of location in iovec list. |
| 126 | */ |
| 127 | static int |
| 128 | cuio_getptr(struct uio *uio, int loc, int *off) |
| 129 | { |
| 130 | int ind, len; |
| 131 | |
| 132 | ind = 0; |
| 133 | while (loc >= 0 && ind < uio->uio_iovcnt) { |
| 134 | len = uio->uio_iov[ind].iov_len; |
| 135 | if (len > loc) { |
| 136 | *off = loc; |
| 137 | return (ind); |
| 138 | } |
| 139 | loc -= len; |
| 140 | ind++; |
| 141 | } |
| 142 | |
| 143 | if (ind > 0 && loc == 0) { |
| 144 | ind--; |
| 145 | *off = uio->uio_iov[ind].iov_len; |
| 146 | return (ind); |
| 147 | } |
| 148 | |
| 149 | return (-1); |
| 150 | } |
| 151 | |
| 152 | #if CRYPTO_MAY_HAVE_VMPAGE |
| 153 | /* |
no outgoing calls
no test coverage detected