From nobody Mon Nov 17 16:05:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604510766; cv=none; d=zohomail.com; s=zohoarc; b=mEKC0YI3i7HUJMdvk3PKQ2tiaa/6AcZBpLZSje6p66wmVlIX2gRlO043QgQBrF2f+oWSYgHEHOooQFuL2++Ab2ZpPNbGHPklcAqZMtoIdDEGZ100RA0K7vKfzC7jTCsm1dst1Fk02PxNwD240gFISVHK3a/AF6qo/EU3lw4Rfrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604510766; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qH+Ft2xr8oMmaql/QpsL3d2WQdY3tolquMseQzbcMBo=; b=BpAY3+VCQtQvCM/FCdZO4TAR7ju940gk+Q3WR9jfMtiURHZ7xrkvSiJfXWfjwAbg1XC49387ehtzoKyrN5/8Om/wSJV+yJbKZkfte6ifW9PkpbBgwo56SJJcBRgYYU7J9XHbD6FOl2CueJ1/Xh96IcQEWBIIC2dK5yDZAwfaGJE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1604510766760467.35975449246007; Wed, 4 Nov 2020 09:26:06 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.19440.44636 (Exim 4.92) (envelope-from ) id 1kaMXW-0004yW-O1; Wed, 04 Nov 2020 17:25:42 +0000 Received: by outflank-mailman (output) from mailman id 19440.44636; Wed, 04 Nov 2020 17:25:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kaMXW-0004yP-Kt; Wed, 04 Nov 2020 17:25:42 +0000 Received: by outflank-mailman (input) for mailman id 19440; Wed, 04 Nov 2020 17:25:41 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kaMXV-0004yK-0m for xen-devel@lists.xenproject.org; Wed, 04 Nov 2020 17:25:41 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 38d4fb6b-17e7-4f7b-aae3-b74dfee7aad7; Wed, 04 Nov 2020 17:25:36 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-BliftGsjOkqSm4-6LQDSYg-1; Wed, 04 Nov 2020 12:25:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 488668049CB; Wed, 4 Nov 2020 17:25:29 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A6315C5DE; Wed, 4 Nov 2020 17:25:21 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kaMXV-0004yK-0m for xen-devel@lists.xenproject.org; Wed, 04 Nov 2020 17:25:41 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 38d4fb6b-17e7-4f7b-aae3-b74dfee7aad7; Wed, 04 Nov 2020 17:25:36 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-BliftGsjOkqSm4-6LQDSYg-1; Wed, 04 Nov 2020 12:25:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 488668049CB; Wed, 4 Nov 2020 17:25:29 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A6315C5DE; Wed, 4 Nov 2020 17:25:21 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 38d4fb6b-17e7-4f7b-aae3-b74dfee7aad7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604510736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qH+Ft2xr8oMmaql/QpsL3d2WQdY3tolquMseQzbcMBo=; b=Q6SJsWvvVfwUxbPJ+GeFpNT1OqX3Ek8gG8m/Ht3CmiDLQLp/3+MtklHRZb6U0sJOVQBGB8 udaOPbtYX1035iDVckbRvArURWgq/hT4y9g2wLOKgAQXywtHMj1T2GeSuOohlZkFG+lldH LjX9mW8VV1wm5uc+/J4q3/jNz8xq9UI= X-MC-Unique: BliftGsjOkqSm4-6LQDSYg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Cc: Igor Mammedov , "Daniel P. Berrange" , Paolo Bonzini , Stefan Berger , Stefano Stabellini , Anthony Perard , Paul Durrant , Kevin Wolf , Max Reitz , Richard Henderson , David Hildenbrand , Cornelia Huck , Thomas Huth , Halil Pasic , Christian Borntraeger , Matthew Rosato , Alex Williamson , Mark Cave-Ayland , Artyom Tarasenko , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH 4/7] qom: Replace void* parameter with Property* on field getters/setters Date: Wed, 4 Nov 2020 12:25:09 -0500 Message-Id: <20201104172512.2381656-5-ehabkost@redhat.com> In-Reply-To: <20201104172512.2381656-1-ehabkost@redhat.com> References: <20201104172512.2381656-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) All field property getters and setters must interpret the fourth argument as Property*. Change the function signature of field property getters and setters to indicate that. Signed-off-by: Eduardo Habkost Acked-by: Cornelia Huck --- Cc: Stefan Berger Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paul Durrant Cc: Kevin Wolf Cc: Max Reitz Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: Richard Henderson Cc: David Hildenbrand Cc: Cornelia Huck Cc: Thomas Huth Cc: Halil Pasic Cc: Christian Borntraeger Cc: Matthew Rosato Cc: Alex Williamson Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org Cc: qemu-block@nongnu.org Cc: qemu-s390x@nongnu.org --- include/qom/field-property-internal.h | 8 +- include/qom/field-property.h | 26 ++++--- backends/tpm/tpm_util.c | 11 ++- hw/block/xen-block.c | 6 +- hw/core/qdev-properties-system.c | 86 +++++++++------------- hw/s390x/css.c | 6 +- hw/s390x/s390-pci-bus.c | 6 +- hw/vfio/pci-quirks.c | 10 +-- qom/property-types.c | 102 +++++++++----------------- target/sparc/cpu.c | 4 +- 10 files changed, 105 insertions(+), 160 deletions(-) diff --git a/include/qom/field-property-internal.h b/include/qom/field-prop= erty-internal.h index 7aa27ce836..bc7d25033d 100644 --- a/include/qom/field-property-internal.h +++ b/include/qom/field-property-internal.h @@ -9,9 +9,9 @@ #define QOM_STATIC_PROPERTY_INTERNAL_H =20 void field_prop_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); + Property *prop, Error **errp); void field_prop_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); + Property *prop, Error **errp); =20 void field_prop_set_default_value_enum(ObjectProperty *op, const Property *prop); @@ -21,9 +21,9 @@ void field_prop_set_default_value_uint(ObjectProperty *op, const Property *prop); =20 void field_prop_get_int32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); + Property *prop, Error **errp); void field_prop_get_size32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); + Property *prop, Error **errp); =20 /** * object_property_add_field: Add a field property to an object instance diff --git a/include/qom/field-property.h b/include/qom/field-property.h index e64a2b3c07..438bb25896 100644 --- a/include/qom/field-property.h +++ b/include/qom/field-property.h @@ -54,6 +54,18 @@ struct Property { const char *link_type; }; =20 +/** + * typedef FieldAccessor: a field property getter or setter function + * @obj: the object instance + * @v: the visitor that contains the property data + * @name: the name of the property + * @prop: Field property definition + * @errp: pointer to error information + */ +typedef void FieldAccessor(Object *obj, Visitor *v, + const char *name, Property *prop, + Error **errp); + /** * struct PropertyInfo: information on a specific QOM property type */ @@ -71,16 +83,10 @@ struct PropertyInfo { /** @create: Optional callback for creation of property */ ObjectProperty *(*create)(ObjectClass *oc, const char *name, Property *prop); - /** - * @get: Property getter. The opaque parameter will point to - * the &Property struct for the property. - */ - ObjectPropertyAccessor *get; - /** - * @set: Property setter. The opaque parameter will point to - * the &Property struct for the property. - */ - ObjectPropertyAccessor *set; + /** @get: Property getter */ + FieldAccessor *get; + /** @set: Property setter */ + FieldAccessor *set; /** * @release: Optional release function, called when the object * is destroyed diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index bb1ab34a75..e8837938e5 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -32,10 +32,10 @@ =20 /* tpm backend property */ =20 -static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaqu= e, - Error **errp) +static void get_tpm(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - TPMBackend **be =3D object_field_prop_ptr(obj, opaque); + TPMBackend **be =3D object_field_prop_ptr(obj, prop); char *p; =20 p =3D g_strdup(*be ? (*be)->id : ""); @@ -43,10 +43,9 @@ static void get_tpm(Object *obj, Visitor *v, const char = *name, void *opaque, g_free(p); } =20 -static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaqu= e, - Error **errp) +static void set_tpm(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; TPMBackend *s, **be =3D object_field_prop_ptr(obj, prop); char *str; =20 diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 718d886e5c..c1ee634639 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -333,9 +333,8 @@ static char *disk_to_vbd_name(unsigned int disk) } =20 static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; XenBlockVdev *vdev =3D object_field_prop_ptr(obj, prop); char *str; =20 @@ -393,9 +392,8 @@ static int vbd_name_to_disk(const char *name, const cha= r **endp, } =20 static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; XenBlockVdev *vdev =3D object_field_prop_ptr(obj, prop); char *str, *p; const char *end; diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 8da68f076c..4c649cb4b2 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -58,10 +58,9 @@ static bool check_prop_still_unset(Object *obj, const ch= ar *name, =20 /* --- drive --- */ =20 -static void get_drive(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) +static void get_drive(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; void **ptr =3D object_field_prop_ptr(obj, prop); const char *value; char *p; @@ -165,16 +164,16 @@ fail: g_free(str); } =20 -static void set_drive(Object *obj, Visitor *v, const char *name, void *opa= que, +static void set_drive(Object *obj, Visitor *v, const char *name, Property = *prop, Error **errp) { - set_drive_helper(obj, v, name, opaque, false, errp); + set_drive_helper(obj, v, name, prop, false, errp); } =20 static void set_drive_iothread(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - set_drive_helper(obj, v, name, opaque, true, errp); + set_drive_helper(obj, v, name, prop, true, errp); } =20 static void release_drive(Object *obj, const char *name, void *opaque) @@ -211,10 +210,10 @@ const PropertyInfo qdev_prop_drive_iothread =3D { =20 /* --- character device --- */ =20 -static void get_chr(Object *obj, Visitor *v, const char *name, void *opaqu= e, - Error **errp) +static void get_chr(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - CharBackend *be =3D object_field_prop_ptr(obj, opaque); + CharBackend *be =3D object_field_prop_ptr(obj, prop); char *p; =20 p =3D g_strdup(be->chr && be->chr->label ? be->chr->label : ""); @@ -222,10 +221,9 @@ static void get_chr(Object *obj, Visitor *v, const cha= r *name, void *opaque, g_free(p); } =20 -static void set_chr(Object *obj, Visitor *v, const char *name, void *opaqu= e, - Error **errp) +static void set_chr(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; CharBackend *be =3D object_field_prop_ptr(obj, prop); Chardev *s; char *str; @@ -282,10 +280,9 @@ const PropertyInfo qdev_prop_chr =3D { * 01:02:03:04:05:06 * 01-02-03-04-05-06 */ -static void get_mac(Object *obj, Visitor *v, const char *name, void *opaqu= e, - Error **errp) +static void get_mac(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; MACAddr *mac =3D object_field_prop_ptr(obj, prop); char buffer[2 * 6 + 5 + 1]; char *p =3D buffer; @@ -297,10 +294,9 @@ static void get_mac(Object *obj, Visitor *v, const cha= r *name, void *opaque, visit_type_str(v, name, &p, errp); } =20 -static void set_mac(Object *obj, Visitor *v, const char *name, void *opaqu= e, - Error **errp) +static void set_mac(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; MACAddr *mac =3D object_field_prop_ptr(obj, prop); int i, pos; char *str; @@ -360,9 +356,8 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char= *name, =20 /* --- netdev device --- */ static void get_netdev(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; NICPeers *peers_ptr =3D object_field_prop_ptr(obj, prop); char *p =3D g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : ""); =20 @@ -371,9 +366,8 @@ static void get_netdev(Object *obj, Visitor *v, const c= har *name, } =20 static void set_netdev(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; NICPeers *peers_ptr =3D object_field_prop_ptr(obj, prop); NetClientState **ncs =3D peers_ptr->ncs; NetClientState *peers[MAX_QUEUE_NUM]; @@ -433,9 +427,8 @@ const PropertyInfo qdev_prop_netdev =3D { =20 /* --- audiodev --- */ static void get_audiodev(Object *obj, Visitor *v, const char* name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); char *p =3D g_strdup(audio_get_id(card)); =20 @@ -444,9 +437,8 @@ static void get_audiodev(Object *obj, Visitor *v, const= char* name, } =20 static void set_audiodev(Object *obj, Visitor *v, const char* name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); AudioState *state; int err =3D 0; @@ -545,10 +537,9 @@ const PropertyInfo qdev_prop_losttickpolicy =3D { /* --- blocksize --- */ =20 static void set_blocksize(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { DeviceState *dev =3D DEVICE(obj); - Property *prop =3D opaque; uint32_t *ptr =3D object_field_prop_ptr(obj, prop); uint64_t value; Error *local_err =3D NULL; @@ -634,9 +625,8 @@ const PropertyInfo qdev_prop_multifd_compression =3D { * and type is a non-negative decimal integer */ static void get_reserved_region(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; ReservedRegion *rr =3D object_field_prop_ptr(obj, prop); char buffer[64]; char *p =3D buffer; @@ -650,9 +640,8 @@ static void get_reserved_region(Object *obj, Visitor *v= , const char *name, } =20 static void set_reserved_region(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; ReservedRegion *rr =3D object_field_prop_ptr(obj, prop); Error *local_err =3D NULL; const char *endptr; @@ -712,9 +701,8 @@ const PropertyInfo qdev_prop_reserved_region =3D { * bus-local address, i.e. "$slot" or "$slot.$fn" */ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; int32_t value, *ptr =3D object_field_prop_ptr(obj, prop); unsigned int slot, fn, n; char *str; @@ -774,9 +762,8 @@ const PropertyInfo qdev_prop_pci_devfn =3D { /* --- pci host address --- */ =20 static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; PCIHostDeviceAddress *addr =3D object_field_prop_ptr(obj, prop); char buffer[] =3D "ffff:ff:ff.f"; char *p =3D buffer; @@ -800,9 +787,8 @@ static void get_pci_host_devaddr(Object *obj, Visitor *= v, const char *name, * if is not supplied, it's assumed to be 0. */ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; PCIHostDeviceAddress *addr =3D object_field_prop_ptr(obj, prop); char *str, *p; const char *e; @@ -889,9 +875,8 @@ const PropertyInfo qdev_prop_off_auto_pcibar =3D { /* --- PCIELinkSpeed 2_5/5/8/16 -- */ =20 static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; PCIExpLinkSpeed *p =3D object_field_prop_ptr(obj, prop); int speed; =20 @@ -917,9 +902,8 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor= *v, const char *name, } =20 static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; PCIExpLinkSpeed *p =3D object_field_prop_ptr(obj, prop); int speed; =20 @@ -959,9 +943,8 @@ const PropertyInfo qdev_prop_pcie_link_speed =3D { /* --- PCIELinkWidth 1/2/4/8/12/16/32 -- */ =20 static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; PCIExpLinkWidth *p =3D object_field_prop_ptr(obj, prop); int width; =20 @@ -996,9 +979,8 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor= *v, const char *name, } =20 static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; PCIExpLinkWidth *p =3D object_field_prop_ptr(obj, prop); int width; =20 @@ -1046,10 +1028,9 @@ const PropertyInfo qdev_prop_pcie_link_width =3D { =20 /* --- UUID --- */ =20 -static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) +static void get_uuid(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; QemuUUID *uuid =3D object_field_prop_ptr(obj, prop); char buffer[UUID_FMT_LEN + 1]; char *p =3D buffer; @@ -1061,10 +1042,9 @@ static void get_uuid(Object *obj, Visitor *v, const = char *name, void *opaque, =20 #define UUID_VALUE_AUTO "auto" =20 -static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) +static void set_uuid(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; QemuUUID *uuid =3D object_field_prop_ptr(obj, prop); char *str; =20 diff --git a/hw/s390x/css.c b/hw/s390x/css.c index fe47751df4..1400d80689 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2341,9 +2341,8 @@ void css_reset(void) } =20 static void get_css_devid(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; CssDevId *dev_id =3D object_field_prop_ptr(obj, prop); char buffer[] =3D "xx.x.xxxx"; char *p =3D buffer; @@ -2370,9 +2369,8 @@ static void get_css_devid(Object *obj, Visitor *v, co= nst char *name, * parse .. and assert valid range for cssid/ssid */ static void set_css_devid(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; CssDevId *dev_id =3D object_field_prop_ptr(obj, prop); char *str; int num, n1, n2; diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 99b18d56ba..a29bba17b4 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1320,19 +1320,17 @@ static void s390_pci_device_reset(DeviceState *dev) } =20 static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } =20 static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { S390PCIBusDevice *zpci =3D S390_PCI_DEVICE(obj); - Property *prop =3D opaque; uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 if (!visit_type_uint32(v, name, ptr, errp)) { diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index fc8d63c850..34f5f5dce2 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1485,20 +1485,18 @@ void vfio_setup_resetfn_quirk(VFIOPCIDevice *vdev) * https://lists.gnu.org/archive/html/qemu-devel/2017-08/pdfUda5iEpgOS.pdf */ static void get_nv_gpudirect_clique_id(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) + const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; uint8_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); } =20 static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) + const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; uint8_t value, *ptr =3D object_field_prop_ptr(obj, prop); =20 if (!visit_type_uint8(v, name, &value, errp)) { diff --git a/qom/property-types.c b/qom/property-types.c index 856b5ae76d..82a5932f4a 100644 --- a/qom/property-types.c +++ b/qom/property-types.c @@ -8,18 +8,16 @@ #include "qemu/uuid.h" =20 void field_prop_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; int *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } =20 void field_prop_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; int *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_enum(v, name, ptr, prop->info->enum_table, errp); @@ -59,9 +57,8 @@ static void bit_prop_set(Object *obj, Property *props, bo= ol val) } =20 static void prop_get_bit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint32_t *p =3D object_field_prop_ptr(obj, prop); bool value =3D (*p & qdev_get_prop_mask(prop)) !=3D 0; =20 @@ -69,9 +66,8 @@ static void prop_get_bit(Object *obj, Visitor *v, const c= har *name, } =20 static void prop_set_bit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; bool value; =20 if (!visit_type_bool(v, name, &value, errp)) { @@ -113,9 +109,8 @@ static void bit64_prop_set(Object *obj, Property *props= , bool val) } =20 static void prop_get_bit64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint64_t *p =3D object_field_prop_ptr(obj, prop); bool value =3D (*p & qdev_get_prop_mask64(prop)) !=3D 0; =20 @@ -123,9 +118,8 @@ static void prop_get_bit64(Object *obj, Visitor *v, con= st char *name, } =20 static void prop_set_bit64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; bool value; =20 if (!visit_type_bool(v, name, &value, errp)) { @@ -144,19 +138,17 @@ const PropertyInfo prop_info_bit64 =3D { =20 /* --- bool --- */ =20 -static void get_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) +static void get_bool(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; bool *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_bool(v, name, ptr, errp); } =20 -static void set_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) +static void set_bool(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; bool *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_bool(v, name, ptr, errp); @@ -171,19 +163,17 @@ const PropertyInfo prop_info_bool =3D { =20 /* --- 8bit integer --- */ =20 -static void get_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) +static void get_uint8(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; uint8_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); } =20 -static void set_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) +static void set_uint8(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; uint8_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); @@ -211,18 +201,16 @@ const PropertyInfo prop_info_uint8 =3D { /* --- 16bit integer --- */ =20 static void get_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint16_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint16(v, name, ptr, errp); } =20 static void set_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint16_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint16(v, name, ptr, errp); @@ -238,36 +226,32 @@ const PropertyInfo prop_info_uint16 =3D { /* --- 32bit integer --- */ =20 static void get_uint32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } =20 static void set_uint32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } =20 void field_prop_get_int32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; int32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int32(v, name, ptr, errp); } =20 -static void set_int32(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) +static void set_int32(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; int32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int32(v, name, ptr, errp); @@ -290,36 +274,32 @@ const PropertyInfo prop_info_int32 =3D { /* --- 64bit integer --- */ =20 static void get_uint64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint64(v, name, ptr, errp); } =20 static void set_uint64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint64(v, name, ptr, errp); } =20 static void get_int64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; int64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int64(v, name, ptr, errp); } =20 static void set_int64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; int64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int64(v, name, ptr, errp); @@ -348,9 +328,8 @@ static void release_string(Object *obj, const char *nam= e, void *opaque) } =20 static void get_string(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; char **ptr =3D object_field_prop_ptr(obj, prop); =20 if (!*ptr) { @@ -362,9 +341,8 @@ static void get_string(Object *obj, Visitor *v, const c= har *name, } =20 static void set_string(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; char **ptr =3D object_field_prop_ptr(obj, prop); char *str; =20 @@ -396,19 +374,17 @@ const PropertyInfo prop_info_on_off_auto =3D { /* --- 32bit unsigned int 'size' type --- */ =20 void field_prop_get_size32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - Property *prop =3D opaque; uint32_t *ptr =3D object_field_prop_ptr(obj, prop); uint64_t value =3D *ptr; =20 visit_type_size(v, name, &value, errp); } =20 -static void set_size32(Object *obj, Visitor *v, const char *name, void *op= aque, - Error **errp) +static void set_size32(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; uint32_t *ptr =3D object_field_prop_ptr(obj, prop); uint64_t value; =20 @@ -437,14 +413,8 @@ const PropertyInfo prop_info_size32 =3D { /* --- support for array properties --- */ =20 static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { - /* Setter for the property which defines the length of a - * variable-sized property array. As well as actually setting the - * array-length field in the device struct, we have to create the - * array itself and dynamically add the corresponding properties. - */ - Property *prop =3D opaque; ObjectProperty *op =3D object_property_find_err(obj, name, &error_abor= t); uint32_t *alenptr =3D object_field_prop_ptr(obj, prop); void **arrayptr =3D (void *)obj + prop->arrayoffset; @@ -500,19 +470,17 @@ const PropertyInfo prop_info_arraylen =3D { =20 /* --- 64bit unsigned int 'size' type --- */ =20 -static void get_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) +static void get_size(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_size(v, name, ptr, errp); } =20 -static void set_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) +static void set_size(Object *obj, Visitor *v, const char *name, + Property *prop, Error **errp) { - Property *prop =3D opaque; uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_size(v, name, ptr, errp); diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 5a9397f19a..3acc99c29c 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -787,7 +787,7 @@ static void sparc_cpu_initfn(Object *obj) } =20 static void sparc_get_nwindows(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { SPARCCPU *cpu =3D SPARC_CPU(obj); int64_t value =3D cpu->env.def.nwindows; @@ -796,7 +796,7 @@ static void sparc_get_nwindows(Object *obj, Visitor *v,= const char *name, } =20 static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + Property *prop, Error **errp) { const int64_t min =3D MIN_NWINDOWS; const int64_t max =3D MAX_NWINDOWS; --=20 2.28.0