Extending FreeBSD UIO Struct

In FreeBSD the struct uio was just a typedef to uio_t. In order to
extend this struct, outside of the definition for the struct uio, the
struct uio has been embedded inside of a uio_t struct.

Also renamed all the uio_* interfaces to be zfs_uio_* to make it clear
this is a ZFS interface.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #11438
This commit is contained in:
Brian Atkinson
2021-01-20 22:27:30 -07:00
committed by GitHub
parent e2af2acce3
commit d0cd9a5cc6
37 changed files with 521 additions and 457 deletions
+6 -6
View File
@@ -43,11 +43,11 @@ crypto_init_ptrs(crypto_data_t *out, void **iov_or_mp, offset_t *current_offset)
break;
case CRYPTO_DATA_UIO: {
uio_t *uiop = out->cd_uio;
zfs_uio_t *uiop = out->cd_uio;
uint_t vec_idx;
offset = out->cd_offset;
offset = uio_index_at_offset(uiop, offset, &vec_idx);
offset = zfs_uio_index_at_offset(uiop, offset, &vec_idx);
*current_offset = offset;
*iov_or_mp = (void *)(uintptr_t)vec_idx;
@@ -85,7 +85,7 @@ crypto_get_ptrs(crypto_data_t *out, void **iov_or_mp, offset_t *current_offset,
}
case CRYPTO_DATA_UIO: {
uio_t *uio = out->cd_uio;
zfs_uio_t *uio = out->cd_uio;
offset_t offset;
uint_t vec_idx;
uint8_t *p;
@@ -94,7 +94,7 @@ crypto_get_ptrs(crypto_data_t *out, void **iov_or_mp, offset_t *current_offset,
offset = *current_offset;
vec_idx = (uintptr_t)(*iov_or_mp);
uio_iov_at_index(uio, vec_idx, &iov_base, &iov_len);
zfs_uio_iov_at_index(uio, vec_idx, &iov_base, &iov_len);
p = (uint8_t *)iov_base + offset;
*out_data_1 = p;
@@ -106,10 +106,10 @@ crypto_get_ptrs(crypto_data_t *out, void **iov_or_mp, offset_t *current_offset,
} else {
/* one block spans two iovecs */
*out_data_1_len = iov_len - offset;
if (vec_idx == uio_iovcnt(uio))
if (vec_idx == zfs_uio_iovcnt(uio))
return;
vec_idx++;
uio_iov_at_index(uio, vec_idx, &iov_base, &iov_len);
zfs_uio_iov_at_index(uio, vec_idx, &iov_base, &iov_len);
*out_data_2 = (uint8_t *)iov_base;
*current_offset = amt - *out_data_1_len;
}
+16 -16
View File
@@ -40,7 +40,7 @@ int
crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd,
void *digest_ctx, void (*update)(void))
{
uio_t *uiop = data->cd_uio;
zfs_uio_t *uiop = data->cd_uio;
off_t offset = data->cd_offset;
size_t length = len;
uint_t vec_idx;
@@ -48,7 +48,7 @@ crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd,
uchar_t *datap;
ASSERT(data->cd_format == CRYPTO_DATA_UIO);
if (uio_segflg(uiop) != UIO_SYSSPACE) {
if (zfs_uio_segflg(uiop) != UIO_SYSSPACE) {
return (CRYPTO_ARGUMENTS_BAD);
}
@@ -56,9 +56,9 @@ crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd,
* Jump to the first iovec containing data to be
* processed.
*/
offset = uio_index_at_offset(uiop, offset, &vec_idx);
offset = zfs_uio_index_at_offset(uiop, offset, &vec_idx);
if (vec_idx == uio_iovcnt(uiop) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(uiop) && length > 0) {
/*
* The caller specified an offset that is larger than
* the total size of the buffers it provided.
@@ -66,11 +66,11 @@ crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd,
return (CRYPTO_DATA_LEN_RANGE);
}
while (vec_idx < uio_iovcnt(uiop) && length > 0) {
cur_len = MIN(uio_iovlen(uiop, vec_idx) -
while (vec_idx < zfs_uio_iovcnt(uiop) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(uiop, vec_idx) -
offset, length);
datap = (uchar_t *)(uio_iovbase(uiop, vec_idx) + offset);
datap = (uchar_t *)(zfs_uio_iovbase(uiop, vec_idx) + offset);
switch (cmd) {
case COPY_FROM_DATA:
bcopy(datap, buf, cur_len);
@@ -97,7 +97,7 @@ crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd,
offset = 0;
}
if (vec_idx == uio_iovcnt(uiop) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(uiop) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed.
@@ -166,7 +166,7 @@ crypto_update_uio(void *ctx, crypto_data_t *input, crypto_data_t *output,
void (*copy_block)(uint8_t *, uint64_t *))
{
common_ctx_t *common_ctx = ctx;
uio_t *uiop = input->cd_uio;
zfs_uio_t *uiop = input->cd_uio;
off_t offset = input->cd_offset;
size_t length = input->cd_length;
uint_t vec_idx;
@@ -178,7 +178,7 @@ crypto_update_uio(void *ctx, crypto_data_t *input, crypto_data_t *output,
&common_ctx->cc_iv[0]);
}
if (uio_segflg(input->cd_uio) != UIO_SYSSPACE) {
if (zfs_uio_segflg(input->cd_uio) != UIO_SYSSPACE) {
return (CRYPTO_ARGUMENTS_BAD);
}
@@ -186,8 +186,8 @@ crypto_update_uio(void *ctx, crypto_data_t *input, crypto_data_t *output,
* Jump to the first iovec containing data to be
* processed.
*/
offset = uio_index_at_offset(uiop, offset, &vec_idx);
if (vec_idx == uio_iovcnt(uiop) && length > 0) {
offset = zfs_uio_index_at_offset(uiop, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(uiop) && length > 0) {
/*
* The caller specified an offset that is larger than the
* total size of the buffers it provided.
@@ -198,11 +198,11 @@ crypto_update_uio(void *ctx, crypto_data_t *input, crypto_data_t *output,
/*
* Now process the iovecs.
*/
while (vec_idx < uio_iovcnt(uiop) && length > 0) {
cur_len = MIN(uio_iovlen(uiop, vec_idx) -
while (vec_idx < zfs_uio_iovcnt(uiop) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(uiop, vec_idx) -
offset, length);
int rv = (cipher)(ctx, uio_iovbase(uiop, vec_idx) + offset,
int rv = (cipher)(ctx, zfs_uio_iovbase(uiop, vec_idx) + offset,
cur_len, output);
if (rv != CRYPTO_SUCCESS) {
@@ -213,7 +213,7 @@ crypto_update_uio(void *ctx, crypto_data_t *input, crypto_data_t *output,
offset = 0;
}
if (vec_idx == uio_iovcnt(uiop) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(uiop) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.
+24 -24
View File
@@ -271,15 +271,15 @@ sha1_digest_update_uio(SHA1_CTX *sha1_ctx, crypto_data_t *data)
size_t cur_len;
/* we support only kernel buffer */
if (uio_segflg(data->cd_uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(data->cd_uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/*
* Jump to the first iovec containing data to be
* digested.
*/
offset = uio_index_at_offset(data->cd_uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(data->cd_uio)) {
offset = zfs_uio_index_at_offset(data->cd_uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(data->cd_uio)) {
/*
* The caller specified an offset that is larger than the
* total size of the buffers it provided.
@@ -290,12 +290,12 @@ sha1_digest_update_uio(SHA1_CTX *sha1_ctx, crypto_data_t *data)
/*
* Now do the digesting on the iovecs.
*/
while (vec_idx < uio_iovcnt(data->cd_uio) && length > 0) {
cur_len = MIN(uio_iovlen(data->cd_uio, vec_idx) -
while (vec_idx < zfs_uio_iovcnt(data->cd_uio) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(data->cd_uio, vec_idx) -
offset, length);
SHA1Update(sha1_ctx,
(uint8_t *)uio_iovbase(data->cd_uio, vec_idx) + offset,
(uint8_t *)zfs_uio_iovbase(data->cd_uio, vec_idx) + offset,
cur_len);
length -= cur_len;
@@ -303,7 +303,7 @@ sha1_digest_update_uio(SHA1_CTX *sha1_ctx, crypto_data_t *data)
offset = 0;
}
if (vec_idx == uio_iovcnt(data->cd_uio) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(data->cd_uio) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.
@@ -330,15 +330,15 @@ sha1_digest_final_uio(SHA1_CTX *sha1_ctx, crypto_data_t *digest,
uint_t vec_idx = 0;
/* we support only kernel buffer */
if (uio_segflg(digest->cd_uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(digest->cd_uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/*
* Jump to the first iovec containing ptr to the digest to
* be returned.
*/
offset = uio_index_at_offset(digest->cd_uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(digest->cd_uio)) {
offset = zfs_uio_index_at_offset(digest->cd_uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(digest->cd_uio)) {
/*
* The caller specified an offset that is
* larger than the total size of the buffers
@@ -348,7 +348,7 @@ sha1_digest_final_uio(SHA1_CTX *sha1_ctx, crypto_data_t *digest,
}
if (offset + digest_len <=
uio_iovlen(digest->cd_uio, vec_idx)) {
zfs_uio_iovlen(digest->cd_uio, vec_idx)) {
/*
* The computed SHA1 digest will fit in the current
* iovec.
@@ -360,11 +360,11 @@ sha1_digest_final_uio(SHA1_CTX *sha1_ctx, crypto_data_t *digest,
* the user only what was requested.
*/
SHA1Final(digest_scratch, sha1_ctx);
bcopy(digest_scratch, (uchar_t *)uio_iovbase(digest->
cd_uio, vec_idx) + offset,
bcopy(digest_scratch, (uchar_t *)
zfs_uio_iovbase(digest->cd_uio, vec_idx) + offset,
digest_len);
} else {
SHA1Final((uchar_t *)uio_iovbase(digest->
SHA1Final((uchar_t *)zfs_uio_iovbase(digest->
cd_uio, vec_idx) + offset,
sha1_ctx);
}
@@ -382,11 +382,11 @@ sha1_digest_final_uio(SHA1_CTX *sha1_ctx, crypto_data_t *digest,
SHA1Final(digest_tmp, sha1_ctx);
while (vec_idx < uio_iovcnt(digest->cd_uio) && length > 0) {
cur_len = MIN(uio_iovlen(digest->cd_uio, vec_idx) -
while (vec_idx < zfs_uio_iovcnt(digest->cd_uio) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(digest->cd_uio, vec_idx) -
offset, length);
bcopy(digest_tmp + scratch_offset,
uio_iovbase(digest->cd_uio, vec_idx) + offset,
zfs_uio_iovbase(digest->cd_uio, vec_idx) + offset,
cur_len);
length -= cur_len;
@@ -395,7 +395,7 @@ sha1_digest_final_uio(SHA1_CTX *sha1_ctx, crypto_data_t *digest,
offset = 0;
}
if (vec_idx == uio_iovcnt(digest->cd_uio) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(digest->cd_uio) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.
@@ -1096,12 +1096,12 @@ sha1_mac_verify_atomic(crypto_provider_handle_t provider,
size_t cur_len;
/* we support only kernel buffer */
if (uio_segflg(mac->cd_uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(mac->cd_uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/* jump to the first iovec containing the expected digest */
offset = uio_index_at_offset(mac->cd_uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(mac->cd_uio)) {
offset = zfs_uio_index_at_offset(mac->cd_uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(mac->cd_uio)) {
/*
* The caller specified an offset that is
* larger than the total size of the buffers
@@ -1112,12 +1112,12 @@ sha1_mac_verify_atomic(crypto_provider_handle_t provider,
}
/* do the comparison of computed digest vs specified one */
while (vec_idx < uio_iovcnt(mac->cd_uio) && length > 0) {
cur_len = MIN(uio_iovlen(mac->cd_uio, vec_idx) -
while (vec_idx < zfs_uio_iovcnt(mac->cd_uio) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(mac->cd_uio, vec_idx) -
offset, length);
if (bcmp(digest + scratch_offset,
uio_iovbase(mac->cd_uio, vec_idx) + offset,
zfs_uio_iovbase(mac->cd_uio, vec_idx) + offset,
cur_len) != 0) {
ret = CRYPTO_INVALID_MAC;
break;
+24 -24
View File
@@ -296,15 +296,15 @@ sha2_digest_update_uio(SHA2_CTX *sha2_ctx, crypto_data_t *data)
size_t cur_len;
/* we support only kernel buffer */
if (uio_segflg(data->cd_uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(data->cd_uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/*
* Jump to the first iovec containing data to be
* digested.
*/
offset = uio_index_at_offset(data->cd_uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(data->cd_uio)) {
offset = zfs_uio_index_at_offset(data->cd_uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(data->cd_uio)) {
/*
* The caller specified an offset that is larger than the
* total size of the buffers it provided.
@@ -315,18 +315,18 @@ sha2_digest_update_uio(SHA2_CTX *sha2_ctx, crypto_data_t *data)
/*
* Now do the digesting on the iovecs.
*/
while (vec_idx < uio_iovcnt(data->cd_uio) && length > 0) {
cur_len = MIN(uio_iovlen(data->cd_uio, vec_idx) -
while (vec_idx < zfs_uio_iovcnt(data->cd_uio) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(data->cd_uio, vec_idx) -
offset, length);
SHA2Update(sha2_ctx, (uint8_t *)uio_iovbase(data->cd_uio,
SHA2Update(sha2_ctx, (uint8_t *)zfs_uio_iovbase(data->cd_uio,
vec_idx) + offset, cur_len);
length -= cur_len;
vec_idx++;
offset = 0;
}
if (vec_idx == uio_iovcnt(data->cd_uio) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(data->cd_uio) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.
@@ -353,15 +353,15 @@ sha2_digest_final_uio(SHA2_CTX *sha2_ctx, crypto_data_t *digest,
uint_t vec_idx = 0;
/* we support only kernel buffer */
if (uio_segflg(digest->cd_uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(digest->cd_uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/*
* Jump to the first iovec containing ptr to the digest to
* be returned.
*/
offset = uio_index_at_offset(digest->cd_uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(digest->cd_uio)) {
offset = zfs_uio_index_at_offset(digest->cd_uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(digest->cd_uio)) {
/*
* The caller specified an offset that is
* larger than the total size of the buffers
@@ -371,7 +371,7 @@ sha2_digest_final_uio(SHA2_CTX *sha2_ctx, crypto_data_t *digest,
}
if (offset + digest_len <=
uio_iovlen(digest->cd_uio, vec_idx)) {
zfs_uio_iovlen(digest->cd_uio, vec_idx)) {
/*
* The computed SHA2 digest will fit in the current
* iovec.
@@ -387,11 +387,11 @@ sha2_digest_final_uio(SHA2_CTX *sha2_ctx, crypto_data_t *digest,
*/
SHA2Final(digest_scratch, sha2_ctx);
bcopy(digest_scratch, (uchar_t *)uio_iovbase(digest->
cd_uio, vec_idx) + offset,
bcopy(digest_scratch, (uchar_t *)
zfs_uio_iovbase(digest->cd_uio, vec_idx) + offset,
digest_len);
} else {
SHA2Final((uchar_t *)uio_iovbase(digest->
SHA2Final((uchar_t *)zfs_uio_iovbase(digest->
cd_uio, vec_idx) + offset,
sha2_ctx);
@@ -410,12 +410,12 @@ sha2_digest_final_uio(SHA2_CTX *sha2_ctx, crypto_data_t *digest,
SHA2Final(digest_tmp, sha2_ctx);
while (vec_idx < uio_iovcnt(digest->cd_uio) && length > 0) {
while (vec_idx < zfs_uio_iovcnt(digest->cd_uio) && length > 0) {
cur_len =
MIN(uio_iovlen(digest->cd_uio, vec_idx) -
MIN(zfs_uio_iovlen(digest->cd_uio, vec_idx) -
offset, length);
bcopy(digest_tmp + scratch_offset,
uio_iovbase(digest->cd_uio, vec_idx) + offset,
zfs_uio_iovbase(digest->cd_uio, vec_idx) + offset,
cur_len);
length -= cur_len;
@@ -424,7 +424,7 @@ sha2_digest_final_uio(SHA2_CTX *sha2_ctx, crypto_data_t *digest,
offset = 0;
}
if (vec_idx == uio_iovcnt(digest->cd_uio) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(digest->cd_uio) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.
@@ -1251,12 +1251,12 @@ sha2_mac_verify_atomic(crypto_provider_handle_t provider,
size_t cur_len;
/* we support only kernel buffer */
if (uio_segflg(mac->cd_uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(mac->cd_uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/* jump to the first iovec containing the expected digest */
offset = uio_index_at_offset(mac->cd_uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(mac->cd_uio)) {
offset = zfs_uio_index_at_offset(mac->cd_uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(mac->cd_uio)) {
/*
* The caller specified an offset that is
* larger than the total size of the buffers
@@ -1267,12 +1267,12 @@ sha2_mac_verify_atomic(crypto_provider_handle_t provider,
}
/* do the comparison of computed digest vs specified one */
while (vec_idx < uio_iovcnt(mac->cd_uio) && length > 0) {
cur_len = MIN(uio_iovlen(mac->cd_uio, vec_idx) -
while (vec_idx < zfs_uio_iovcnt(mac->cd_uio) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(mac->cd_uio, vec_idx) -
offset, length);
if (bcmp(digest + scratch_offset,
uio_iovbase(mac->cd_uio, vec_idx) + offset,
zfs_uio_iovbase(mac->cd_uio, vec_idx) + offset,
cur_len) != 0) {
ret = CRYPTO_INVALID_MAC;
break;
+20 -20
View File
@@ -272,18 +272,18 @@ skein_digest_update_uio(skein_ctx_t *ctx, const crypto_data_t *data)
size_t length = data->cd_length;
uint_t vec_idx = 0;
size_t cur_len;
uio_t *uio = data->cd_uio;
zfs_uio_t *uio = data->cd_uio;
/* we support only kernel buffer */
if (uio_segflg(uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/*
* Jump to the first iovec containing data to be
* digested.
*/
offset = uio_index_at_offset(uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(uio)) {
offset = zfs_uio_index_at_offset(uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(uio)) {
/*
* The caller specified an offset that is larger than the
* total size of the buffers it provided.
@@ -294,16 +294,16 @@ skein_digest_update_uio(skein_ctx_t *ctx, const crypto_data_t *data)
/*
* Now do the digesting on the iovecs.
*/
while (vec_idx < uio_iovcnt(uio) && length > 0) {
cur_len = MIN(uio_iovlen(uio, vec_idx) - offset, length);
SKEIN_OP(ctx, Update, (uint8_t *)uio_iovbase(uio, vec_idx)
while (vec_idx < zfs_uio_iovcnt(uio) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(uio, vec_idx) - offset, length);
SKEIN_OP(ctx, Update, (uint8_t *)zfs_uio_iovbase(uio, vec_idx)
+ offset, cur_len);
length -= cur_len;
vec_idx++;
offset = 0;
}
if (vec_idx == uio_iovcnt(uio) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(uio) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.
@@ -322,19 +322,19 @@ static int
skein_digest_final_uio(skein_ctx_t *ctx, crypto_data_t *digest,
crypto_req_handle_t req)
{
off_t offset = digest->cd_offset;
uint_t vec_idx = 0;
uio_t *uio = digest->cd_uio;
off_t offset = digest->cd_offset;
uint_t vec_idx = 0;
zfs_uio_t *uio = digest->cd_uio;
/* we support only kernel buffer */
if (uio_segflg(uio) != UIO_SYSSPACE)
if (zfs_uio_segflg(uio) != UIO_SYSSPACE)
return (CRYPTO_ARGUMENTS_BAD);
/*
* Jump to the first iovec containing ptr to the digest to be returned.
*/
offset = uio_index_at_offset(uio, offset, &vec_idx);
if (vec_idx == uio_iovcnt(uio)) {
offset = zfs_uio_index_at_offset(uio, offset, &vec_idx);
if (vec_idx == zfs_uio_iovcnt(uio)) {
/*
* The caller specified an offset that is larger than the
* total size of the buffers it provided.
@@ -342,10 +342,10 @@ skein_digest_final_uio(skein_ctx_t *ctx, crypto_data_t *digest,
return (CRYPTO_DATA_LEN_RANGE);
}
if (offset + CRYPTO_BITS2BYTES(ctx->sc_digest_bitlen) <=
uio_iovlen(uio, vec_idx)) {
zfs_uio_iovlen(uio, vec_idx)) {
/* The computed digest will fit in the current iovec. */
SKEIN_OP(ctx, Final,
(uchar_t *)uio_iovbase(uio, vec_idx) + offset);
(uchar_t *)zfs_uio_iovbase(uio, vec_idx) + offset);
} else {
uint8_t *digest_tmp;
off_t scratch_offset = 0;
@@ -357,11 +357,11 @@ skein_digest_final_uio(skein_ctx_t *ctx, crypto_data_t *digest,
if (digest_tmp == NULL)
return (CRYPTO_HOST_MEMORY);
SKEIN_OP(ctx, Final, digest_tmp);
while (vec_idx < uio_iovcnt(uio) && length > 0) {
cur_len = MIN(uio_iovlen(uio, vec_idx) - offset,
while (vec_idx < zfs_uio_iovcnt(uio) && length > 0) {
cur_len = MIN(zfs_uio_iovlen(uio, vec_idx) - offset,
length);
bcopy(digest_tmp + scratch_offset,
uio_iovbase(uio, vec_idx) + offset, cur_len);
zfs_uio_iovbase(uio, vec_idx) + offset, cur_len);
length -= cur_len;
vec_idx++;
@@ -370,7 +370,7 @@ skein_digest_final_uio(skein_ctx_t *ctx, crypto_data_t *digest,
}
kmem_free(digest_tmp, CRYPTO_BITS2BYTES(ctx->sc_digest_bitlen));
if (vec_idx == uio_iovcnt(uio) && length > 0) {
if (vec_idx == zfs_uio_iovcnt(uio) && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.