On 1/25/23 22:25, Janis Schoetterl-Glausch wrote:
The struct is quite large, so this seems nicer.
Signed-off-by: Janis Schoetterl-Glausch scgl@linux.ibm.com Reviewed-by: Thomas Huth thuth@redhat.com
Reviewed-by: Janosch Frank frankja@linux.ibm.com
tools/testing/selftests/kvm/s390x/memop.c | 44 +++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c index 3fd81e58f40c..9c05d1205114 100644 --- a/tools/testing/selftests/kvm/s390x/memop.c +++ b/tools/testing/selftests/kvm/s390x/memop.c @@ -48,53 +48,53 @@ struct mop_desc { uint8_t key; }; -static struct kvm_s390_mem_op ksmo_from_desc(struct mop_desc desc) +static struct kvm_s390_mem_op ksmo_from_desc(const struct mop_desc *desc) { struct kvm_s390_mem_op ksmo = {
.gaddr = (uintptr_t)desc.gaddr,
.size = desc.size,
.buf = ((uintptr_t)desc.buf),
.gaddr = (uintptr_t)desc->gaddr,
.size = desc->size,
.reserved = "ignored_ignored_ignored_ignored" };.buf = ((uintptr_t)desc->buf),
- switch (desc.target) {
- switch (desc->target) { case LOGICAL:
if (desc.mode == READ)
if (desc->mode == READ) ksmo.op = KVM_S390_MEMOP_LOGICAL_READ;
if (desc.mode == WRITE)
break; case SIDA:if (desc->mode == WRITE) ksmo.op = KVM_S390_MEMOP_LOGICAL_WRITE;
if (desc.mode == READ)
if (desc->mode == READ) ksmo.op = KVM_S390_MEMOP_SIDA_READ;
if (desc.mode == WRITE)
break; case ABSOLUTE:if (desc->mode == WRITE) ksmo.op = KVM_S390_MEMOP_SIDA_WRITE;
if (desc.mode == READ)
if (desc->mode == READ) ksmo.op = KVM_S390_MEMOP_ABSOLUTE_READ;
if (desc.mode == WRITE)
break; case INVALID: ksmo.op = -1; }if (desc->mode == WRITE) ksmo.op = KVM_S390_MEMOP_ABSOLUTE_WRITE;
- if (desc.f_check)
- if (desc->f_check) ksmo.flags |= KVM_S390_MEMOP_F_CHECK_ONLY;
- if (desc.f_inject)
- if (desc->f_inject) ksmo.flags |= KVM_S390_MEMOP_F_INJECT_EXCEPTION;
- if (desc._set_flags)
ksmo.flags = desc.set_flags;
- if (desc.f_key) {
- if (desc->_set_flags)
ksmo.flags = desc->set_flags;
- if (desc->f_key) { ksmo.flags |= KVM_S390_MEMOP_F_SKEY_PROTECTION;
ksmo.key = desc.key;
}ksmo.key = desc->key;
- if (desc._ar)
ksmo.ar = desc.ar;
- if (desc->_ar)
else ksmo.ar = 0;ksmo.ar = desc->ar;
- if (desc._sida_offset)
ksmo.sida_offset = desc.sida_offset;
- if (desc->_sida_offset)
ksmo.sida_offset = desc->sida_offset;
return ksmo; } @@ -183,7 +183,7 @@ static int err_memop_ioctl(struct test_info info, struct kvm_s390_mem_op *ksmo) else \ __desc.gaddr = __desc.gaddr_v; \ } \
- __ksmo = ksmo_from_desc(__desc); \
- __ksmo = ksmo_from_desc(&__desc); \ print_memop(__info.vcpu, &__ksmo); \ err##memop_ioctl(__info, &__ksmo); \ })