Re: [PATCH v6 01/14] KVM: s390: selftest: memop: Pass mop_desc via pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>

Reviewed-by: Janosch Frank <frankja@xxxxxxxxxxxxx>

---
  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,
+		.buf = ((uintptr_t)desc->buf),
  		.reserved = "ignored_ignored_ignored_ignored"
  	};
- 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)
+		if (desc->mode == WRITE)
  			ksmo.op = KVM_S390_MEMOP_LOGICAL_WRITE;
  		break;
  	case SIDA:
-		if (desc.mode == READ)
+		if (desc->mode == READ)
  			ksmo.op = KVM_S390_MEMOP_SIDA_READ;
-		if (desc.mode == WRITE)
+		if (desc->mode == WRITE)
  			ksmo.op = KVM_S390_MEMOP_SIDA_WRITE;
  		break;
  	case ABSOLUTE:
-		if (desc.mode == READ)
+		if (desc->mode == READ)
  			ksmo.op = KVM_S390_MEMOP_ABSOLUTE_READ;
-		if (desc.mode == WRITE)
+		if (desc->mode == WRITE)
  			ksmo.op = KVM_S390_MEMOP_ABSOLUTE_WRITE;
  		break;
  	case INVALID:
  		ksmo.op = -1;
  	}
-	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)
+		ksmo.ar = desc->ar;
  	else
  		ksmo.ar = 0;
-	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);					\
  })




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux