Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/icp/algs/modes/modes.c
Show All 37 Lines | crypto_init_ptrs(crypto_data_t *out, void **iov_or_mp, offset_t *current_offset) | ||||
offset_t offset; | offset_t offset; | ||||
switch (out->cd_format) { | switch (out->cd_format) { | ||||
case CRYPTO_DATA_RAW: | case CRYPTO_DATA_RAW: | ||||
*current_offset = out->cd_offset; | *current_offset = out->cd_offset; | ||||
break; | break; | ||||
case CRYPTO_DATA_UIO: { | case CRYPTO_DATA_UIO: { | ||||
uio_t *uiop = out->cd_uio; | zfs_uio_t *uiop = out->cd_uio; | ||||
uint_t vec_idx; | uint_t vec_idx; | ||||
offset = out->cd_offset; | 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; | *current_offset = offset; | ||||
*iov_or_mp = (void *)(uintptr_t)vec_idx; | *iov_or_mp = (void *)(uintptr_t)vec_idx; | ||||
break; | break; | ||||
} | } | ||||
} /* end switch */ | } /* end switch */ | ||||
} | } | ||||
Show All 21 Lines | if ((offset + amt) <= iov->iov_len) { | ||||
*out_data_1_len = amt; | *out_data_1_len = amt; | ||||
*out_data_2 = NULL; | *out_data_2 = NULL; | ||||
*current_offset = offset + amt; | *current_offset = offset + amt; | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
case CRYPTO_DATA_UIO: { | case CRYPTO_DATA_UIO: { | ||||
uio_t *uio = out->cd_uio; | zfs_uio_t *uio = out->cd_uio; | ||||
offset_t offset; | offset_t offset; | ||||
uint_t vec_idx; | uint_t vec_idx; | ||||
uint8_t *p; | uint8_t *p; | ||||
uint64_t iov_len; | uint64_t iov_len; | ||||
void *iov_base; | void *iov_base; | ||||
offset = *current_offset; | offset = *current_offset; | ||||
vec_idx = (uintptr_t)(*iov_or_mp); | 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; | p = (uint8_t *)iov_base + offset; | ||||
*out_data_1 = p; | *out_data_1 = p; | ||||
if (offset + amt <= iov_len) { | if (offset + amt <= iov_len) { | ||||
/* can fit one block into this iov */ | /* can fit one block into this iov */ | ||||
*out_data_1_len = amt; | *out_data_1_len = amt; | ||||
*out_data_2 = NULL; | *out_data_2 = NULL; | ||||
*current_offset = offset + amt; | *current_offset = offset + amt; | ||||
} else { | } else { | ||||
/* one block spans two iovecs */ | /* one block spans two iovecs */ | ||||
*out_data_1_len = iov_len - offset; | *out_data_1_len = iov_len - offset; | ||||
if (vec_idx == uio_iovcnt(uio)) | if (vec_idx == zfs_uio_iovcnt(uio)) | ||||
return; | return; | ||||
vec_idx++; | 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; | *out_data_2 = (uint8_t *)iov_base; | ||||
*current_offset = amt - *out_data_1_len; | *current_offset = amt - *out_data_1_len; | ||||
} | } | ||||
*iov_or_mp = (void *)(uintptr_t)vec_idx; | *iov_or_mp = (void *)(uintptr_t)vec_idx; | ||||
break; | break; | ||||
} | } | ||||
} /* end switch */ | } /* end switch */ | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |