From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607724560; cv=none; d=zohomail.com; s=zohoarc; b=K0tElm4SfIUtwieHOQF4dituq7Bxax1wt9UeP09qmEinUJGZFpZPFBazcpCaxKd6+1hz6+xXVqH2U6TdzuCwpQo48jdg8w4ck/MWC6qFFKKZtXSiOFXPmh9+hmhDFhe2iEYELoj7yC0upgoaaP8uymqgfhzcdRCrW+MK6adZx0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724560; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/Phk3lo4bzx8IV8gpStB5TCCGVdAThN5k/nbEt7JmcM=; b=H7C3Yc4RbueaUECu6vCFgxJH5Cv8hREDrZGmRkuf1+7cP/iteDQb4o429bhJuLXgJqkq9g9MmMysYJlojFdQ8bk4myZzZTap3SztV1LgBHPoXhVJOhnYDNHi6qSstJvfPQ2BhaWD+NUIgZ8C7gFqVri9Y1rW2iqzrk+z9JMC8uU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607724560512622.1507046753422; Fri, 11 Dec 2020 14:09:20 -0800 (PST) Received: from localhost ([::1]:40548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqbG-0003Pa-Ih for importer@patchew.org; Fri, 11 Dec 2020 17:09:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqXx-0001bU-3B for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42346) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqXr-0006DI-9U for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:51 -0500 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-314-EMkkuT45PkGP4-JpngWD8Q-1; Fri, 11 Dec 2020 17:05:43 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99B6319251A0; Fri, 11 Dec 2020 22:05:42 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9715C19C78; Fri, 11 Dec 2020 22:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724345; 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=/Phk3lo4bzx8IV8gpStB5TCCGVdAThN5k/nbEt7JmcM=; b=LTW8EASnFBLyjVP2KnxnDX0M47o7lxfUz/0z038lwYuqo1LRGIZeThHDsrSddC4oLDvSI+ duV46FEMdV5g6JZrTChicr3Q87YdNEnOB1MMrZdKF+zqDbSETIft1wh9jFLGiJ2/GEtzgY e4yjQyX2zt0PKV9AwvGN7Q9JqBNRS4w= X-MC-Unique: EMkkuT45PkGP4-JpngWD8Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 01/32] cs4231: Get rid of empty property array Date: Fri, 11 Dec 2020 17:04:58 -0500 Message-Id: <20201211220529.2290218-2-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) An empty props array is unnecessary, we can just not call device_class_set_props(). Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Gerd Hoffmann Cc: qemu-devel@nongnu.org --- hw/audio/cs4231.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c index 8e9554ce9b..209c05a0a0 100644 --- a/hw/audio/cs4231.c +++ b/hw/audio/cs4231.c @@ -160,17 +160,12 @@ static void cs4231_init(Object *obj) sysbus_init_irq(dev, &s->irq); } =20 -static Property cs4231_properties[] =3D { - {.name =3D NULL}, -}; - static void cs4231_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->reset =3D cs_reset; dc->vmsd =3D &vmstate_cs4231; - device_class_set_props(dc, cs4231_properties); } =20 static const TypeInfo cs4231_info =3D { --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607724679; cv=none; d=zohomail.com; s=zohoarc; b=lE5W3QBwh2CEzpFpFIDMA2oyLHQS9R2oW3KeaZ0u0LJ16xi9/Dt9jwktbmx2Eteq+Fb+prhFeagUY1I5L22BDxziYclOgTubNkG2+Ncq0TbfjKpKQLCv4uax8W9UsVtI5YpvyaZFjZn/0owuXxhCQchpDtiHhlY4MZUkRI76nZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724679; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rc36MnKM7EYTaZ8lMBRn2cvGDZYW3v3kepUjkeKaXDs=; b=RDuu8ld3TM3PLkSeHCSBmdzXwmH8N4rAhqOUACTCntLYuYbH0N+qDc6To3K+T7txnTet8dlr5mZhrKBPuF/sT41+E6DYGGnSggP5sqttZPtCnS/c1VUjZ1HyoSCyL5YqX/CbK3GRuWZ9MXSwhU4UwuX0KNw2a6M1XvZ9Pt1/O+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607724679108725.2825258785532; Fri, 11 Dec 2020 14:11:19 -0800 (PST) Received: from localhost ([::1]:43562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqdC-0004mK-0o for importer@patchew.org; Fri, 11 Dec 2020 17:11:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqXw-0001bY-LY for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqXs-0006Dv-3c for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:52 -0500 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-272-hts_MbbONOaPddm7kfLU1g-1; Fri, 11 Dec 2020 17:05:45 -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 0D3DDC296; Fri, 11 Dec 2020 22:05:44 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98C735C8AA; Fri, 11 Dec 2020 22:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724346; 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=rc36MnKM7EYTaZ8lMBRn2cvGDZYW3v3kepUjkeKaXDs=; b=eaUHazA4JBoQ23sRuKmaDFUjujbmYE6ywKT5d1A3Z0WC+X9CFU/UxMo7PPa+sCz9vZCn6Z G2rNfAjbH6q0Pgbdfjws6aXPy+r3InPFL6HEJNoHUxLIkM+gKCS8z+7eTZgOvvwcKFuu9k KYKKzVm/u1mWsgsfwHHnLcSaZ7vY8UA= X-MC-Unique: hts_MbbONOaPddm7kfLU1g-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 02/32] cpu: Move cpu_common_props to hw/core/cpu.c Date: Fri, 11 Dec 2020 17:04:59 -0500 Message-Id: <20201211220529.2290218-3-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There's no reason to keep the property list separate from the CPU class code. Move the variable to hw/core/cpu.c and make it static. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: qemu-devel@nongnu.org --- include/hw/core/cpu.h | 1 - cpu.c | 15 --------------- hw/core/cpu.c | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 3d92c967ff..8e7552910d 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1111,7 +1111,6 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, in= t asidx); =20 void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -extern Property cpu_common_props[]; void cpu_exec_initfn(CPUState *cpu); void cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); diff --git a/cpu.c b/cpu.c index 0be5dcb6f3..0c485cdf2d 100644 --- a/cpu.c +++ b/cpu.c @@ -144,21 +144,6 @@ void cpu_exec_unrealizefn(CPUState *cpu) #endif } =20 -Property cpu_common_props[] =3D { -#ifndef CONFIG_USER_ONLY - /* Create a memory property for softmmu CPU object, - * so users can wire up its memory. (This can't go in hw/core/cpu.c - * because that file is compiled only once for both user-mode - * and system builds.) The default if no link is set up is to use - * the system address space. - */ - DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, - MemoryRegion *), -#endif - DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, fal= se), - DEFINE_PROP_END_OF_LIST(), -}; - void cpu_exec_initfn(CPUState *cpu) { cpu->as =3D NULL; diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 576fa1d7ba..5c89c858aa 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -393,6 +393,21 @@ static vaddr cpu_adjust_watchpoint_address(CPUState *c= pu, vaddr addr, int len) return addr; } =20 +static Property cpu_common_props[] =3D { +#ifndef CONFIG_USER_ONLY + /* Create a memory property for softmmu CPU object, + * so users can wire up its memory. (This can't go in hw/core/cpu.c + * because that file is compiled only once for both user-mode + * and system builds.) The default if no link is set up is to use + * the system address space. + */ + DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, + MemoryRegion *), +#endif + DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, fal= se), + DEFINE_PROP_END_OF_LIST(), +}; + static void cpu_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607724893; cv=none; d=zohomail.com; s=zohoarc; b=E+56SeZ7xzTmyWaaZ227DwsaaNk92RX3LoE5hE42gPzB4x8EKL8EO5gR19JLWLyFOVrOVCNoh+4JSxzL4/LSgAKtF1lTBJ0L11APWBFv6jKcfYYAQdh88m2pD2pr/gdyj7rUwU46UynLMAbyHhOtOWjGwWD9zgBJOnxLI+ObvrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724893; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6VgW1WJzNx3ziSLIiqjF5nUJXSkAS2F3VOXub7WDYto=; b=IUnNMWe+099wZ2Zb85H5Zuy/wLR97k66UWkJCT4SSR/QcPcIyTnXAWyYLA9xrSFP4urJoMKXnRPxEy2iSA+TkkfkukabJSwkbMEedXmePV4KSXVZGrFn1Wh6Cc45r1UNqFe9OHsIYWJUTycBoyKK90JlqdDFq/b3e33LXyYmE8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607724893149116.54205245335822; Fri, 11 Dec 2020 14:14:53 -0800 (PST) Received: from localhost ([::1]:49224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqgd-0007S8-Ib for importer@patchew.org; Fri, 11 Dec 2020 17:14:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqXz-0001cz-PI for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45883) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqXw-0006F8-HJ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:55 -0500 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-275-F9eXSwzCMUus9MNoPr-ICQ-1; Fri, 11 Dec 2020 17:05:49 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C531107ACE3; Fri, 11 Dec 2020 22:05:48 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5E875D9E2; Fri, 11 Dec 2020 22:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724351; 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=6VgW1WJzNx3ziSLIiqjF5nUJXSkAS2F3VOXub7WDYto=; b=CTjY4toh4p+csuEbtQqARf401YFvkcGwZjK2UW38rpJwqRZLwatHm/QXzVbJO1mejyUv/+ Xtzdb+0PA6kkF2V+lHUrt/dQVR+13MiMjXvdowgJgel7fkf4pm+wtG3oMc7pk6AJ0Xkejy /0qW7VEkrEW8qGscjGoyYMUbE9qZykI= X-MC-Unique: F9eXSwzCMUus9MNoPr-ICQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 03/32] qdev: Move property code to qdev-properties.[ch] Date: Fri, 11 Dec 2020 17:05:00 -0500 Message-Id: <20201211220529.2290218-4-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Move everything related to Property and PropertyInfo to qdev-properties.[ch] to make it easier to refactor that code. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-core.h | 37 ----------- include/hw/qdev-properties.h | 38 +++++++++++ hw/core/qdev-properties.c | 120 +++++++++++++++++++++++++++++++++++ hw/core/qdev.c | 120 ----------------------------------- softmmu/qdev-monitor.c | 1 + 5 files changed, 159 insertions(+), 157 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 9fbb22a48d..8f91faebc3 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -276,43 +276,6 @@ struct BusState { ResettableState reset; }; =20 -/** - * Property: - * @set_default: true if the default value should be set from @defval, - * in which case @info->set_default_value must not be NULL - * (if false then no default value is set by the property system - * and the field retains whatever value it was given by instance_init). - * @defval: default value for the property. This is used only if @set_defa= ult - * is true. - */ -struct Property { - const char *name; - const PropertyInfo *info; - ptrdiff_t offset; - uint8_t bitnr; - bool set_default; - union { - int64_t i; - uint64_t u; - } defval; - int arrayoffset; - const PropertyInfo *arrayinfo; - int arrayfieldsize; - const char *link_type; -}; - -struct PropertyInfo { - const char *name; - const char *description; - const QEnumLookup *enum_table; - int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); - void (*set_default_value)(ObjectProperty *op, const Property *prop); - void (*create)(ObjectClass *oc, Property *prop); - ObjectPropertyAccessor *get; - ObjectPropertyAccessor *set; - ObjectPropertyRelease *release; -}; - /** * GlobalProperty: * @used: Set to true if property was used when initializing a device. diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 4437450065..db7ce51dd5 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -3,6 +3,44 @@ =20 #include "hw/qdev-core.h" =20 +/** + * Property: + * @set_default: true if the default value should be set from @defval, + * in which case @info->set_default_value must not be NULL + * (if false then no default value is set by the property system + * and the field retains whatever value it was given by instance_init). + * @defval: default value for the property. This is used only if @set_defa= ult + * is true. + */ +struct Property { + const char *name; + const PropertyInfo *info; + ptrdiff_t offset; + uint8_t bitnr; + bool set_default; + union { + int64_t i; + uint64_t u; + } defval; + int arrayoffset; + const PropertyInfo *arrayinfo; + int arrayfieldsize; + const char *link_type; +}; + +struct PropertyInfo { + const char *name; + const char *description; + const QEnumLookup *enum_table; + int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); + void (*set_default_value)(ObjectProperty *op, const Property *prop); + void (*create)(ObjectClass *oc, Property *prop); + ObjectPropertyAccessor *get; + ObjectPropertyAccessor *set; + ObjectPropertyRelease *release; +}; + + /*** qdev-properties.c ***/ =20 extern const PropertyInfo qdev_prop_bit; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 509cbf155d..12a053e732 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -929,3 +929,123 @@ const PropertyInfo qdev_prop_link =3D { .name =3D "link", .create =3D create_link_property, }; + +void qdev_property_add_static(DeviceState *dev, Property *prop) +{ + Object *obj =3D OBJECT(dev); + ObjectProperty *op; + + assert(!prop->info->create); + + op =3D object_property_add(obj, prop->name, prop->info->name, + prop->info->get, prop->info->set, + prop->info->release, + prop); + + object_property_set_description(obj, prop->name, + prop->info->description); + + if (prop->set_default) { + prop->info->set_default_value(op, prop); + if (op->init) { + op->init(obj, op); + } + } +} + +static void qdev_class_add_property(DeviceClass *klass, Property *prop) +{ + ObjectClass *oc =3D OBJECT_CLASS(klass); + + if (prop->info->create) { + prop->info->create(oc, prop); + } else { + ObjectProperty *op; + + op =3D object_class_property_add(oc, + prop->name, prop->info->name, + prop->info->get, prop->info->set, + prop->info->release, + prop); + if (prop->set_default) { + prop->info->set_default_value(op, prop); + } + } + object_class_property_set_description(oc, prop->name, + prop->info->description); +} + +/** + * Legacy property handling + */ + +static void qdev_get_legacy_property(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + + char buffer[1024]; + char *ptr =3D buffer; + + prop->info->print(dev, prop, buffer, sizeof(buffer)); + visit_type_str(v, name, &ptr, errp); +} + +/** + * qdev_class_add_legacy_property: + * @dev: Device to add the property to. + * @prop: The qdev property definition. + * + * Add a legacy QOM property to @dev for qdev property @prop. + * + * Legacy properties are string versions of QOM properties. The format of + * the string depends on the property type. Legacy properties are only + * needed for "info qtree". + * + * Do not use this in new code! QOM Properties added through this interfa= ce + * will be given names in the "legacy" namespace. + */ +static void qdev_class_add_legacy_property(DeviceClass *dc, Property *prop) +{ + g_autofree char *name =3D NULL; + + /* Register pointer properties as legacy properties */ + if (!prop->info->print && prop->info->get) { + return; + } + + name =3D g_strdup_printf("legacy-%s", prop->name); + object_class_property_add(OBJECT_CLASS(dc), name, "str", + prop->info->print ? qdev_get_legacy_property : prop->info->get, + NULL, NULL, prop); +} + +void device_class_set_props(DeviceClass *dc, Property *props) +{ + Property *prop; + + dc->props_ =3D props; + for (prop =3D props; prop && prop->name; prop++) { + qdev_class_add_legacy_property(dc, prop); + qdev_class_add_property(dc, prop); + } +} + +void qdev_alias_all_properties(DeviceState *target, Object *source) +{ + ObjectClass *class; + Property *prop; + + class =3D object_get_class(OBJECT(target)); + do { + DeviceClass *dc =3D DEVICE_CLASS(class); + + for (prop =3D dc->props_; prop && prop->name; prop++) { + object_property_add_alias(source, prop->name, + OBJECT(target), prop->name); + } + class =3D object_class_get_parent(class); + } while (class !=3D object_class_by_name(TYPE_DEVICE)); +} diff --git a/hw/core/qdev.c b/hw/core/qdev.c index cbdff0b6c6..d3611e7c03 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -705,115 +705,6 @@ char *qdev_get_dev_path(DeviceState *dev) return NULL; } =20 -/** - * Legacy property handling - */ - -static void qdev_get_legacy_property(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - DeviceState *dev =3D DEVICE(obj); - Property *prop =3D opaque; - - char buffer[1024]; - char *ptr =3D buffer; - - prop->info->print(dev, prop, buffer, sizeof(buffer)); - visit_type_str(v, name, &ptr, errp); -} - -/** - * qdev_class_add_legacy_property: - * @dev: Device to add the property to. - * @prop: The qdev property definition. - * - * Add a legacy QOM property to @dev for qdev property @prop. - * - * Legacy properties are string versions of QOM properties. The format of - * the string depends on the property type. Legacy properties are only - * needed for "info qtree". - * - * Do not use this in new code! QOM Properties added through this interfa= ce - * will be given names in the "legacy" namespace. - */ -static void qdev_class_add_legacy_property(DeviceClass *dc, Property *prop) -{ - g_autofree char *name =3D NULL; - - /* Register pointer properties as legacy properties */ - if (!prop->info->print && prop->info->get) { - return; - } - - name =3D g_strdup_printf("legacy-%s", prop->name); - object_class_property_add(OBJECT_CLASS(dc), name, "str", - prop->info->print ? qdev_get_legacy_property : prop->info->get, - NULL, NULL, prop); -} - -void qdev_property_add_static(DeviceState *dev, Property *prop) -{ - Object *obj =3D OBJECT(dev); - ObjectProperty *op; - - assert(!prop->info->create); - - op =3D object_property_add(obj, prop->name, prop->info->name, - prop->info->get, prop->info->set, - prop->info->release, - prop); - - object_property_set_description(obj, prop->name, - prop->info->description); - - if (prop->set_default) { - prop->info->set_default_value(op, prop); - if (op->init) { - op->init(obj, op); - } - } -} - -static void qdev_class_add_property(DeviceClass *klass, Property *prop) -{ - ObjectClass *oc =3D OBJECT_CLASS(klass); - - if (prop->info->create) { - prop->info->create(oc, prop); - } else { - ObjectProperty *op; - - op =3D object_class_property_add(oc, - prop->name, prop->info->name, - prop->info->get, prop->info->set, - prop->info->release, - prop); - if (prop->set_default) { - prop->info->set_default_value(op, prop); - } - } - object_class_property_set_description(oc, prop->name, - prop->info->description); -} - -void qdev_alias_all_properties(DeviceState *target, Object *source) -{ - ObjectClass *class; - Property *prop; - - class =3D object_get_class(OBJECT(target)); - do { - DeviceClass *dc =3D DEVICE_CLASS(class); - - for (prop =3D dc->props_; prop && prop->name; prop++) { - object_property_add_alias(source, prop->name, - OBJECT(target), prop->name); - } - class =3D object_class_get_parent(class); - } while (class !=3D object_class_by_name(TYPE_DEVICE)); -} - static bool device_get_realized(Object *obj, Error **errp) { DeviceState *dev =3D DEVICE(obj); @@ -1208,17 +1099,6 @@ static void device_class_init(ObjectClass *class, vo= id *data) offsetof(DeviceState, parent_bus), NULL= , 0); } =20 -void device_class_set_props(DeviceClass *dc, Property *props) -{ - Property *prop; - - dc->props_ =3D props; - for (prop =3D props; prop && prop->name; prop++) { - qdev_class_add_legacy_property(dc, prop); - qdev_class_add_property(dc, prop); - } -} - void device_class_set_parent_reset(DeviceClass *dc, DeviceReset dev_reset, DeviceReset *parent_reset) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 832e254842..8c072e3efc 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -38,6 +38,7 @@ #include "migration/misc.h" #include "migration/migration.h" #include "qemu/cutils.h" +#include "hw/qdev-properties.h" #include "hw/clock.h" =20 /* --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607724956; cv=none; d=zohomail.com; s=zohoarc; b=gml3X3SHHoXUrWzlTgxVWSOnoDf4Os+C7zxJuKRHEb/WwRZxOMYzVThUfeB8M2mLB1REnNvDQzLFVGF2dLXnr2y2MHcfChezflmF8WYNY+oV2IBdEJNm+xUfDukcIToUQJrv+eJqy9ccLjO9+aXU7vFyvaht/nhXVs3lmJ0U1uQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724956; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vEjTnFSP6RWWnn7yq/e5wvK10BECB3NOm0e4zn5Aqds=; b=KUhe1q5F7hrQav1M97NDoJoqt9nK8dAiBvc2Tiv+x/pN6TQK6o4j5Uy1IkNZdxrA1d2/xR/ryRviwd1oNQAXrY/wLkMDrFM9dw1V+q2oC7x2TuKBrkIVISiNHwrOyYS2p4D7A01CQJJhmL6oBdpjPHRfbQNiSBGeyH973hyQT9g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607724956794777.9106263613317; Fri, 11 Dec 2020 14:15:56 -0800 (PST) Received: from localhost ([::1]:52178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqhe-0000K6-M9 for importer@patchew.org; Fri, 11 Dec 2020 17:15:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqY3-0001en-A3 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqY0-0006G9-5U for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:57 -0500 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-557-uj4neX3iMYqnewQD6xGI6Q-1; Fri, 11 Dec 2020 17:05:54 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE548107ACE4; Fri, 11 Dec 2020 22:05:52 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E15560BE5; Fri, 11 Dec 2020 22:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724355; 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=vEjTnFSP6RWWnn7yq/e5wvK10BECB3NOm0e4zn5Aqds=; b=gFkV4eGhxLgogTIHYO9lNqSv0su6BEgvLFJULH4rOwQ760L2iTzA3l41uMf5UvYjafMTIA bVsY9m2G0yCSpmdG+9EwjrfxqR65OVB1M+QtoQKF4hzpGIx8ULwhEU7ll0uCnnu6Hgsibu qY88x0grw7q9VQzA6BXEahyTrNQzoxU= X-MC-Unique: uj4neX3iMYqnewQD6xGI6Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 04/32] qdev: Check dev->realized at set_size() Date: Fri, 11 Dec 2020 17:05:01 -0500 Message-Id: <20201211220529.2290218-5-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This setter is one of the very few property setters that don't check dev->realized, and there's no reason to make size properties different from the rest. Add the missing check. Fixes: e8cd45c78f53 ("qdev: Add SIZE type to qdev properties") Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 12a053e732..67ae19df05 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -905,6 +905,11 @@ static void set_size(Object *obj, Visitor *v, const ch= ar *name, void *opaque, Property *prop =3D opaque; uint64_t *ptr =3D qdev_get_prop_ptr(dev, prop); =20 + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + visit_type_size(v, name, ptr, errp); } =20 --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725177; cv=none; d=zohomail.com; s=zohoarc; b=c93LtlhVsyNFBkjBj2M2he/ABfIIifwEG5cEUIgYUya2y87lGfJfQmPMX9LGVCzXF/40wkPK6O78LeLpM22bKpYQaUc9kJ9lcOIaSOT42MyWNphoonW1RD8t39GdnacrZOO3RABSj+xwAvJf+bAqNx9N7Ky4KmO2AlDY7KEYQJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725177; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=r5SUdFI3N6wVVjpbnCaYFUtRE+pQyNNogHtPpD9mdfE=; b=TUO7f1cIw3OLengBvW3yWFNi/hlgBCikx5YRv6FStl1ZxAWe5Vw/ZK3sDLBpVFRWy0juTu/g3+AlUZIDojKYA7WakUdN81swCduC+cDZPIwI2l46+az2ERwgt7h6bBp3TEWQAgaV7taD5qWC+7JWCsNBy23w8Yz0uGLvpbbK3nE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725177527194.8600241401648; Fri, 11 Dec 2020 14:19:37 -0800 (PST) Received: from localhost ([::1]:57728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqlE-0002qV-6I for importer@patchew.org; Fri, 11 Dec 2020 17:19:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYC-0001lW-9N for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqY5-0006Ho-RN for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:08 -0500 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-566-xWM088oIMx2IAZNNm1rh3A-1; Fri, 11 Dec 2020 17:05:59 -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 D87D3800D55; Fri, 11 Dec 2020 22:05:57 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 155E85C8AA; Fri, 11 Dec 2020 22:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724360; 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=r5SUdFI3N6wVVjpbnCaYFUtRE+pQyNNogHtPpD9mdfE=; b=iAIGfC/RBOrLuhRJ5piawKjtiUGLJ/ZA7f8el1h31sZYaVoMSDBXLG8Cpz6VsBpWHpVI+j lZMZjKAG0pFNXmTQ8ylJhEHPGZ07uoNhsesNorrQWsCOf6irIKXcHTNl5t/NWLtkZ208Ch R8NJTf5PZm32I2IF2zA/sSAcdINZX0g= X-MC-Unique: xWM088oIMx2IAZNNm1rh3A-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 05/32] sparc: Check dev->realized at sparc_set_nwindows() Date: Fri, 11 Dec 2020 17:05:02 -0500 Message-Id: <20201211220529.2290218-6-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) sparc_set_nwindows() is one of the very few property setters that don't check dev->realized, and there's no reason for it to be special. Check dev->realized like the other setters. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost Acked-by: Mark Cave-Ayland --- Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org --- target/sparc/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 701e794eac..6a3299041f 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -798,11 +798,17 @@ static void sparc_get_nwindows(Object *obj, Visitor *= v, const char *name, static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + DeviceState *dev =3D DEVICE(obj); const int64_t min =3D MIN_NWINDOWS; const int64_t max =3D MAX_NWINDOWS; SPARCCPU *cpu =3D SPARC_CPU(obj); int64_t value; =20 + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + if (!visit_type_int(v, name, &value, errp)) { return; } --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725257; cv=none; d=zohomail.com; s=zohoarc; b=V8YwafX+SyjRRnbSI9BuB5E7xB4OxaxkQA85DneXB0pBNLkCTFMPOf/LLS8WEBwfkL95IOdt+cNgzBVrZGML0ib3Q4Ir3Jho6wjdS0UQ0sdf/eSPhPCyY6Q77CyJUMoFzGrdZIutgffttXj2nhPFFZgZV9j306KEzEsdk9+VMUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725257; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bjbAAGsu3eif6zWUP3OWVxWI0koAqnB2AtUWbzN1whY=; b=NwEOGRdZ1bfZ+rO9yMj2v5jGSTykVYILCzi2iHeCO/wQMSZ75GRJHF/o2WC2G28hlSxSiVAwbC06iWVnAC5TjAI7gmuaaFg6DBu5/aFqSuoVHrYWVP8XFajUO33LlN7Q760dBkJM2RnKgafJsqzhU2A2bE57SOYLP0ojhfdn/ws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725257271622.2933024915529; Fri, 11 Dec 2020 14:20:57 -0800 (PST) Received: from localhost ([::1]:58800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqmU-0003Io-Tk for importer@patchew.org; Fri, 11 Dec 2020 17:20:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYB-0001lA-IB for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYA-0006J0-0b for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:07 -0500 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-106-D8KVOaMNNxmCQra5LRWZow-1; Fri, 11 Dec 2020 17:06:03 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C35FB800D53; Fri, 11 Dec 2020 22:06:02 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 187E41002391; Fri, 11 Dec 2020 22:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724365; 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=bjbAAGsu3eif6zWUP3OWVxWI0koAqnB2AtUWbzN1whY=; b=N7Z5PoAzp+fyY41VzVKRbb+7TRso5dBeSaq9E3RZTC1w+sL1E5xlv7oMBjO/o3jO1AuqBz 3OTomZm5H7XO1peHbmx0TEzvBtVJFKEHsIs+seYNXfrgcYbDVAk1fsg/P43SRWXKhKOU2A wbftCdX5xMTn64w6cNz9SDMFyETKSTc= X-MC-Unique: D8KVOaMNNxmCQra5LRWZow-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 06/32] qdev: Don't use dev->id on set_size32() error message Date: Fri, 11 Dec 2020 17:05:03 -0500 Message-Id: <20201211220529.2290218-7-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) All other qdev property error messages use "." instead of ".". Change set_size32() for consistency, and to make the code not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 67ae19df05..daf844c2d3 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -542,7 +542,7 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, error_setg(errp, "Property %s.%s doesn't take value %" PRIu64 " (maximum: %u)", - dev->id ? : "", name, value, UINT32_MAX); + object_get_typename(obj), name, value, UINT32_MAX); return; } =20 --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725515; cv=none; d=zohomail.com; s=zohoarc; b=UQq8zrat/vsFdppRBZEit4/ewXGXN1gXaOXSY9hQy3A6iXx+vD9+WLzVEjeziL5zQ9ieLe9z6m7kTHz6BI10w0r2Cq5SuZKHxUXVDS9qfWPLPBfnAA9yOmSzuakYNdsxIXUTB3HRJdrPwt9OMkOgT1V1IpJhcKVcjUFWQW4tEXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725515; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tPhZ+siQcEyC1V/WCxGzx09M1O2LwyOYj1QAvC19Upw=; b=CfxWMEp4iS1lx8cPmYAZBm3d+ODNf2SP8W9WrXjOvqTWWH5v18kwebiHR0cqEZPVa4vDjfYa3qJs7VCWZCnmp8tCICZOl2W2lbgGRAizziX454ApnmJU2JTqX2QrG1o9SLlwh8Eoug4hHOfRsW9fFN3+FwUMaO6VljB2k8QtjqA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725515099941.936687220314; Fri, 11 Dec 2020 14:25:15 -0800 (PST) Received: from localhost ([::1]:37970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqqf-0006qs-Vq for importer@patchew.org; Fri, 11 Dec 2020 17:25:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYD-0001le-6B for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYB-0006Jt-H1 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:08 -0500 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-274-sQhZw21CO_iZBmPXhBoq-Q-1; Fri, 11 Dec 2020 17:06:05 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D520801817; Fri, 11 Dec 2020 22:06:04 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id E27EB10023AD; Fri, 11 Dec 2020 22:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724366; 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=tPhZ+siQcEyC1V/WCxGzx09M1O2LwyOYj1QAvC19Upw=; b=TfUmMktvMNQcKnqHuitaYwxPEVXzfqI2dbscsixKJfqi3aEQXeHBZrDyretzFu63jhcML9 emtqT5Uz1P4uARf0Z0uFWTz9+f3/YGEGQeGiRYS7A7B1Its47NrJZqdyH28V5gZPesDvcN v8w2xFvkdswN4rHol68HH2XO/V2yYyY= X-MC-Unique: sQhZw21CO_iZBmPXhBoq-Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 07/32] qdev: Make PropertyInfo.print method get Object* argument Date: Fri, 11 Dec 2020 17:05:04 -0500 Message-Id: <20201211220529.2290218-8-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 3 ++- hw/core/qdev-properties.c | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index db7ce51dd5..0ea822e6a7 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -32,7 +32,7 @@ struct PropertyInfo { const char *name; const char *description; const QEnumLookup *enum_table; - int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); + int (*print)(Object *obj, Property *prop, char *dest, size_t len); void (*set_default_value)(ObjectProperty *op, const Property *prop); void (*create)(ObjectClass *oc, Property *prop); ObjectPropertyAccessor *get; diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 8912fb4e9c..77b31eb9dc 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -801,9 +801,10 @@ invalid: g_free(str); } =20 -static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest, +static int print_pci_devfn(Object *obj, Property *prop, char *dest, size_t len) { + DeviceState *dev =3D DEVICE(obj); int32_t *ptr =3D qdev_get_prop_ptr(dev, prop); =20 if (*ptr =3D=3D -1) { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index daf844c2d3..b6cf53e929 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -988,13 +988,12 @@ static void qdev_get_legacy_property(Object *obj, Vis= itor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; =20 char buffer[1024]; char *ptr =3D buffer; =20 - prop->info->print(dev, prop, buffer, sizeof(buffer)); + prop->info->print(obj, prop, buffer, sizeof(buffer)); visit_type_str(v, name, &ptr, errp); } =20 --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607724596; cv=none; d=zohomail.com; s=zohoarc; b=MLpyx7430QfZnoxXyLdCi7GoLhbl8uvEx8v+b+h1b5kBMZWsvPJIuGBwZ/mwaweUOGp4+vpP/2yMqycbz4olH+VANa2nk+1JVRAu3W1OtJUpUEyTtSIB7LMvXC9FbY+jm+HEON+r4621SG/C1wgsnh4JepE78MpOEcQdE1PwQKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724596; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gdMyOjPEyHa8ld0hjAoBSsicMflgaQnNdGClhjzau5k=; b=EAUA8s4bms2WwvcNgd+yFegnKSmAo/t3X16G9CTB3y+9adIK9xeQRHEFqSdSmgJZSXZw2aB1g4ZRHZ0+oo2V9HzN02UUknNLoeCAjSsGe0Gr++gcntY749pBG7w8J3rhZve5GZuWfEPq6q+Fc9BoNmlxKeYuEQ1N+qzfFXOP+Js= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607724596608713.7719121934016; Fri, 11 Dec 2020 14:09:56 -0800 (PST) Received: from localhost ([::1]:41744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqbq-0003zO-Dq for importer@patchew.org; Fri, 11 Dec 2020 17:09:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYM-0001rq-Ky for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42616) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYG-0006L5-OA for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:18 -0500 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-15-t6dkPKtnNuOO1rUtpvwMYQ-1; Fri, 11 Dec 2020 17:06:07 -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 45CE319251A1; Fri, 11 Dec 2020 22:06:06 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC2D171C80; Fri, 11 Dec 2020 22:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724371; 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=gdMyOjPEyHa8ld0hjAoBSsicMflgaQnNdGClhjzau5k=; b=YrMcMo/dVoTTGr23eKna8ZKI3rJfIhh9jBeeWp+492uE6dW+k86sNUJrYw5GMDrQckqzVs g8kg6HzAti9VCMZuf+hypqn6ZPUajeFQYJTMbArmRPaTOX1ZppvYf/Yr221VhI/LAewocI OjX92BDxzOfWRO+8DiTc+7Mx+4zF1/Q= X-MC-Unique: t6dkPKtnNuOO1rUtpvwMYQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 08/32] qdev: Make bit_prop_set() get Object* argument Date: Fri, 11 Dec 2020 17:05:05 -0500 Message-Id: <20201211220529.2290218-9-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index b6cf53e929..3a4638f4de 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -92,8 +92,9 @@ static uint32_t qdev_get_prop_mask(Property *prop) return 0x1 << prop->bitnr; } =20 -static void bit_prop_set(DeviceState *dev, Property *props, bool val) +static void bit_prop_set(Object *obj, Property *props, bool val) { + DeviceState *dev =3D DEVICE(obj); uint32_t *p =3D qdev_get_prop_ptr(dev, props); uint32_t mask =3D qdev_get_prop_mask(props); if (val) { @@ -129,7 +130,7 @@ static void prop_set_bit(Object *obj, Visitor *v, const= char *name, if (!visit_type_bool(v, name, &value, errp)) { return; } - bit_prop_set(dev, prop, value); + bit_prop_set(obj, prop, value); } =20 static void set_default_value_bool(ObjectProperty *op, const Property *pro= p) @@ -153,8 +154,9 @@ static uint64_t qdev_get_prop_mask64(Property *prop) return 0x1ull << prop->bitnr; } =20 -static void bit64_prop_set(DeviceState *dev, Property *props, bool val) +static void bit64_prop_set(Object *obj, Property *props, bool val) { + DeviceState *dev =3D DEVICE(obj); uint64_t *p =3D qdev_get_prop_ptr(dev, props); uint64_t mask =3D qdev_get_prop_mask64(props); if (val) { @@ -190,7 +192,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, con= st char *name, if (!visit_type_bool(v, name, &value, errp)) { return; } - bit64_prop_set(dev, prop, value); + bit64_prop_set(obj, prop, value); } =20 const PropertyInfo qdev_prop_bit64 =3D { --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 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=1607724406; cv=none; d=zohomail.com; s=zohoarc; b=WrOSZzsy56pJlEprgk5nHVcTee07ZUUXkqiwzKspWD3pOQizKUTkfe573AB2/kOIH3wERtnUABXQQpqW/KaC6c9UYk2uZ269lHtJ3VtYd8vKWexGqnKZctVLTuX8ulefjfIbsuB1mJBXLvuSO+KdSYZBFxLKdRCEgZJbLjrBdls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724406; 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=ZJe/QLookReovEWCweH6zzebkyNL6c/FJv8O55OglUc=; b=ADgIvKHB8TfyiY2SfQXea0NYnn1J015UpDVcK0Amw12c+1DB3euq+dneWcrPDYnZqvJjYcHexf0XFsyuifNc7vWdfm1WPviYWE3APUhSrkGe3Tbb2NFS4EAWCXOWK78xtnZ9vNOA1Yv+9/lU1/llJ1QUnEfK5SNn4zgJiGxa6G4= 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 1607724406815503.2594671081913; Fri, 11 Dec 2020 14:06:46 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.50923.89765 (Exim 4.92) (envelope-from ) id 1knqYQ-0006dm-DC; Fri, 11 Dec 2020 22:06:22 +0000 Received: by outflank-mailman (output) from mailman id 50923.89765; Fri, 11 Dec 2020 22:06:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knqYQ-0006dZ-A6; Fri, 11 Dec 2020 22:06:22 +0000 Received: by outflank-mailman (input) for mailman id 50923; Fri, 11 Dec 2020 22:06:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knqYP-0006dS-CZ for xen-devel@lists.xenproject.org; Fri, 11 Dec 2020 22:06:21 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 96540e95-8500-4555-88be-5e621f09e7c8; Fri, 11 Dec 2020 22:06:18 +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-250-SvvGBz7CO8qmThcdqBMh3g-1; Fri, 11 Dec 2020 17:06:17 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9442119251A1; Fri, 11 Dec 2020 22:06:14 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id D346B19C78; Fri, 11 Dec 2020 22:06:06 +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: 96540e95-8500-4555-88be-5e621f09e7c8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724378; 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=ZJe/QLookReovEWCweH6zzebkyNL6c/FJv8O55OglUc=; b=MoaxH5iX+Bu8BkYmJlhmk7VuB2ZGjFtrYilecMwHMUJ71ftVp8ZuvHKyvq01Bk6mdvXxXa fGZ4WrJssB6vPbKhXuaqoWMuirg11Kwa+DXkfVYXJ+jFITuzf3hvlBncopXAddST+rCBUm 93uzUskPRo3y6eIJfMoE5QFUW3iEpZ4= X-MC-Unique: SvvGBz7CO8qmThcdqBMh3g-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Cc: Markus Armbruster , Igor Mammedov , Stefan Berger , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Daniel P. Berrange" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow , Kevin Wolf , Eric Blake , Paolo Bonzini , Cornelia Huck , Stefan Berger , Stefano Stabellini , Anthony Perard , Paul Durrant , Max Reitz , Thomas Huth , Richard Henderson , David Hildenbrand , Halil Pasic , Christian Borntraeger , Matthew Rosato , Alex Williamson , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v4 09/32] qdev: Make qdev_get_prop_ptr() get Object* arg Date: Fri, 11 Dec 2020 17:05:06 -0500 Message-Id: <20201211220529.2290218-10-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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) Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Cornelia Huck #s390 parts Signed-off-by: Eduardo Habkost Acked-by: Paul Durrant --- Changes v1 -> v2: - Fix build error with CONFIG_XEN I took the liberty of keeping the Reviewed-by line from Marc-Andr=C3=A9 as the build fix is a trivial one line change --- 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: Cornelia Huck Cc: Thomas Huth Cc: Richard Henderson Cc: David Hildenbrand Cc: Halil Pasic Cc: Christian Borntraeger Cc: Matthew Rosato Cc: Alex Williamson Cc: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org Cc: qemu-block@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- backends/tpm/tpm_util.c | 8 ++-- hw/block/xen-block.c | 5 +- hw/core/qdev-properties-system.c | 57 +++++++++------------- hw/core/qdev-properties.c | 82 +++++++++++++------------------- hw/s390x/css.c | 5 +- hw/s390x/s390-pci-bus.c | 4 +- hw/vfio/pci-quirks.c | 5 +- 8 files changed, 68 insertions(+), 100 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0ea822e6a7..0b92cfc761 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -302,7 +302,7 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char= *name, const uint8_t *value); void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); =20 -void *qdev_get_prop_ptr(DeviceState *dev, Property *prop); +void *qdev_get_prop_ptr(Object *obj, Property *prop); =20 void qdev_prop_register_global(GlobalProperty *prop); const GlobalProperty *qdev_find_global_prop(DeviceState *dev, diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index e6aeb63587..3973105658 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -35,8 +35,7 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - DeviceState *dev =3D DEVICE(obj); - TPMBackend **be =3D qdev_get_prop_ptr(dev, opaque); + TPMBackend **be =3D qdev_get_prop_ptr(obj, opaque); char *p; =20 p =3D g_strdup(*be ? (*be)->id : ""); @@ -49,7 +48,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *= name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - TPMBackend *s, **be =3D qdev_get_prop_ptr(dev, prop); + TPMBackend *s, **be =3D qdev_get_prop_ptr(obj, prop); char *str; =20 if (dev->realized) { @@ -73,9 +72,8 @@ static void set_tpm(Object *obj, Visitor *v, const char *= name, void *opaque, =20 static void release_tpm(Object *obj, const char *name, void *opaque) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - TPMBackend **be =3D qdev_get_prop_ptr(dev, prop); + TPMBackend **be =3D qdev_get_prop_ptr(obj, prop); =20 if (*be) { tpm_backend_reset(*be); diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 8a7a3f5452..905e4acd97 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -335,9 +335,8 @@ static char *disk_to_vbd_name(unsigned int disk) static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - XenBlockVdev *vdev =3D qdev_get_prop_ptr(dev, prop); + XenBlockVdev *vdev =3D qdev_get_prop_ptr(obj, prop); char *str; =20 switch (vdev->type) { @@ -398,7 +397,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v,= const char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - XenBlockVdev *vdev =3D qdev_get_prop_ptr(dev, prop); + XenBlockVdev *vdev =3D qdev_get_prop_ptr(obj, prop); char *str, *p; const char *end; =20 diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 77b31eb9dc..9ac9b95852 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -59,9 +59,8 @@ static bool check_prop_still_unset(DeviceState *dev, cons= t char *name, static void get_drive(Object *obj, Visitor *v, const char *name, void *opa= que, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - void **ptr =3D qdev_get_prop_ptr(dev, prop); + void **ptr =3D qdev_get_prop_ptr(obj, prop); const char *value; char *p; =20 @@ -87,7 +86,7 @@ static void set_drive_helper(Object *obj, Visitor *v, con= st char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - void **ptr =3D qdev_get_prop_ptr(dev, prop); + void **ptr =3D qdev_get_prop_ptr(obj, prop); char *str; BlockBackend *blk; bool blk_created =3D false; @@ -185,7 +184,7 @@ static void release_drive(Object *obj, const char *name= , void *opaque) { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - BlockBackend **ptr =3D qdev_get_prop_ptr(dev, prop); + BlockBackend **ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (*ptr) { AioContext *ctx =3D blk_get_aio_context(*ptr); @@ -218,8 +217,7 @@ const PropertyInfo qdev_prop_drive_iothread =3D { static void get_chr(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - DeviceState *dev =3D DEVICE(obj); - CharBackend *be =3D qdev_get_prop_ptr(dev, opaque); + CharBackend *be =3D qdev_get_prop_ptr(obj, opaque); char *p; =20 p =3D g_strdup(be->chr && be->chr->label ? be->chr->label : ""); @@ -232,7 +230,7 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - CharBackend *be =3D qdev_get_prop_ptr(dev, prop); + CharBackend *be =3D qdev_get_prop_ptr(obj, prop); Chardev *s; char *str; =20 @@ -272,9 +270,8 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, =20 static void release_chr(Object *obj, const char *name, void *opaque) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - CharBackend *be =3D qdev_get_prop_ptr(dev, prop); + CharBackend *be =3D qdev_get_prop_ptr(obj, prop); =20 qemu_chr_fe_deinit(be, false); } @@ -297,9 +294,8 @@ const PropertyInfo qdev_prop_chr =3D { static void get_mac(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - MACAddr *mac =3D qdev_get_prop_ptr(dev, prop); + MACAddr *mac =3D qdev_get_prop_ptr(obj, prop); char buffer[2 * 6 + 5 + 1]; char *p =3D buffer; =20 @@ -315,7 +311,7 @@ static void set_mac(Object *obj, Visitor *v, const char= *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - MACAddr *mac =3D qdev_get_prop_ptr(dev, prop); + MACAddr *mac =3D qdev_get_prop_ptr(obj, prop); int i, pos; char *str; const char *p; @@ -381,9 +377,8 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char= *name, static void get_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - NICPeers *peers_ptr =3D qdev_get_prop_ptr(dev, prop); + NICPeers *peers_ptr =3D qdev_get_prop_ptr(obj, prop); char *p =3D g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : ""); =20 visit_type_str(v, name, &p, errp); @@ -395,7 +390,7 @@ static void set_netdev(Object *obj, Visitor *v, const c= har *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - NICPeers *peers_ptr =3D qdev_get_prop_ptr(dev, prop); + NICPeers *peers_ptr =3D qdev_get_prop_ptr(obj, prop); NetClientState **ncs =3D peers_ptr->ncs; NetClientState *peers[MAX_QUEUE_NUM]; int queues, err =3D 0, i =3D 0; @@ -461,9 +456,8 @@ const PropertyInfo qdev_prop_netdev =3D { static void get_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - QEMUSoundCard *card =3D qdev_get_prop_ptr(dev, prop); + QEMUSoundCard *card =3D qdev_get_prop_ptr(obj, prop); char *p =3D g_strdup(audio_get_id(card)); =20 visit_type_str(v, name, &p, errp); @@ -475,7 +469,7 @@ static void set_audiodev(Object *obj, Visitor *v, const= char* name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - QEMUSoundCard *card =3D qdev_get_prop_ptr(dev, prop); + QEMUSoundCard *card =3D qdev_get_prop_ptr(obj, prop); AudioState *state; int err =3D 0; char *str; @@ -582,7 +576,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); uint64_t value; Error *local_err =3D NULL; =20 @@ -674,9 +668,8 @@ const PropertyInfo qdev_prop_multifd_compression =3D { static void get_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - ReservedRegion *rr =3D qdev_get_prop_ptr(dev, prop); + ReservedRegion *rr =3D qdev_get_prop_ptr(obj, prop); char buffer[64]; char *p =3D buffer; int rc; @@ -693,7 +686,7 @@ static void set_reserved_region(Object *obj, Visitor *v= , const char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - ReservedRegion *rr =3D qdev_get_prop_ptr(dev, prop); + ReservedRegion *rr =3D qdev_get_prop_ptr(obj, prop); Error *local_err =3D NULL; const char *endptr; char *str; @@ -761,7 +754,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, cons= t char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - int32_t value, *ptr =3D qdev_get_prop_ptr(dev, prop); + int32_t value, *ptr =3D qdev_get_prop_ptr(obj, prop); unsigned int slot, fn, n; char *str; =20 @@ -804,8 +797,7 @@ invalid: static int print_pci_devfn(Object *obj, Property *prop, char *dest, size_t len) { - DeviceState *dev =3D DEVICE(obj); - int32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (*ptr =3D=3D -1) { return snprintf(dest, len, ""); @@ -828,9 +820,8 @@ const PropertyInfo qdev_prop_pci_devfn =3D { static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - PCIHostDeviceAddress *addr =3D qdev_get_prop_ptr(dev, prop); + PCIHostDeviceAddress *addr =3D qdev_get_prop_ptr(obj, prop); char buffer[] =3D "ffff:ff:ff.f"; char *p =3D buffer; int rc =3D 0; @@ -857,7 +848,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *= v, const char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - PCIHostDeviceAddress *addr =3D qdev_get_prop_ptr(dev, prop); + PCIHostDeviceAddress *addr =3D qdev_get_prop_ptr(obj, prop); char *str, *p; char *e; unsigned long val; @@ -951,9 +942,8 @@ const PropertyInfo qdev_prop_off_auto_pcibar =3D { static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - PCIExpLinkSpeed *p =3D qdev_get_prop_ptr(dev, prop); + PCIExpLinkSpeed *p =3D qdev_get_prop_ptr(obj, prop); int speed; =20 switch (*p) { @@ -982,7 +972,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor= *v, const char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - PCIExpLinkSpeed *p =3D qdev_get_prop_ptr(dev, prop); + PCIExpLinkSpeed *p =3D qdev_get_prop_ptr(obj, prop); int speed; =20 if (dev->realized) { @@ -1028,9 +1018,8 @@ const PropertyInfo qdev_prop_pcie_link_speed =3D { static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - PCIExpLinkWidth *p =3D qdev_get_prop_ptr(dev, prop); + PCIExpLinkWidth *p =3D qdev_get_prop_ptr(obj, prop); int width; =20 switch (*p) { @@ -1068,7 +1057,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visit= or *v, const char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - PCIExpLinkWidth *p =3D qdev_get_prop_ptr(dev, prop); + PCIExpLinkWidth *p =3D qdev_get_prop_ptr(obj, prop); int width; =20 if (dev->realized) { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3a4638f4de..0a54a922c8 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -38,9 +38,9 @@ void qdev_prop_allow_set_link_before_realize(const Object= *obj, } } =20 -void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) +void *qdev_get_prop_ptr(Object *obj, Property *prop) { - void *ptr =3D dev; + void *ptr =3D obj; ptr +=3D prop->offset; return ptr; } @@ -48,9 +48,8 @@ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - int *ptr =3D qdev_get_prop_ptr(dev, prop); + int *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); } @@ -60,7 +59,7 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, cons= t char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - int *ptr =3D qdev_get_prop_ptr(dev, prop); + int *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -94,8 +93,7 @@ static uint32_t qdev_get_prop_mask(Property *prop) =20 static void bit_prop_set(Object *obj, Property *props, bool val) { - DeviceState *dev =3D DEVICE(obj); - uint32_t *p =3D qdev_get_prop_ptr(dev, props); + uint32_t *p =3D qdev_get_prop_ptr(obj, props); uint32_t mask =3D qdev_get_prop_mask(props); if (val) { *p |=3D mask; @@ -107,9 +105,8 @@ static void bit_prop_set(Object *obj, Property *props, = bool val) static void prop_get_bit(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *p =3D qdev_get_prop_ptr(dev, prop); + uint32_t *p =3D qdev_get_prop_ptr(obj, prop); bool value =3D (*p & qdev_get_prop_mask(prop)) !=3D 0; =20 visit_type_bool(v, name, &value, errp); @@ -156,8 +153,7 @@ static uint64_t qdev_get_prop_mask64(Property *prop) =20 static void bit64_prop_set(Object *obj, Property *props, bool val) { - DeviceState *dev =3D DEVICE(obj); - uint64_t *p =3D qdev_get_prop_ptr(dev, props); + uint64_t *p =3D qdev_get_prop_ptr(obj, props); uint64_t mask =3D qdev_get_prop_mask64(props); if (val) { *p |=3D mask; @@ -169,9 +165,8 @@ static void bit64_prop_set(Object *obj, Property *props= , bool val) static void prop_get_bit64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint64_t *p =3D qdev_get_prop_ptr(dev, prop); + uint64_t *p =3D qdev_get_prop_ptr(obj, prop); bool value =3D (*p & qdev_get_prop_mask64(prop)) !=3D 0; =20 visit_type_bool(v, name, &value, errp); @@ -208,9 +203,8 @@ const PropertyInfo qdev_prop_bit64 =3D { static void get_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - bool *ptr =3D qdev_get_prop_ptr(dev, prop); + bool *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_bool(v, name, ptr, errp); } @@ -220,7 +214,7 @@ static void set_bool(Object *obj, Visitor *v, const cha= r *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - bool *ptr =3D qdev_get_prop_ptr(dev, prop); + bool *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -242,9 +236,8 @@ const PropertyInfo qdev_prop_bool =3D { static void get_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint8_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint8_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); } @@ -254,7 +247,7 @@ static void set_uint8(Object *obj, Visitor *v, const ch= ar *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint8_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint8_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -288,9 +281,8 @@ const PropertyInfo qdev_prop_uint8 =3D { void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint16_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint16_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_uint16(v, name, ptr, errp); } @@ -300,7 +292,7 @@ static void set_uint16(Object *obj, Visitor *v, const c= har *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint16_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint16_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -322,9 +314,8 @@ const PropertyInfo qdev_prop_uint16 =3D { static void get_uint32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } @@ -334,7 +325,7 @@ static void set_uint32(Object *obj, Visitor *v, const c= har *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -347,9 +338,8 @@ static void set_uint32(Object *obj, Visitor *v, const c= har *name, void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - int32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_int32(v, name, ptr, errp); } @@ -359,7 +349,7 @@ static void set_int32(Object *obj, Visitor *v, const ch= ar *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - int32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -388,9 +378,8 @@ const PropertyInfo qdev_prop_int32 =3D { static void get_uint64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_uint64(v, name, ptr, errp); } @@ -400,7 +389,7 @@ static void set_uint64(Object *obj, Visitor *v, const c= har *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -413,9 +402,8 @@ static void set_uint64(Object *obj, Visitor *v, const c= har *name, static void get_int64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - int64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + int64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_int64(v, name, ptr, errp); } @@ -425,7 +413,7 @@ static void set_int64(Object *obj, Visitor *v, const ch= ar *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - int64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + int64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -454,15 +442,14 @@ const PropertyInfo qdev_prop_int64 =3D { static void release_string(Object *obj, const char *name, void *opaque) { Property *prop =3D opaque; - g_free(*(char **)qdev_get_prop_ptr(DEVICE(obj), prop)); + g_free(*(char **)qdev_get_prop_ptr(obj, prop)); } =20 static void get_string(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - char **ptr =3D qdev_get_prop_ptr(dev, prop); + char **ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (!*ptr) { char *str =3D (char *)""; @@ -477,7 +464,7 @@ static void set_string(Object *obj, Visitor *v, const c= har *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - char **ptr =3D qdev_get_prop_ptr(dev, prop); + char **ptr =3D qdev_get_prop_ptr(obj, prop); char *str; =20 if (dev->realized) { @@ -515,9 +502,8 @@ const PropertyInfo qdev_prop_on_off_auto =3D { void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); uint64_t value =3D *ptr; =20 visit_type_size(v, name, &value, errp); @@ -528,7 +514,7 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); uint64_t value; =20 if (dev->realized) { @@ -563,9 +549,8 @@ const PropertyInfo qdev_prop_size32 =3D { static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - QemuUUID *uuid =3D qdev_get_prop_ptr(dev, prop); + QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); char buffer[UUID_FMT_LEN + 1]; char *p =3D buffer; =20 @@ -581,7 +566,7 @@ static void set_uuid(Object *obj, Visitor *v, const cha= r *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - QemuUUID *uuid =3D qdev_get_prop_ptr(dev, prop); + QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); char *str; =20 if (dev->realized) { @@ -653,7 +638,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, */ DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *alenptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *alenptr =3D qdev_get_prop_ptr(obj, prop); void **arrayptr =3D (void *)dev + prop->arrayoffset; void *eltptr; const char *arrayname; @@ -699,7 +684,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, * being inside the device struct. */ arrayprop->prop.offset =3D eltptr - (void *)dev; - assert(qdev_get_prop_ptr(dev, &arrayprop->prop) =3D=3D eltptr); + assert(qdev_get_prop_ptr(obj, &arrayprop->prop) =3D=3D eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, arrayprop->prop.info->get, @@ -893,9 +878,8 @@ void qdev_prop_set_globals(DeviceState *dev) static void get_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_size(v, name, ptr, errp); } @@ -905,7 +889,7 @@ static void set_size(Object *obj, Visitor *v, const cha= r *name, void *opaque, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 9961cfe7bf..2b8f33fec2 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2343,9 +2343,8 @@ void css_reset(void) static void get_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - CssDevId *dev_id =3D qdev_get_prop_ptr(dev, prop); + CssDevId *dev_id =3D qdev_get_prop_ptr(obj, prop); char buffer[] =3D "xx.x.xxxx"; char *p =3D buffer; int r; @@ -2375,7 +2374,7 @@ static void set_css_devid(Object *obj, Visitor *v, co= nst char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - CssDevId *dev_id =3D qdev_get_prop_ptr(dev, prop); + CssDevId *dev_id =3D qdev_get_prop_ptr(obj, prop); char *str; int num, n1, n2; unsigned int cssid, ssid, devid; diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 05f7460aec..8b6be1197b 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1330,7 +1330,7 @@ static void s390_pci_get_fid(Object *obj, Visitor *v,= const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(DEVICE(obj), prop); + uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } @@ -1341,7 +1341,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v,= const char *name, DeviceState *dev =3D DEVICE(obj); S390PCIBusDevice *zpci =3D S390_PCI_DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 57150913b7..53569925a2 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1488,9 +1488,8 @@ static void get_nv_gpudirect_clique_id(Object *obj, V= isitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint8_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint8_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); } @@ -1501,7 +1500,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, V= isitor *v, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint8_t value, *ptr =3D qdev_get_prop_ptr(dev, prop); + uint8_t value, *ptr =3D qdev_get_prop_ptr(obj, prop); =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726038; cv=none; d=zohomail.com; s=zohoarc; b=TwB1zVj41hR4DYsJgpn4C1+oZnfeFq3r5JZg45PqjJENZeLjBo6WsgYALAUXqlgSA3qnd2p3UHsldxzka/waVdl78MTjAp0WTIg3THdacqGssYd9slG9YqY08602xgF8tLJRa32U9+FLtmtp7QUIC2qKu39HAiZzCZ9jLStzpTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726038; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=se/CSfFnnsEjx4A0VjeSVdWKnhZ06lA5owfIsLbeW28=; b=Ywy4NCKXN3AKlB6Phzizh6DZjxY12vltdr8EzFqPlQliEKjLUcjETNcrNiRV0jgmffUnuKEjoPHA/HfYb0EtN21qq96Wor3IwzO/HjPSEfa0hq/63PT03kFYvorQ5F0z++NO9RPb/hOK0JcgbxDAGmN+ZLumC/GA9Q5CZEEMLgM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607726038881728.7439519769841; Fri, 11 Dec 2020 14:33:58 -0800 (PST) Received: from localhost ([::1]:55492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqz4-0006HB-Kv for importer@patchew.org; Fri, 11 Dec 2020 17:33:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYX-00025h-As for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57153) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYS-0006QZ-P9 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:28 -0500 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-515-vEE2xpGdOwaj9ZL2M93S_w-1; Fri, 11 Dec 2020 17:06:20 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33036801817; Fri, 11 Dec 2020 22:06:19 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id A591D5D9E2; Fri, 11 Dec 2020 22:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724384; 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=se/CSfFnnsEjx4A0VjeSVdWKnhZ06lA5owfIsLbeW28=; b=L1M3AERikAYyYG0ptE2Nb3OkE94ZIlyskla3bN1jZmpxTSst68uy3V2H39l5np+6wumgwS OngFXe+Nd6AkLcavRuADuJszPtojMI8/FJ0ywEaIYbs5G8JvmNUryh33SRYWB0qSMQ/XhG Etg9lKU6kFznAkQslWuKqwQQ4Ho0yp0= X-MC-Unique: vEE2xpGdOwaj9ZL2M93S_w-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 10/32] qdev: Make qdev_find_global_prop() get Object* argument Date: Fri, 11 Dec 2020 17:05:07 -0500 Message-Id: <20201211220529.2290218-11-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 2 +- hw/core/qdev-properties.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0b92cfc761..7620095fed 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -305,7 +305,7 @@ void qdev_prop_set_enum(DeviceState *dev, const char *n= ame, int value); void *qdev_get_prop_ptr(Object *obj, Property *prop); =20 void qdev_prop_register_global(GlobalProperty *prop); -const GlobalProperty *qdev_find_global_prop(DeviceState *dev, +const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 9ac9b95852..57e63c6949 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -36,7 +36,7 @@ static bool check_prop_still_unset(DeviceState *dev, cons= t char *name, const void *old_val, const char *new_va= l, Error **errp) { - const GlobalProperty *prop =3D qdev_find_global_prop(dev, name); + const GlobalProperty *prop =3D qdev_find_global_prop(OBJECT(dev), name= ); =20 if (!old_val) { return true; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 0a54a922c8..41482d83d1 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -818,7 +818,7 @@ void qdev_prop_register_global(GlobalProperty *prop) g_ptr_array_add(global_props(), prop); } =20 -const GlobalProperty *qdev_find_global_prop(DeviceState *dev, +const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name) { GPtrArray *props =3D global_props(); @@ -827,7 +827,7 @@ const GlobalProperty *qdev_find_global_prop(DeviceState= *dev, =20 for (i =3D 0; i < props->len; i++) { p =3D g_ptr_array_index(props, i); - if (object_dynamic_cast(OBJECT(dev), p->driver) + if (object_dynamic_cast(obj, p->driver) && !strcmp(p->property, name)) { return p; } --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725781; cv=none; d=zohomail.com; s=zohoarc; b=gBmAdt0XisCdzoMS7HYwQ8NBT0+5Xb5kwQ3WvvHIcb9Jbs4mFKyaceEUI8vXiN9z0BnMAw9N3ZQ6ydDyF2Xyd4YxTxKP3tKovuwsfL9DSlGsr1XNfND+8hLtmQfTNouu/nZo/BmCXCbAisW+1vY6PiFLGyq7RZ1cFVE9LO/bCro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725781; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NNwDZxam41mBFYC0/kSKCZ9uKdCTsOHrGa/hT2A5NEc=; b=gH8KNLF2G9eo2KCd3SdiN3vdjv09fqlyVaNjwZdYswF7a0fcofv9K/3Hn3ArojZ7lc7uib8PWIu83/gn5LPAeapqE2//oTSICttFytcmcAFHrLQSTtXmHUwvmDZ7I9a1xITXoriSlDuyRNzv8ldCU+E+GrUGPKDEyp2wUEIDPPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725781330470.3844756215683; Fri, 11 Dec 2020 14:29:41 -0800 (PST) Received: from localhost ([::1]:47124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knquy-0002WB-4e for importer@patchew.org; Fri, 11 Dec 2020 17:29:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYW-00024U-Pl for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYS-0006Pc-Dn for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:28 -0500 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-548-ER2PqIGHNYeSl_kj0GJ5dQ-1; Fri, 11 Dec 2020 17:06:21 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F473C295; Fri, 11 Dec 2020 22:06:20 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id C900E5D9E2; Fri, 11 Dec 2020 22:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724383; 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=NNwDZxam41mBFYC0/kSKCZ9uKdCTsOHrGa/hT2A5NEc=; b=BDWQsfar56xG8jlkFFAwnDyfeP5+rrRbTzC5u6FlOc7fCPzHWqZ1AQew3Zmp2rSPN1kjZz 4r6T3jN6eEdbok/Jn9GwatFgwE5IWW37DDM2cjnZBRe3aPNcHm8uRo1Y8nTEPF9nNtNJmy IBntR6G2aJ3U1E84KWUbtDXCm4cMmvg= X-MC-Unique: ER2PqIGHNYeSl_kj0GJ5dQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 11/32] qdev: Make check_prop_still_unset() get Object* argument Date: Fri, 11 Dec 2020 17:05:08 -0500 Message-Id: <20201211220529.2290218-12-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties-system.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 57e63c6949..58bb129bbe 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -32,11 +32,11 @@ #include "hw/pci/pci.h" #include "util/block-helpers.h" =20 -static bool check_prop_still_unset(DeviceState *dev, const char *name, +static bool check_prop_still_unset(Object *obj, const char *name, const void *old_val, const char *new_va= l, Error **errp) { - const GlobalProperty *prop =3D qdev_find_global_prop(OBJECT(dev), name= ); + const GlobalProperty *prop =3D qdev_find_global_prop(obj, name); =20 if (!old_val) { return true; @@ -105,7 +105,7 @@ static void set_drive_helper(Object *obj, Visitor *v, c= onst char *name, * TODO Should this really be an error? If no, the old value * needs to be released before we store the new one. */ - if (!check_prop_still_unset(dev, name, *ptr, str, errp)) { + if (!check_prop_still_unset(obj, name, *ptr, str, errp)) { return; } =20 @@ -247,7 +247,7 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, * TODO Should this really be an error? If no, the old value * needs to be released before we store the new one. */ - if (!check_prop_still_unset(dev, name, be->chr, str, errp)) { + if (!check_prop_still_unset(obj, name, be->chr, str, errp)) { return; } =20 @@ -429,7 +429,7 @@ static void set_netdev(Object *obj, Visitor *v, const c= har *name, * TODO Should this really be an error? If no, the old value * needs to be released before we store the new one. */ - if (!check_prop_still_unset(dev, name, ncs[i], str, errp)) { + if (!check_prop_still_unset(obj, name, ncs[i], str, errp)) { goto out; } =20 --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725271; cv=none; d=zohomail.com; s=zohoarc; b=hDCWvfJXFo9LqqXGrKTGN5T/f2nfvtwEeRPUueNaOH08jf5kO6+s9T8ABAxQwZ8bbTqYWXRtHQUujvHXr4/Myl+CMT6Ahw6qbgXnHcrob1jPYFEJIAW1nme/lyCsg3B3Wkeegaf5GUL7RhcppBK6Js44IADA/haIO19s+mV9A1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725271; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XX27a+pKt9cyw75ahkBxQx2IPWE0Zr334zcWJyfbtRA=; b=ISqIPX4HiDwDbsYffy0nltbADA28mKkgxQJMVUhXPE+/0a+wb9luodx61w1BmY61DPL2/Bj2wUrh4A3WxyzK10foep3rBJqM2BVa/msARxyI9qxAJ9zkcdhyQyynGeeaGnmgKd5ICVhY9Y5BB5R8UYH1AI/4GGNLXKT+7gcj1fU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725271386462.22967588881465; Fri, 11 Dec 2020 14:21:11 -0800 (PST) Received: from localhost ([::1]:59226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqmk-0003X9-09 for importer@patchew.org; Fri, 11 Dec 2020 17:21:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYY-00027a-MK for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYW-0006SE-JR for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:30 -0500 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-128-psjbeefpNbqps8wD62Sagg-1; Fri, 11 Dec 2020 17:06:26 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB29D1005504; Fri, 11 Dec 2020 22:06:24 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F72E19C78; Fri, 11 Dec 2020 22:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724387; 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=XX27a+pKt9cyw75ahkBxQx2IPWE0Zr334zcWJyfbtRA=; b=gp29x2EC+UDyqvduYKIEkrjJYjVhhI0QHmlfvAedTeMSqigdCcsmlolpqPOlHQMxrvgdzC rrpgQrgreKUBbo54ze/j1gmvFzVw8sNwbu5tAVP6xdZyIWVx/J0zCJbZ4f28aFAe6vYUu7 P+HpVf+AeL9/U062PnGg+QcHYMMcl00= X-MC-Unique: psjbeefpNbqps8wD62Sagg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 12/32] qdev: Make error_set_from_qdev_prop_error() get Object* argument Date: Fri, 11 Dec 2020 17:05:09 -0500 Message-Id: <20201211220529.2290218-13-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , "Daniel P. Berrange" , David Hildenbrand , John Snow , Cornelia Huck , Markus Armbruster , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Cornelia Huck #s390 parts Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: Cornelia Huck Cc: Thomas Huth Cc: Richard Henderson Cc: David Hildenbrand Cc: Halil Pasic Cc: Christian Borntraeger Cc: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 10 +++++----- hw/core/qdev-properties.c | 10 +++++----- hw/s390x/css.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 7620095fed..530286e869 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -309,7 +309,7 @@ const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); -void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *de= v, +void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, Property *prop, const char *value); =20 /** diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 58bb129bbe..5796ed2619 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -352,7 +352,7 @@ static void set_mac(Object *obj, Visitor *v, const char= *name, void *opaque, return; =20 inval: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); g_free(str); } =20 @@ -440,7 +440,7 @@ static void set_netdev(Object *obj, Visitor *v, const c= har *name, peers_ptr->queues =3D queues; =20 out: - error_set_from_qdev_prop_error(errp, err, dev, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, prop, str); g_free(str); } =20 @@ -492,7 +492,7 @@ static void set_audiodev(Object *obj, Visitor *v, const= char* name, card->state =3D state; =20 out: - error_set_from_qdev_prop_error(errp, err, dev, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, prop, str); g_free(str); } =20 @@ -790,7 +790,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, cons= t char *name, return; =20 invalid: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); g_free(str); } =20 @@ -914,7 +914,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *= v, const char *name, return; =20 inval: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); g_free(str); } =20 diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 41482d83d1..5e010afdb8 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -581,7 +581,7 @@ static void set_uuid(Object *obj, Visitor *v, const cha= r *name, void *opaque, if (!strcmp(str, UUID_VALUE_AUTO)) { qemu_uuid_generate(uuid); } else if (qemu_uuid_parse(str, uuid) < 0) { - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); } g_free(str); } @@ -735,22 +735,22 @@ static Property *qdev_prop_find(DeviceState *dev, con= st char *name) return NULL; } =20 -void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *de= v, +void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, Property *prop, const char *value) { switch (ret) { case -EEXIST: error_setg(errp, "Property '%s.%s' can't take value '%s', it's in = use", - object_get_typename(OBJECT(dev)), prop->name, value); + object_get_typename(obj), prop->name, value); break; default: case -EINVAL: error_setg(errp, QERR_PROPERTY_VALUE_BAD, - object_get_typename(OBJECT(dev)), prop->name, value); + object_get_typename(obj), prop->name, value); break; case -ENOENT: error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(OBJECT(dev)), prop->name, value); + object_get_typename(obj), prop->name, value); break; case 0: break; diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 2b8f33fec2..38fd46b9a9 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2390,7 +2390,7 @@ static void set_css_devid(Object *obj, Visitor *v, co= nst char *name, =20 num =3D sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2= ); if (num !=3D 3 || (n2 - n1) !=3D 5 || strlen(str) !=3D n2) { - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); goto out; } if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) { --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725422; cv=none; d=zohomail.com; s=zohoarc; b=eT69AO4iEhODEfDv8JCy/20rdjKYVnHOWjGEgm/N6d3jRjZZTNe2q8Ka4f7dAqozLfVOO1iIetf6VffoCIT/28PLaYC7jXEMp7B917MzBLEsAIWP5+iUJTOiOssPTVc9x0V8puwW4vVmzsheEkj21GILUkXdNgxd9CtQ7Vkj65k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725422; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IjXLNzryal4KWXA/thVCt00XPDIwSnxo4OtC/UV3xq4=; b=YAnNaZUHEwR9pFIr/K9aZO2ZNrs8aQ6Dx39K2Ye96PXyPtb1s/y0jMNUPWQTCe682b3owC92L2JQILwjochoMV4DoJGAqRvBAleUnHEVtGWZEs1v6M4uKcCYKF+/JQnP8piZiV3v3ETNw6K9y7phu9pkb27FzI73x3oEDUkyRQM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160772542206337.57679619694113; Fri, 11 Dec 2020 14:23:42 -0800 (PST) Received: from localhost ([::1]:35366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqpA-0005f6-JA for importer@patchew.org; Fri, 11 Dec 2020 17:23:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYg-0002Fn-DA for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYb-0006Tu-Py for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:38 -0500 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-249-Tq2Q4CmoOI6D7a9BzbvFyA-1; Fri, 11 Dec 2020 17:06:30 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3C598799E0; Fri, 11 Dec 2020 22:06:28 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAFF41002391; Fri, 11 Dec 2020 22:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724393; 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=IjXLNzryal4KWXA/thVCt00XPDIwSnxo4OtC/UV3xq4=; b=XwV/U4R5TyHPsc8IdPH+YXCfUEXvq7bT71VD/mtbs6WRQpuFyBMXB6BvwgG7fPxDV/Yzm8 /pcQ4NEsgaZ3YXBfxJmWBw6zDxWj0lKacXDap7XqTM7idO6IzWzfwxHghUL8eGMV/yYLvX 9NSoTNCfEFq3Lp5pP0SSPd05WArX0rw= X-MC-Unique: Tq2Q4CmoOI6D7a9BzbvFyA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 13/32] qdev: Make qdev_propinfo_get_uint16() static Date: Fri, 11 Dec 2020 17:05:10 -0500 Message-Id: <20201211220529.2290218-14-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There are no users of the function outside qdev-properties.c. Make function static and rename it to get_uint16(). Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-prop-internal.h | 2 -- hw/core/qdev-properties.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index 9cf5cc1d51..d7b77844fe 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -20,8 +20,6 @@ void qdev_propinfo_set_default_value_int(ObjectProperty *= op, void qdev_propinfo_set_default_value_uint(ObjectProperty *op, const Property *prop); =20 -void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp); void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 5e010afdb8..765e916c23 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -278,8 +278,8 @@ const PropertyInfo qdev_prop_uint8 =3D { =20 /* --- 16bit integer --- */ =20 -void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void get_uint16(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop =3D opaque; uint16_t *ptr =3D qdev_get_prop_ptr(obj, prop); @@ -304,7 +304,7 @@ static void set_uint16(Object *obj, Visitor *v, const c= har *name, =20 const PropertyInfo qdev_prop_uint16 =3D { .name =3D "uint16", - .get =3D qdev_propinfo_get_uint16, + .get =3D get_uint16, .set =3D set_uint16, .set_default_value =3D qdev_propinfo_set_default_value_uint, }; --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725536; cv=none; d=zohomail.com; s=zohoarc; b=GoF4j4wAU4+/jbivmk4i0miB4tcP2VplMOwvn4sdY/XNNXcsl+wpAE+V8yYl2X0T2dyM2C+S3elHLAaTFZ9vmEAXNGpAgROWa4bIvqdFacH6BIwRph7BSbZuokQn6lHrUOHeYkWkzO4EfJiyqgfVqo0CoqdB9rtDBlZLkb3bTc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725536; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c1cowUAPhboaK6MM4IV3XTYMcZw0/4iYoiElx5gir9M=; b=CwCaQH8B3oO+otU9b11C8Tvlg0MNvLhL8wfa8OV7CEhqcVGmUlzAKPhiyMEPIw30EgqqNU+SrYPQ0aQSs6SiiaZGJib4+NwHSM/Kprlh0hlYha9e4e2MZIeeRnQbyZArS4dH0zuuF4cBMYyPBLI5nyNYMmTk0DevrCm2Ulik+9c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725536587832.4123522695412; Fri, 11 Dec 2020 14:25:36 -0800 (PST) Received: from localhost ([::1]:39266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqr1-0007Rd-52 for importer@patchew.org; Fri, 11 Dec 2020 17:25:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYs-0002IK-4h for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYf-0006VP-Sz for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:46 -0500 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-549-rUPbKMa0PHWDickY0WZHMw-1; Fri, 11 Dec 2020 17:06:34 -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 AC8D2801817; Fri, 11 Dec 2020 22:06:33 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 536705F9C2; Fri, 11 Dec 2020 22:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724396; 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=c1cowUAPhboaK6MM4IV3XTYMcZw0/4iYoiElx5gir9M=; b=PM7wekEwv/WQTK5h3lyRJ7Mvr0sxsaxx5GqUbD2gi1LsJRMOnlB8WZarCVkmW/8W5GH2ef TSGgeL0MZNeEoPWS7FKkLuJsoyDJkXQTnunZrsUxJnEA3E6dkzf9j1jqS2Vbg3HlOP0qft n9ptN24rltFYNjzEdM96rci2zEWoHN4= X-MC-Unique: rUPbKMa0PHWDickY0WZHMw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 14/32] qdev: Move UUID property to qdev-properties-system.c Date: Fri, 11 Dec 2020 17:05:11 -0500 Message-Id: <20201211220529.2290218-15-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Only softmmu code uses DEFINE_PROP_UUID, and it currently depends on error_set_from_qdev_prop_error(). Move it to qdev-properties-system.c to get out of our way when refactoring the qdev property system. We can eventually move it back to the core property system later, after removing usage of error_set_from_qdev_prop_error(). Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties-system.c | 57 ++++++++++++++++++++++++++++++++ hw/core/qdev-properties.c | 57 -------------------------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 5796ed2619..7a9a1d6404 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -21,6 +21,7 @@ #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/units.h" +#include "qemu/uuid.h" #include "qemu/error-report.h" #include "qdev-prop-internal.h" =20 @@ -1106,3 +1107,59 @@ const PropertyInfo qdev_prop_pcie_link_width =3D { .set =3D set_prop_pcielinkwidth, .set_default_value =3D qdev_propinfo_set_default_value_enum, }; + +/* --- UUID --- */ + +static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, + Error **errp) +{ + Property *prop =3D opaque; + QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); + char buffer[UUID_FMT_LEN + 1]; + char *p =3D buffer; + + qemu_uuid_unparse(uuid, buffer); + + visit_type_str(v, name, &p, errp); +} + +#define UUID_VALUE_AUTO "auto" + +static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, + Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); + char *str; + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + if (!visit_type_str(v, name, &str, errp)) { + return; + } + + if (!strcmp(str, UUID_VALUE_AUTO)) { + qemu_uuid_generate(uuid); + } else if (qemu_uuid_parse(str, uuid) < 0) { + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + } + g_free(str); +} + +static void set_default_uuid_auto(ObjectProperty *op, const Property *prop) +{ + object_property_set_default_str(op, UUID_VALUE_AUTO); +} + +const PropertyInfo qdev_prop_uuid =3D { + .name =3D "str", + .description =3D "UUID (aka GUID) or \"" UUID_VALUE_AUTO + "\" for random value (default)", + .get =3D get_uuid, + .set =3D set_uuid, + .set_default_value =3D set_default_uuid_auto, +}; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 765e916c23..a2eaa43831 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -6,7 +6,6 @@ #include "qemu/ctype.h" #include "qemu/error-report.h" #include "qapi/visitor.h" -#include "qemu/uuid.h" #include "qemu/units.h" #include "qemu/cutils.h" #include "qdev-prop-internal.h" @@ -544,62 +543,6 @@ const PropertyInfo qdev_prop_size32 =3D { .set_default_value =3D qdev_propinfo_set_default_value_uint, }; =20 -/* --- UUID --- */ - -static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - Property *prop =3D opaque; - QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); - char buffer[UUID_FMT_LEN + 1]; - char *p =3D buffer; - - qemu_uuid_unparse(uuid, buffer); - - visit_type_str(v, name, &p, errp); -} - -#define UUID_VALUE_AUTO "auto" - -static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - DeviceState *dev =3D DEVICE(obj); - Property *prop =3D opaque; - QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); - char *str; - - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - - if (!visit_type_str(v, name, &str, errp)) { - return; - } - - if (!strcmp(str, UUID_VALUE_AUTO)) { - qemu_uuid_generate(uuid); - } else if (qemu_uuid_parse(str, uuid) < 0) { - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); - } - g_free(str); -} - -static void set_default_uuid_auto(ObjectProperty *op, const Property *prop) -{ - object_property_set_default_str(op, UUID_VALUE_AUTO); -} - -const PropertyInfo qdev_prop_uuid =3D { - .name =3D "str", - .description =3D "UUID (aka GUID) or \"" UUID_VALUE_AUTO - "\" for random value (default)", - .get =3D get_uuid, - .set =3D set_uuid, - .set_default_value =3D set_default_uuid_auto, -}; - /* --- support for array properties --- */ =20 /* Used as an opaque for the object properties we add for each --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725797; cv=none; d=zohomail.com; s=zohoarc; b=RwfswPDpVBYY6Iegqp1n+en03ap5uchx7sUUua6zVRCieuI1gmQ0KkP5MD5VbBFBuN7K2Wdxo1atdofG7/YG/mcRsEyeZcY1Ib/xVL3Yr1xEWfVry/GqIGX4q1g9lCCHRRhe0lghh4sc4moJtj2Drggvn9+apXwr+Jv5aZQfrkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725797; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SmTnXbbsE7bXPXl8+Sy2td+9ofxvYjafgykmwnstWWk=; b=dHoAPoewOHMJcFJ5TnvQRE9MGlzw8EWIHiZyiCuRJV6s6qhqAIk1ORhDOUooVuAQ2bLaIKjzWaL28oJYLwb3x5m0HUd1dytNX+xWWi5SzseXLWAPKxvhu4IOMNaK9xgGqg0NChyxHmbPDltAjaNuR0THdnal2QIzYrhpuihlKdk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725797983299.5682231573164; Fri, 11 Dec 2020 14:29:57 -0800 (PST) Received: from localhost ([::1]:47718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqvE-0002mk-Jf for importer@patchew.org; Fri, 11 Dec 2020 17:29:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ2-0002N1-TP for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYh-0006W4-4b for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:59 -0500 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-70-kKlAl5RhMRqsrQ2HJHeT_Q-1; Fri, 11 Dec 2020 17:06:36 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5DDF1858182; Fri, 11 Dec 2020 22:06:35 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 941261002391; Fri, 11 Dec 2020 22:06:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724398; 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=SmTnXbbsE7bXPXl8+Sy2td+9ofxvYjafgykmwnstWWk=; b=UNDcw37GeRJXx7pkgT+iLVzeGfLfXhcDvLi/T1ntFcdpxX4HZy5D1hbvDW6KZ3cMbkhs0l uszH3OU0a2U/EjGShSc5m1aLa9q+OJ2Q5nX8601JqsgIsRlZZs5FaU58P5X/zs+lCNCJQ1 yx40/K+xUpv4KFWvOPeKskd+2aFhoMY= X-MC-Unique: kKlAl5RhMRqsrQ2HJHeT_Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 15/32] qdev: Move softmmu properties to qdev-properties-system.h Date: Fri, 11 Dec 2020 17:05:12 -0500 Message-Id: <20201211220529.2290218-16-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Move the property types and property macros implemented in qdev-properties-system.c to a new qdev-properties-system.h header. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Move UUID property type too, as it was moved to qdev-properties-system.c in the previous patch --- audio/audio.h | 1 + include/hw/block/block.h | 1 + include/hw/qdev-properties-system.h | 84 +++++++++++++++++++++++++++++ include/hw/qdev-properties.h | 75 -------------------------- include/net/net.h | 1 + hw/acpi/vmgenid.c | 1 + hw/arm/pxa2xx.c | 1 + hw/arm/strongarm.c | 1 + hw/block/fdc.c | 1 + hw/block/m25p80.c | 1 + hw/block/nand.c | 1 + hw/block/onenand.c | 1 + hw/block/pflash_cfi01.c | 1 + hw/block/pflash_cfi02.c | 1 + hw/block/vhost-user-blk.c | 1 + hw/char/avr_usart.c | 1 + hw/char/bcm2835_aux.c | 1 + hw/char/cadence_uart.c | 1 + hw/char/cmsdk-apb-uart.c | 1 + hw/char/debugcon.c | 1 + hw/char/digic-uart.c | 1 + hw/char/escc.c | 1 + hw/char/etraxfs_ser.c | 1 + hw/char/exynos4210_uart.c | 1 + hw/char/grlib_apbuart.c | 1 + hw/char/ibex_uart.c | 1 + hw/char/imx_serial.c | 1 + hw/char/ipoctal232.c | 1 + hw/char/lm32_juart.c | 1 + hw/char/lm32_uart.c | 1 + hw/char/mcf_uart.c | 1 + hw/char/milkymist-uart.c | 1 + hw/char/nrf51_uart.c | 1 + hw/char/parallel.c | 1 + hw/char/pl011.c | 1 + hw/char/renesas_sci.c | 1 + hw/char/sclpconsole-lm.c | 1 + hw/char/sclpconsole.c | 1 + hw/char/serial-pci-multi.c | 1 + hw/char/serial.c | 1 + hw/char/spapr_vty.c | 1 + hw/char/stm32f2xx_usart.c | 1 + hw/char/terminal3270.c | 1 + hw/char/virtio-console.c | 1 + hw/char/xilinx_uartlite.c | 1 + hw/core/qdev-properties-system.c | 1 + hw/hyperv/vmbus.c | 1 + hw/i386/kvm/i8254.c | 1 + hw/ide/qdev.c | 1 + hw/ipmi/ipmi_bmc_extern.c | 1 + hw/ipmi/ipmi_bmc_sim.c | 1 + hw/misc/allwinner-sid.c | 1 + hw/misc/ivshmem.c | 1 + hw/misc/mac_via.c | 1 + hw/misc/sifive_u_otp.c | 1 + hw/net/rocker/rocker.c | 1 + hw/nvram/eeprom_at24c.c | 1 + hw/nvram/spapr_nvram.c | 1 + hw/pci-bridge/gen_pcie_root_port.c | 1 + hw/pci/pci.c | 1 + hw/ppc/pnv_pnor.c | 1 + hw/rdma/vmw/pvrdma_main.c | 1 + hw/rtc/mc146818rtc.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/sd/sd.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/redirect.c | 1 + hw/vfio/pci.c | 1 + hw/virtio/vhost-user-fs.c | 1 + hw/virtio/vhost-user-vsock.c | 1 + hw/virtio/virtio-iommu-pci.c | 1 + hw/xen/xen_pt.c | 1 + migration/migration.c | 1 + 76 files changed, 158 insertions(+), 75 deletions(-) create mode 100644 include/hw/qdev-properties-system.h diff --git a/audio/audio.h b/audio/audio.h index b883ebfb1f..21fe3226ae 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -28,6 +28,7 @@ #include "qemu/queue.h" #include "qapi/qapi-types-audio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" =20 typedef void (*audio_callback_fn) (void *opaque, int avail); =20 diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 1e8b6253dd..c172cbe65f 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -13,6 +13,7 @@ =20 #include "exec/hwaddr.h" #include "qapi/qapi-types-block-core.h" +#include "hw/qdev-properties-system.h" =20 /* Configuration */ =20 diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properti= es-system.h new file mode 100644 index 0000000000..29529dc999 --- /dev/null +++ b/include/hw/qdev-properties-system.h @@ -0,0 +1,84 @@ +#ifndef HW_QDEV_PROPERTIES_SYSTEM_H +#define HW_QDEV_PROPERTIES_SYSTEM_H + +#include "hw/qdev-properties.h" + +extern const PropertyInfo qdev_prop_chr; +extern const PropertyInfo qdev_prop_macaddr; +extern const PropertyInfo qdev_prop_reserved_region; +extern const PropertyInfo qdev_prop_multifd_compression; +extern const PropertyInfo qdev_prop_losttickpolicy; +extern const PropertyInfo qdev_prop_blockdev_on_error; +extern const PropertyInfo qdev_prop_bios_chs_trans; +extern const PropertyInfo qdev_prop_fdc_drive_type; +extern const PropertyInfo qdev_prop_drive; +extern const PropertyInfo qdev_prop_drive_iothread; +extern const PropertyInfo qdev_prop_netdev; +extern const PropertyInfo qdev_prop_pci_devfn; +extern const PropertyInfo qdev_prop_blocksize; +extern const PropertyInfo qdev_prop_pci_host_devaddr; +extern const PropertyInfo qdev_prop_uuid; +extern const PropertyInfo qdev_prop_audiodev; +extern const PropertyInfo qdev_prop_off_auto_pcibar; +extern const PropertyInfo qdev_prop_pcie_link_speed; +extern const PropertyInfo qdev_prop_pcie_link_width; + +#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t) + +#define DEFINE_PROP_CHR(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend) +#define DEFINE_PROP_NETDEV(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) +#define DEFINE_PROP_DRIVE(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) +#define DEFINE_PROP_DRIVE_IOTHREAD(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_drive_iothread, BlockBackend *) +#define DEFINE_PROP_MACADDR(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr) +#define DEFINE_PROP_RESERVED_REGION(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_reserved_region, ReservedRegion) +#define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ + MultiFDCompression) +#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ + LostTickPolicy) +#define DEFINE_PROP_BLOCKDEV_ON_ERROR(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_blockdev_on_error, \ + BlockdevOnError) +#define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int) +#define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ + DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t) +#define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddre= ss) +#define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \ + OffAutoPCIBAR) +#define DEFINE_PROP_PCIE_LINK_SPEED(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_speed, \ + PCIExpLinkSpeed) +#define DEFINE_PROP_PCIE_LINK_WIDTH(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \ + PCIExpLinkWidth) + +#define DEFINE_PROP_UUID(_name, _state, _field) { \ + .name =3D (_name), \ + .info =3D &qdev_prop_uuid, \ + .offset =3D offsetof(_state, _field) \ + + type_check(QemuUUID, typeof_field(_state, _field)), \ + .set_default =3D true, \ + } +#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) + +#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ + .name =3D (_name), \ + .info =3D &qdev_prop_uuid, \ + .offset =3D offsetof(_state, _field) \ + + type_check(QemuUUID, typeof_field(_state, _field)), \ + } + + +#endif diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 530286e869..d35d4aae84 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -55,30 +55,11 @@ extern const PropertyInfo qdev_prop_uint64; extern const PropertyInfo qdev_prop_int64; extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; -extern const PropertyInfo qdev_prop_chr; extern const PropertyInfo qdev_prop_tpm; -extern const PropertyInfo qdev_prop_macaddr; -extern const PropertyInfo qdev_prop_reserved_region; extern const PropertyInfo qdev_prop_on_off_auto; -extern const PropertyInfo qdev_prop_multifd_compression; -extern const PropertyInfo qdev_prop_losttickpolicy; -extern const PropertyInfo qdev_prop_blockdev_on_error; -extern const PropertyInfo qdev_prop_bios_chs_trans; -extern const PropertyInfo qdev_prop_fdc_drive_type; -extern const PropertyInfo qdev_prop_drive; -extern const PropertyInfo qdev_prop_drive_iothread; -extern const PropertyInfo qdev_prop_netdev; -extern const PropertyInfo qdev_prop_pci_devfn; extern const PropertyInfo qdev_prop_size32; -extern const PropertyInfo qdev_prop_blocksize; -extern const PropertyInfo qdev_prop_pci_host_devaddr; -extern const PropertyInfo qdev_prop_uuid; extern const PropertyInfo qdev_prop_arraylen; -extern const PropertyInfo qdev_prop_audiodev; extern const PropertyInfo qdev_prop_link; -extern const PropertyInfo qdev_prop_off_auto_pcibar; -extern const PropertyInfo qdev_prop_pcie_link_speed; -extern const PropertyInfo qdev_prop_pcie_link_width; =20 #define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ .name =3D (_name), \ @@ -209,68 +190,12 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) -#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t) - -#define DEFINE_PROP_CHR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend) #define DEFINE_PROP_STRING(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) -#define DEFINE_PROP_NETDEV(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) -#define DEFINE_PROP_DRIVE(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) -#define DEFINE_PROP_DRIVE_IOTHREAD(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_drive_iothread, BlockBackend *) -#define DEFINE_PROP_MACADDR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr) -#define DEFINE_PROP_RESERVED_REGION(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_reserved_region, ReservedRegion) #define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto) -#define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ - MultiFDCompression) -#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ - LostTickPolicy) -#define DEFINE_PROP_BLOCKDEV_ON_ERROR(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_blockdev_on_error, \ - BlockdevOnError) -#define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int) #define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t) -#define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t) -#define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddre= ss) -#define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \ - OffAutoPCIBAR) -#define DEFINE_PROP_PCIE_LINK_SPEED(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_speed, \ - PCIExpLinkSpeed) -#define DEFINE_PROP_PCIE_LINK_WIDTH(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \ - PCIExpLinkWidth) - -#define DEFINE_PROP_UUID(_name, _state, _field) { \ - .name =3D (_name), \ - .info =3D &qdev_prop_uuid, \ - .offset =3D offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - .set_default =3D true, \ - } -#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) - -#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ - .name =3D (_name), \ - .info =3D &qdev_prop_uuid, \ - .offset =3D offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - } =20 #define DEFINE_PROP_END_OF_LIST() \ {} diff --git a/include/net/net.h b/include/net/net.h index 778fc787ca..919facaad2 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -4,6 +4,7 @@ #include "qemu/queue.h" #include "qapi/qapi-types-net.h" #include "net/queue.h" +#include "hw/qdev-properties-system.h" =20 #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X" #define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \ diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index 2c8152d508..6c92fdae49 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -19,6 +19,7 @@ #include "hw/acpi/vmgenid.h" #include "hw/nvram/fw_cfg.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "sysemu/reset.h" =20 diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 1a98f3bd5c..fdc4955e95 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -21,6 +21,7 @@ #include "hw/i2c/i2c.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h" #include "hw/sd/sd.h" #include "chardev/char-fe.h" diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index ca7c385f31..c7ca54bcea 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -33,6 +33,7 @@ #include "hw/boards.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "strongarm.h" diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 4c2c35e223..3636874432 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -36,6 +36,7 @@ #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "hw/block/block.h" diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index d09a811767..93bd1821ff 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -25,6 +25,7 @@ #include "qemu/units.h" #include "sysemu/block-backend.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h" #include "migration/vmstate.h" #include "qemu/bitops.h" diff --git a/hw/block/nand.c b/hw/block/nand.c index 1d7a48a2ec..1c098db897 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" #include "migration/vmstate.h" diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 5ff7be86bb..579a73d7f7 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -24,6 +24,7 @@ #include "hw/block/flash.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "exec/memory.h" #include "hw/sysbus.h" diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index daae965860..ccf326793d 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -40,6 +40,7 @@ #include "hw/block/block.h" #include "hw/block/flash.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "qapi/error.h" #include "qemu/error-report.h" diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 1b3d94e047..2ad2f6baea 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -36,6 +36,7 @@ #include "hw/block/block.h" #include "hw/block/flash.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/bitmap.h" diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 2dd3d93ca0..da4fbf9084 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -22,6 +22,7 @@ #include "qemu/cutils.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-user-blk.h" #include "hw/virtio/virtio.h" diff --git a/hw/char/avr_usart.c b/hw/char/avr_usart.c index fbe2a112b7..5bcf9db0b7 100644 --- a/hw/char/avr_usart.c +++ b/hw/char/avr_usart.c @@ -24,6 +24,7 @@ #include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" =20 static int avr_usart_can_receive(void *opaque) { diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index dade2ab5fd..96410b1ff8 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -24,6 +24,7 @@ #include "hw/char/bcm2835_aux.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index e196906c92..c603e14012 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -32,6 +32,7 @@ #include "hw/char/cadence_uart.h" #include "hw/irq.h" #include "hw/qdev-clock.h" +#include "hw/qdev-properties-system.h" #include "trace.h" =20 #ifdef CADENCE_UART_ERR_DEBUG diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c index 626b68f2ec..ba2cbbee3d 100644 --- a/hw/char/cmsdk-apb-uart.c +++ b/hw/char/cmsdk-apb-uart.c @@ -27,6 +27,7 @@ #include "chardev/char-serial.h" #include "hw/char/cmsdk-apb-uart.h" #include "hw/irq.h" +#include "hw/qdev-properties-system.h" =20 REG32(DATA, 0) REG32(STATE, 4) diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 2a063ad72c..fdb04fee09 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -30,6 +30,7 @@ #include "chardev/char-fe.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" =20 #define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon" diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c index e130cb4692..00e5df5517 100644 --- a/hw/char/digic-uart.c +++ b/hw/char/digic-uart.c @@ -35,6 +35,7 @@ =20 #include "hw/char/digic-uart.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" =20 enum { ST_RX_RDY =3D (1 << 0), diff --git a/hw/char/escc.c b/hw/char/escc.c index 7d16ee8688..52e7978287 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "qemu/module.h" diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c index d9fba2ae6c..6bee3ee18e 100644 --- a/hw/char/etraxfs_ser.c +++ b/hw/char/etraxfs_ser.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "chardev/char-fe.h" #include "qemu/log.h" diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 96afe3580f..6361df2ad3 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -32,6 +32,7 @@ #include "hw/arm/exynos4210.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" =20 #include "trace.h" #include "qom/object.h" diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 3f80f6824e..82ff40a530 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sparc/grlib.h" #include "hw/sysbus.h" #include "qemu/module.h" diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c index cc49a35013..89f1182c9b 100644 --- a/hw/char/ibex_uart.c +++ b/hw/char/ibex_uart.c @@ -30,6 +30,7 @@ #include "hw/irq.h" #include "hw/qdev-clock.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 731b8fc64c..ee1375e26d 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -22,6 +22,7 @@ #include "hw/char/imx_serial.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index ad000a39b9..3311e0872c 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -12,6 +12,7 @@ #include "hw/ipack/ipack.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/bitops.h" #include "qemu/module.h" diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c index aced357011..ce30279650 100644 --- a/hw/char/lm32_juart.c +++ b/hw/char/lm32_juart.c @@ -26,6 +26,7 @@ =20 #include "hw/char/lm32_juart.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" =20 enum { diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c index 2f58e2943b..d8e0331311 100644 --- a/hw/char/lm32_uart.c +++ b/hw/char/lm32_uart.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "trace.h" diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index e6814faffb..6fa4ac502c 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -13,6 +13,7 @@ #include "qapi/error.h" #include "hw/m68k/mcf.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "chardev/char-fe.h" #include "qom/object.h" =20 diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index a817c51eb5..cb1b3470ad 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "trace.h" diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c index d1fef77acd..045ca5fa40 100644 --- a/hw/char/nrf51_uart.c +++ b/hw/char/nrf51_uart.c @@ -18,6 +18,7 @@ #include "hw/char/nrf51_uart.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "trace.h" =20 diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 8b418abf71..b45e67bfbb 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -32,6 +32,7 @@ #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "hw/char/parallel.h" #include "sysemu/reset.h" diff --git a/hw/char/pl011.c b/hw/char/pl011.c index ede16c781c..ea4a4e5235 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -23,6 +23,7 @@ #include "hw/irq.h" #include "hw/sysbus.h" #include "hw/qdev-clock.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "chardev/char-fe.h" #include "qemu/log.h" diff --git a/hw/char/renesas_sci.c b/hw/char/renesas_sci.c index 5d7c6e6523..1c63467290 100644 --- a/hw/char/renesas_sci.c +++ b/hw/char/renesas_sci.c @@ -26,6 +26,7 @@ #include "hw/irq.h" #include "hw/registerfields.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/char/renesas_sci.h" #include "migration/vmstate.h" =20 diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 81f6d0ed4f..b9e9b2d453 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -23,6 +23,7 @@ #include "migration/vmstate.h" #include "hw/s390x/event-facility.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/ebcdic.h" #include "qom/object.h" =20 diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index aa72ab40b9..c36b572222 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -20,6 +20,7 @@ #include "hw/s390x/sclp.h" #include "migration/vmstate.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/event-facility.h" #include "chardev/char-fe.h" #include "qom/object.h" diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 2cf3e44177..3a9f96c2d1 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -33,6 +33,7 @@ #include "hw/irq.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" =20 #define PCI_SERIAL_MAX_PORTS 4 diff --git a/hw/char/serial.c b/hw/char/serial.c index 62c627f486..6e52539648 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -36,6 +36,7 @@ #include "qemu/error-report.h" #include "trace.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" =20 #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ =20 diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index e726d4d915..79eaa2fa52 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -8,6 +8,7 @@ #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" =20 #define VTERM_BUFSIZE 16 diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index 0d661be6d3..8df0832424 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -26,6 +26,7 @@ #include "hw/char/stm32f2xx_usart.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/log.h" #include "qemu/module.h" =20 diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index d77981bb6d..a9a46c8ed3 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -16,6 +16,7 @@ #include "qemu/module.h" #include "chardev/char-fe.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/3270-ccw.h" #include "qom/object.h" =20 diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index bc752cf90f..6b132caa29 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -16,6 +16,7 @@ #include "qemu/module.h" #include "trace.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/virtio-serial.h" #include "qapi/error.h" #include "qapi/qapi-events-char.h" diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index 2e773ec4c4..99b9a6f851 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -26,6 +26,7 @@ #include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "qemu/module.h" #include "chardev/char-fe.h" diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 7a9a1d6404..e2d523b27a 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -12,6 +12,7 @@ =20 #include "qemu/osdep.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "qapi/qapi-types-block.h" diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index 896e981f85..984caf898d 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -13,6 +13,7 @@ #include "qapi/error.h" #include "migration/vmstate.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/hyperv/hyperv.h" #include "hw/hyperv/vmbus.h" #include "hw/hyperv/vmbus-bridge.h" diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index 40d84734e7..c73254e886 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -32,6 +32,7 @@ #include "sysemu/runstate.h" #include "hw/timer/i8254.h" #include "hw/timer/i8254_internal.h" +#include "hw/qdev-properties-system.h" #include "sysemu/kvm.h" #include "qom/object.h" =20 diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1086b7a327..8cd19fa5e9 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -26,6 +26,7 @@ #include "qemu/module.h" #include "hw/ide/internal.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/block/block.h" diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index c3f3306e66..e141a5cd45 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -35,6 +35,7 @@ #include "chardev/char-fe.h" #include "hw/ipmi/ipmi.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qom/object.h" =20 diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index f78e92d3d5..55fb81fa5a 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -30,6 +30,7 @@ #include "qemu/module.h" #include "hw/loader.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" =20 #define IPMI_NETFN_CHASSIS 0x00 diff --git a/hw/misc/allwinner-sid.c b/hw/misc/allwinner-sid.c index 196380c33a..6d61f55b1d 100644 --- a/hw/misc/allwinner-sid.c +++ b/hw/misc/allwinner-sid.c @@ -26,6 +26,7 @@ #include "qemu/guest-random.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/misc/allwinner-sid.h" #include "trace.h" =20 diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index e321e5cb69..0505b52c98 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -23,6 +23,7 @@ #include "qemu/cutils.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "sysemu/kvm.h" diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index 6db62dab7d..488d086a17 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -28,6 +28,7 @@ #include "qapi/error.h" #include "qemu/cutils.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "trace.h" #include "qemu/log.h" diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c index 60066375ab..4401787a5c 100644 --- a/hw/misc/sifive_u_otp.c +++ b/hw/misc/sifive_u_otp.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index 1af1e6fa2f..0fb8db1dee 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -18,6 +18,7 @@ #include "qemu/osdep.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "hw/pci/msix.h" #include "net/net.h" diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c index 3e93dbbffb..af6f5dbb99 100644 --- a/hw/nvram/eeprom_at24c.c +++ b/hw/nvram/eeprom_at24c.c @@ -13,6 +13,7 @@ #include "qemu/module.h" #include "hw/i2c/i2c.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "qom/object.h" =20 diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index fc53a42572..9e51bc82ae 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -39,6 +39,7 @@ #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" =20 struct SpaprNvram { diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_ro= ot_port.c index 8931afc049..ec9907917e 100644 --- a/hw/pci-bridge/gen_pcie_root_port.c +++ b/hw/pci-bridge/gen_pcie_root_port.c @@ -16,6 +16,7 @@ #include "hw/pci/msix.h" #include "hw/pci/pcie_port.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qom/object.h" =20 diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 9424231542..b09208f562 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -31,6 +31,7 @@ #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/qemu-file-types.h" #include "migration/vmstate.h" #include "monitor/monitor.h" diff --git a/hw/ppc/pnv_pnor.c b/hw/ppc/pnv_pnor.c index c365ee58b8..ef8dff03e0 100644 --- a/hw/ppc/pnv_pnor.c +++ b/hw/ppc/pnv_pnor.c @@ -17,6 +17,7 @@ #include "hw/loader.h" #include "hw/ppc/pnv_pnor.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" =20 static uint64_t pnv_pnor_read(void *opaque, hwaddr addr, unsigned size) { diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 77b1235a3f..8593570332 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -21,6 +21,7 @@ #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "cpu.h" #include "trace.h" #include "monitor/monitor.h" diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index 7a38540cb9..5d0fcacd0c 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -30,6 +30,7 @@ #include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "sysemu/replay.h" diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 90841ad791..29504ea081 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -34,6 +34,7 @@ #include "sysemu/blockdev.h" #include "hw/block/block.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" #include "qemu/cutils.h" diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 2cb23ca891..9740f7e36a 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -19,6 +19,7 @@ #include "hw/scsi/scsi.h" #include "migration/qemu-file-types.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/scsi/emulation.h" #include "sysemu/block-backend.h" #include "trace.h" diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 7c0631656c..4666019442 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -21,6 +21,7 @@ #include "hw/fw-path-provider.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-backend.h" #include "hw/virtio/vhost-user-scsi.h" diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 1842c03797..2aeab39c3f 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -42,6 +42,7 @@ #include "qapi/error.h" #include "qemu/bitmap.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/error-report.h" #include "qemu/timer.h" #include "qemu/log.h" diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index e8e9d37e88..c27c602697 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -14,6 +14,7 @@ #include #include "chardev/char-fe.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/module.h" diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 19e1933f04..b58c4eb908 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -14,6 +14,7 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/usb.h" #include "migration/vmstate.h" #include "desc.h" diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 3238de6bb8..0b7e0e15f4 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -42,6 +42,7 @@ #include =20 #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/usb.h" #include "migration/qemu-file-types.h" #include "migration/vmstate.h" diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 51dc373695..f74be78209 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -27,6 +27,7 @@ #include "hw/pci/msix.h" #include "hw/pci/pci_bridge.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index 1bc5d03a00..ed036ad9c1 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -16,6 +16,7 @@ #include "standard-headers/linux/virtio_fs.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" #include "qemu/error-report.h" diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c index 3534a39d62..a6f08c26b9 100644 --- a/hw/virtio/vhost-user-vsock.c +++ b/hw/virtio/vhost-user-vsock.c @@ -13,6 +13,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost-user-vsock.h" =20 static const int user_feature_bits[] =3D { diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 378f63b210..770c286be7 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -14,6 +14,7 @@ #include "virtio-pci.h" #include "hw/virtio/virtio-iommu.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "hw/boards.h" #include "qom/object.h" diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 6d359ee486..3cbd08b10e 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -58,6 +58,7 @@ =20 #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/xen/xen.h" #include "hw/i386/pc.h" #include "hw/xen/xen-legacy-backend.h" diff --git a/migration/migration.c b/migration/migration.c index e0dbde4091..cfbf46b77d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -52,6 +52,7 @@ #include "migration/colo.h" #include "hw/boards.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "monitor/monitor.h" #include "net/announce.h" #include "qemu/queue.h" --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725995; cv=none; d=zohomail.com; s=zohoarc; b=L+35ktGGKQ5vTyJYoOe68CV5xbv/eN5hygYmLelL7W9EKT8wdBjUAnO2/83Ld4Pgrd5Y78/VbV1hGjJryp7JxrX3F3K3k6Ze3qEnjlHhNydo5PTLMbzU9qG1Vef7xk9SRGjsbxiB1KLfq2/IoEbzqr0moZu7oHu7e0ztwcyGFxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725995; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=42qmy84WjZoUzL6hvj8BR/4hg53C3KSeiLhnNSHXnjQ=; b=hl3Ki8zslEwsh7xXYV9moB99b2fQvtGjD04LQzJ1ZRpzgdu1eNq9rjpKUiI34VdccgZuFg6Sg4kR88dvW6KT3QB2pN/6f8TU+7ZN6xdS+ocRBLX3x1OwEF9DQZ3Rn3kqIlbDC5TSoSRAX8FeMNPK5AjFD4L2YlPAy3lOoWdAl0I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725995409174.33267717679917; Fri, 11 Dec 2020 14:33:15 -0800 (PST) Received: from localhost ([::1]:53042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqyQ-0005Av-0P for importer@patchew.org; Fri, 11 Dec 2020 17:33:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYx-0002Jd-Tw for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYi-0006WL-AD for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:53 -0500 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-287-8GB1pLf6OAi4hbqvvXw2xg-1; Fri, 11 Dec 2020 17:06:37 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AEE5D800D53; Fri, 11 Dec 2020 22:06:36 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 441CC1992D; Fri, 11 Dec 2020 22:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724399; 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=42qmy84WjZoUzL6hvj8BR/4hg53C3KSeiLhnNSHXnjQ=; b=ZCQR6iYFlSZhhOa2c0vxdNqv9dW/GuBE5+kLRNHzcd2Izp+qqKFXjJnF5Dfnq2UX6m4m1I vE1O9MYhPAa2gelPR7rCHyoqFWqH8UwpZ7Z6+dj6gJfxyeSMqLdKsL0EOfSTyCt3SpqgYX h0GlK8A0gxE2DqFdJmgmYxRYIgSoK3Q= X-MC-Unique: 8GB1pLf6OAi4hbqvvXw2xg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 16/32] qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros Date: Fri, 11 Dec 2020 17:05:13 -0500 Message-Id: <20201211220529.2290218-17-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Instead of duplicating the code that sets name, info, offset, and does type checking, make DEFINE_PROP accept a variable number of arguments and reuse it in all DEFINE_PROP_* macros. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Redone after UUID property was moved --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties-system.h | 19 ++--- include/hw/qdev-properties.h | 114 ++++++++++------------------ 2 files changed, 46 insertions(+), 87 deletions(-) diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properti= es-system.h index 29529dc999..0ac327ae60 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -63,22 +63,15 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \ PCIExpLinkWidth) =20 -#define DEFINE_PROP_UUID(_name, _state, _field) { \ - .name =3D (_name), \ - .info =3D &qdev_prop_uuid, \ - .offset =3D offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - .set_default =3D true, \ - } +#define DEFINE_PROP_UUID(_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID, \ + .set_default =3D true) + #define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) =20 -#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ - .name =3D (_name), \ - .info =3D &qdev_prop_uuid, \ - .offset =3D offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - } +#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID) =20 =20 #endif diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index d35d4aae84..1b58e4f922 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -61,73 +61,46 @@ extern const PropertyInfo qdev_prop_size32; extern const PropertyInfo qdev_prop_arraylen; extern const PropertyInfo qdev_prop_link; =20 -#define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ +#define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ .name =3D (_name), \ .info =3D &(_prop), \ .offset =3D offsetof(_state, _field) \ + type_check(_type, typeof_field(_state, _field)), \ + __VA_ARGS__ \ } =20 -#define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) {= \ - .name =3D (_name), \ - .info =3D &(_prop), \ - .offset =3D offsetof(_state, _field) \ - + type_check(_type,typeof_field(_state, _field)), \ - .set_default =3D true, \ - .defval.i =3D (_type)_defval, \ - } +#define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) \ + DEFINE_PROP(_name, _state, _field, _prop, _type, \ + .set_default =3D true, = \ + .defval.i =3D (_type)_defval) =20 -#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) = { \ - .name =3D (_name), \ - .info =3D &(_prop), \ - .offset =3D offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - } +#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \ + DEFINE_PROP(_name, _state, _field, _prop, _type) =20 -#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) { \ - .name =3D (_name), \ - .info =3D &(qdev_prop_bit), \ - .bitnr =3D (_bit), \ - .offset =3D offsetof(_state, _field) \ - + type_check(uint32_t,typeof_field(_state, _field)), \ - .set_default =3D true, \ - .defval.u =3D (bool)_defval, \ - } +#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_bit, uint32_t, \ + .bitnr =3D (_bit), \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval) =20 -#define DEFINE_PROP_UNSIGNED(_name, _state, _field, _defval, _prop, _type)= { \ - .name =3D (_name), \ - .info =3D &(_prop), \ - .offset =3D offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - .set_default =3D true, \ - .defval.u =3D (_type)_defval, \ - } +#define DEFINE_PROP_UNSIGNED(_name, _state, _field, _defval, _prop, _type)= \ + DEFINE_PROP(_name, _state, _field, _prop, _type, = \ + .set_default =3D true, = \ + .defval.u =3D (_type)_defval) =20 -#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type= ) { \ - .name =3D (_name), \ - .info =3D &(_prop), \ - .offset =3D offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - } +#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type= ) \ + DEFINE_PROP(_name, _state, _field, _prop, _type) =20 -#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) { \ - .name =3D (_name), \ - .info =3D &(qdev_prop_bit64), \ - .bitnr =3D (_bit), \ - .offset =3D offsetof(_state, _field) \ - + type_check(uint64_t, typeof_field(_state, _field)), \ - .set_default =3D true, \ - .defval.u =3D (bool)_defval, \ - } +#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_bit64, uint64_t, \ + .bitnr =3D (_bit), \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval) =20 -#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) { \ - .name =3D (_name), \ - .info =3D &(qdev_prop_bool), \ - .offset =3D offsetof(_state, _field) \ - + type_check(bool, typeof_field(_state, _field)), \ - .set_default =3D true, \ - .defval.u =3D (bool)_defval, \ - } +#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool, \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval) =20 #define PROP_ARRAY_LEN_PREFIX "len-" =20 @@ -155,26 +128,19 @@ extern const PropertyInfo qdev_prop_link; * It is the responsibility of the device deinit code to free the * @_arrayfield memory. */ -#define DEFINE_PROP_ARRAY(_name, _state, _field, \ - _arrayfield, _arrayprop, _arraytype) { \ - .name =3D (PROP_ARRAY_LEN_PREFIX _name), \ - .info =3D &(qdev_prop_arraylen), \ - .set_default =3D true, \ - .defval.u =3D 0, \ - .offset =3D offsetof(_state, _field) \ - + type_check(uint32_t, typeof_field(_state, _field)), \ - .arrayinfo =3D &(_arrayprop), \ - .arrayfieldsize =3D sizeof(_arraytype), \ - .arrayoffset =3D offsetof(_state, _arrayfield), \ - } +#define DEFINE_PROP_ARRAY(_name, _state, _field, \ + _arrayfield, _arrayprop, _arraytype) \ + DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \ + _state, _field, qdev_prop_arraylen, uint32_t, \ + .set_default =3D true, \ + .defval.u =3D 0, \ + .arrayinfo =3D &(_arrayprop), \ + .arrayfieldsize =3D sizeof(_arraytype), \ + .arrayoffset =3D offsetof(_state, _arrayfield)) =20 -#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) { \ - .name =3D (_name), \ - .info =3D &(qdev_prop_link), \ - .offset =3D offsetof(_state, _field) \ - + type_check(_ptr_type, typeof_field(_state, _field)), \ - .link_type =3D _type, \ - } +#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_link, _ptr_type, \ + .link_type =3D _type) =20 #define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t) --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725672; cv=none; d=zohomail.com; s=zohoarc; b=S3N2FsI2nh5B/s198+x/aQjUwVaaGe2GCkwTSQQykSQTp39x+klrm9kCCdfKf2rSA6d1pRDrFcNgN7eliEUeng5hH3qoIjM6fqvFvPP4VI94UE1WxClW1k4J+EaSpeJvnbVKeu4wHcYhMlxLDT7g4z4kg1P+6buNXHCrni/QWWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725672; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v0OYcJD8ULew1lFLtVeyVk5+wXUJ4NVXpBHlG34GMlI=; b=IwmbOSxJFrkjVvKQZqI9yjkso4sEqbGVihqL8kJkl1PDS6NBkbULUXySUCJC8VjeifAOmCsJqQ2o37WfrUkQTjmhUgefDWonauSgZbc5MDFFp+MX+ehDKum+genGA6b+RvbMFIN6v8Pa1TE6vc77len70AWcAoTMx5GnbZZrv5E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725672345997.418776133085; Fri, 11 Dec 2020 14:27:52 -0800 (PST) Received: from localhost ([::1]:44308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqtD-0001ET-2Z for importer@patchew.org; Fri, 11 Dec 2020 17:27:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYy-0002Jf-0N for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYo-0006YY-6j for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:55 -0500 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-155-h8JmbpGrP_WjR9rrTIy3-g-1; Fri, 11 Dec 2020 17:06:40 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F3DCC292; Fri, 11 Dec 2020 22:06:39 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id C899119C78; Fri, 11 Dec 2020 22:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724404; 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=v0OYcJD8ULew1lFLtVeyVk5+wXUJ4NVXpBHlG34GMlI=; b=AbdSTF+KFgK+U9cTvcEYCiAyETChv2dI1VcsjQJSTe+bc35a51gJFBDngASZXibr1bxAIp 08L3fRO92D4bhq16z2QthuGbAOnOWl/CA6bjzQqPkVKsG91+8rh45ZZnltyz7dgGv4wlJW RLyaGoaukhtHhgWJAEwrtHcnae7cRL0= X-MC-Unique: h8JmbpGrP_WjR9rrTIy3-g-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 17/32] sparc: Use DEFINE_PROP for nwindows property Date: Fri, 11 Dec 2020 17:05:14 -0500 Message-Id: <20201211220529.2290218-18-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use the DEFINE_PROP macro (which will set extra fields in the struct) instead of initializing a Property struct manually. Signed-off-by: Eduardo Habkost Acked-by: Mark Cave-Ayland Reviewed-by: Igor Mammedov --- This is a new patch added in v2 of the series --- Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org --- target/sparc/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 6a3299041f..92534bcd18 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] =3D { qdev_prop_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0), DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0), - { .name =3D "nwindows", .info =3D &qdev_prop_nwindows }, + DEFINE_PROP("nwindows", SPARCCPU, env.def.nwindows, + qdev_prop_nwindows, uint32_t), DEFINE_PROP_END_OF_LIST() }; =20 --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725537; cv=none; d=zohomail.com; s=zohoarc; b=Dp1CtHNx+IzBmCeZtZyYk6oFpWdP33S6Zp+BQwkdfEdbdBQ+PktN/jQ/jSS5/PH4ofWhl6Flg6Xr7q96s1v3ZZ003PepLGwDr4qPI3mSj4FAyT9Xo8C9os5kabu/jdVhE/RG24H+PbU+UQ2iQbS35vhPO05gC/mGPN7FdiiEWWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725537; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7mauuiBzwc4imnwBuzDLwKVVcVa+v3UBaGy4quUlinA=; b=mGgPTA96akXwxefc6F6Fd/QJHzXlqQ6QdgJOeChXjFCzS6gkaoiNe96P530Zt+Iz1jqveXh8yUDl3Vw/senfcubaCg8wNE77EfEOPnkO3bIaTeVVLUoNgXkPykI9SGSQKqcL/TH1SuevJYldQmYNfE7WUpNSOTZavodyeX7+aIs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160772553715571.09862342849772; Fri, 11 Dec 2020 14:25:37 -0800 (PST) Received: from localhost ([::1]:39226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqr2-0007Qh-1C for importer@patchew.org; Fri, 11 Dec 2020 17:25:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ2-0002Nd-PE for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYv-0006Yg-7V for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 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-523-MJbOsA0LPw2-P_GgyAd-dw-1; Fri, 11 Dec 2020 17:06:45 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A3CFB19251A3; Fri, 11 Dec 2020 22:06:43 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 453EF100AE31; Fri, 11 Dec 2020 22:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724406; 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=7mauuiBzwc4imnwBuzDLwKVVcVa+v3UBaGy4quUlinA=; b=XvSADjZLoOASdLGxTBuI4veiXnwhrKm4x2hPJcfEp3eUMWPSc4rhmdwB7HBdKwLsAUYI6E w0kylAt/rE5iUO5ZdF0xHdHUjVfP7Zpt9Fj4VW0QH2lXKpt6jxelRMWok3o9uVT0onn00L bDEt3GTjH5ubdSDU5tJsSJnd83h6dUw= X-MC-Unique: MJbOsA0LPw2-P_GgyAd-dw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 18/32] qdev: Get just property name at error_set_from_qdev_prop_error() Date: Fri, 11 Dec 2020 17:05:15 -0500 Message-Id: <20201211220529.2290218-19-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , "Daniel P. Berrange" , David Hildenbrand , John Snow , Cornelia Huck , Markus Armbruster , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Replace `Property *prop` parameter with `char *name`, to reduce dependency of getter and setter functions on the Property struct (which will be changed in following patches). Signed-off-by: Eduardo Habkost Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: Cornelia Huck Cc: Halil Pasic Cc: Christian Borntraeger Cc: Thomas Huth Cc: Richard Henderson Cc: David Hildenbrand Cc: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 12 ++++++------ hw/core/qdev-properties.c | 8 ++++---- hw/s390x/css.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 1b58e4f922..476737b9da 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -201,7 +201,7 @@ const GlobalProperty *qdev_find_global_prop(Object *obj, int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, - Property *prop, const char *value); + const char *name, const char *value); =20 /** * qdev_property_add_static: diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index e2d523b27a..9cf9bcb39d 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -354,7 +354,7 @@ static void set_mac(Object *obj, Visitor *v, const char= *name, void *opaque, return; =20 inval: - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); g_free(str); } =20 @@ -442,7 +442,7 @@ static void set_netdev(Object *obj, Visitor *v, const c= har *name, peers_ptr->queues =3D queues; =20 out: - error_set_from_qdev_prop_error(errp, err, obj, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, name, str); g_free(str); } =20 @@ -494,7 +494,7 @@ static void set_audiodev(Object *obj, Visitor *v, const= char* name, card->state =3D state; =20 out: - error_set_from_qdev_prop_error(errp, err, obj, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, name, str); g_free(str); } =20 @@ -792,7 +792,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, cons= t char *name, return; =20 invalid: - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); g_free(str); } =20 @@ -916,7 +916,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *= v, const char *name, return; =20 inval: - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); g_free(str); } =20 @@ -1146,7 +1146,7 @@ static void set_uuid(Object *obj, Visitor *v, const c= har *name, void *opaque, if (!strcmp(str, UUID_VALUE_AUTO)) { qemu_uuid_generate(uuid); } else if (qemu_uuid_parse(str, uuid) < 0) { - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); } g_free(str); } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a2eaa43831..7495798a66 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -679,21 +679,21 @@ static Property *qdev_prop_find(DeviceState *dev, con= st char *name) } =20 void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, - Property *prop, const char *value) + const char *name, const char *value) { switch (ret) { case -EEXIST: error_setg(errp, "Property '%s.%s' can't take value '%s', it's in = use", - object_get_typename(obj), prop->name, value); + object_get_typename(obj), name, value); break; default: case -EINVAL: error_setg(errp, QERR_PROPERTY_VALUE_BAD, - object_get_typename(obj), prop->name, value); + object_get_typename(obj), name, value); break; case -ENOENT: error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(obj), prop->name, value); + object_get_typename(obj), name, value); break; case 0: break; diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 38fd46b9a9..7a44320d12 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2390,7 +2390,7 @@ static void set_css_devid(Object *obj, Visitor *v, co= nst char *name, =20 num =3D sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2= ); if (num !=3D 3 || (n2 - n1) !=3D 5 || strlen(str) !=3D n2) { - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); goto out; } if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) { --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726103; cv=none; d=zohomail.com; s=zohoarc; b=BBKbc8RlBTWN6Hk6bkHSPHBQdwwGE3FNjZmuKcDjBkexyVnt93UHxNedTW92UYy6R8KzEmD+XJ6afBSIAtD5zqe6oDqRxke9uUkrJ9Ps5rvaDyZ6dzXuKh/IiKiOI7/7iIho20l6Trv5jnFsf70r6gg6asbX5NOBkaaeAbI6c1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726103; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SwohITxyFWU/J3+ZNl1FjYGd75UOCRPuk88VupGgQOg=; b=UaxocZsEA3YbVlzfB68amFRmRE9/A3crwtj09bSX6u+SRg08eQdTgO+rG7F3ZjtfhqdCsCM8YeMmNi33sm/WJs3YiLQDrN6XZT6zZG4C+SiRdZBY79tTfu8D0zkG0n/+fLWxexOXzEHiLPOi9NSJLyCbF+6vYhlo72GKuEiq1vs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607726103667926.9815368368292; Fri, 11 Dec 2020 14:35:03 -0800 (PST) Received: from localhost ([::1]:56502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr0A-0006gI-DL for importer@patchew.org; Fri, 11 Dec 2020 17:35:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ3-0002Or-D6 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYx-0006ZK-M4 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 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-213-jkLnWQVeOCWdAC8ES600QA-1; Fri, 11 Dec 2020 17:06:49 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9428E19251A1; Fri, 11 Dec 2020 22:06:48 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48B785D71D; Fri, 11 Dec 2020 22:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724413; 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=SwohITxyFWU/J3+ZNl1FjYGd75UOCRPuk88VupGgQOg=; b=gOm+I8b6GV8a3V8gGEhQZuTgn/GULktXa1PgqD7987zYDWOZjRrXlW/pqe3SCgHDUkPL5E m0zj05gkpXgPgUVmaUCgyHW8/orPGcZHTx6WOWxuQdnLf9Ekg2cMU4YxIygxfIM/jQqpgw CLaVJU03IpJv7cM+a8U/UdZRN66UCjY= X-MC-Unique: jkLnWQVeOCWdAC8ES600QA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 19/32] qdev: Avoid using prop->name unnecessarily Date: Fri, 11 Dec 2020 17:05:16 -0500 Message-Id: <20201211220529.2290218-20-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , Stefan Berger , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We already get the property name as argument to the property getter and setters, we don't need to use prop->name. This will make it easier to remove the Property.name field in the future. Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Stefan Berger Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- backends/tpm/tpm_util.c | 2 +- hw/core/qdev-properties-system.c | 14 +++++++------- hw/core/qdev-properties.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index 3973105658..a5d997e7dc 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -63,7 +63,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *= name, void *opaque, s =3D qemu_find_tpm_be(str); if (s =3D=3D NULL) { error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(obj), prop->name, str); + object_get_typename(obj), name, str); } else if (tpm_backend_init(s, TPM_IF(obj), errp) =3D=3D 0) { *be =3D s; /* weak reference, avoid cyclic ref */ } diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 9cf9bcb39d..42529c3b65 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -141,7 +141,7 @@ static void set_drive_helper(Object *obj, Visitor *v, c= onst char *name, } if (!blk) { error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(OBJECT(dev)), prop->name, str); + object_get_typename(OBJECT(dev)), name, str); goto fail; } if (blk_attach_dev(blk, dev) < 0) { @@ -262,10 +262,10 @@ static void set_chr(Object *obj, Visitor *v, const ch= ar *name, void *opaque, s =3D qemu_chr_find(str); if (s =3D=3D NULL) { error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(obj), prop->name, str); + object_get_typename(obj), name, str); } else if (!qemu_chr_fe_init(be, s, errp)) { error_prepend(errp, "Property '%s.%s' can't take value '%s': ", - object_get_typename(obj), prop->name, str); + object_get_typename(obj), name, str); } g_free(str); } @@ -966,7 +966,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor= *v, const char *name, abort(); } =20 - visit_type_enum(v, prop->name, &speed, prop->info->enum_table, errp); + visit_type_enum(v, name, &speed, prop->info->enum_table, errp); } =20 static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *na= me, @@ -982,7 +982,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor= *v, const char *name, return; } =20 - if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table, + if (!visit_type_enum(v, name, &speed, prop->info->enum_table, errp)) { return; } @@ -1051,7 +1051,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visit= or *v, const char *name, abort(); } =20 - visit_type_enum(v, prop->name, &width, prop->info->enum_table, errp); + visit_type_enum(v, name, &width, prop->info->enum_table, errp); } =20 static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *na= me, @@ -1067,7 +1067,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visit= or *v, const char *name, return; } =20 - if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table, + if (!visit_type_enum(v, name, &width, prop->info->enum_table, errp)) { return; } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 7495798a66..50734a1cd4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -50,7 +50,7 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, cons= t char *name, Property *prop =3D opaque; int *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); + visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } =20 void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, @@ -65,7 +65,7 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, cons= t char *name, return; } =20 - visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); + visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } =20 void qdev_propinfo_set_default_value_enum(ObjectProperty *op, --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726474; cv=none; d=zohomail.com; s=zohoarc; b=IlS2ubAt6VgrE/nRw+SI0Rtl7oyEFTOVvJTncvV1V/5KrlLQ68KmgtpPcGDfplkEczmAm5UTLQEHULtbbxxAUAoDFGrDrtXpCNwNq14Kn2qrvXuSCKFVpniq8N60AXZxLmskdE1mQRmL/cATcnpDT8au1LOI2yjH4IjmwGxbNJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726474; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Lwaqf6oM5LFK2GgKtzI8ya9E8BvjKAWP4Qv1l6xx0NE=; b=fxY9ZR/TRsfP3oBnQ2oPvHYD1hG8hnFvC7O6NbSyNGEEdQkKsq+Eyqwpatl0xyQ6KQWfukVJe/x/rC8UO93CXWzleMhKlRQL8xS1z55W0rGolnw03mA1yTqXrt1Ni173GXYnZKM4mkPcPqbYzRv3wsgJFs9BWRyKGQmWy8IO6pA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607726474538286.176511966778; Fri, 11 Dec 2020 14:41:14 -0800 (PST) Received: from localhost ([::1]:37032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr69-00026B-6L for importer@patchew.org; Fri, 11 Dec 2020 17:41:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ5-0002RS-Fs for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYz-0006aT-M5 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:03 -0500 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-409-VCIEEqJfOMuOVgDzR5Fpcg-1; Fri, 11 Dec 2020 17:06:54 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 492AE100F340; Fri, 11 Dec 2020 22:06:53 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C80219C78; Fri, 11 Dec 2020 22:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724416; 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=Lwaqf6oM5LFK2GgKtzI8ya9E8BvjKAWP4Qv1l6xx0NE=; b=FfDlP2OWx3XPh2s7hFmKl8mgMzVnFZdPKJbdbytpT+X72cgwLHaZqc7pwZPIjLW61sJkZp 7J1JdyHmBvxNLApicRBjbmReQPUgeSovvfV6PL1aETMDSwFw6D5Yl9G6digdTfOI7U5gEc SBgSsth1PxARInXAunrrKnDtKtS3BfI= X-MC-Unique: VCIEEqJfOMuOVgDzR5Fpcg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 20/32] qdev: Add name parameter to qdev_class_add_property() Date: Fri, 11 Dec 2020 17:05:17 -0500 Message-Id: <20201211220529.2290218-21-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This will make it easier to remove Property.name in the future. Signed-off-by: Eduardo Habkost --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 50734a1cd4..457c7fe4ba 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -887,7 +887,8 @@ void qdev_property_add_static(DeviceState *dev, Propert= y *prop) } } =20 -static void qdev_class_add_property(DeviceClass *klass, Property *prop) +static void qdev_class_add_property(DeviceClass *klass, const char *name, + Property *prop) { ObjectClass *oc =3D OBJECT_CLASS(klass); =20 @@ -897,7 +898,7 @@ static void qdev_class_add_property(DeviceClass *klass,= Property *prop) ObjectProperty *op; =20 op =3D object_class_property_add(oc, - prop->name, prop->info->name, + name, prop->info->name, prop->info->get, prop->info->set, prop->info->release, prop); @@ -905,7 +906,7 @@ static void qdev_class_add_property(DeviceClass *klass,= Property *prop) prop->info->set_default_value(op, prop); } } - object_class_property_set_description(oc, prop->name, + object_class_property_set_description(oc, name, prop->info->description); } =20 @@ -962,7 +963,7 @@ void device_class_set_props(DeviceClass *dc, Property *= props) dc->props_ =3D props; for (prop =3D props; prop && prop->name; prop++) { qdev_class_add_legacy_property(dc, prop); - qdev_class_add_property(dc, prop); + qdev_class_add_property(dc, prop->name, prop); } } =20 --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726824; cv=none; d=zohomail.com; s=zohoarc; b=CM3+mEQa2JjpQa0oiNzpsnLxJm6tsYE0Rk34+Ke5mSEml4ked9iqQpAeyJiIW44yoMCcrJ40rgxE0q14VEiLESwWz9jU40ck0eUfcj9rkaHeJ1jBeiS61ud5G8aHMvycvkuboVFlBnwDhxPzXAp+tw52pXA/olRyuqYf07bwjF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726824; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rb9UJYi+UKMATl2563f+p9C77Lv2uescfU3uEmkQXTg=; b=RIcbHcUF/iNSwlKyD2H3Tp+AgEvJguyP0ZQiXdiRHN+joMIw+XnVADYy2N2IhJuTcNEZl8Ej0v0upaDGAkeuNcVo132lpEoHRPrOPpzwOwO5i4dv0rGWIlMmVmeAAerrpx0eEZW0acUy1QXJhznDzxKbsJcPyed/mEjm2nXA0cI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607726824465575.1549894129083; Fri, 11 Dec 2020 14:47:04 -0800 (PST) Received: from localhost ([::1]:45370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrBn-0005oM-Di for importer@patchew.org; Fri, 11 Dec 2020 17:47:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZE-0002bP-HC for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZ4-0006bz-OM for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:11 -0500 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-239-VK8YkakuP0i-HLKWJzJPpQ-1; Fri, 11 Dec 2020 17:06:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0209C801817; Fri, 11 Dec 2020 22:06:58 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B5055D9E2; Fri, 11 Dec 2020 22:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724421; 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=rb9UJYi+UKMATl2563f+p9C77Lv2uescfU3uEmkQXTg=; b=BXfb++tIpKaPFDYLsRVQtb31zA9yb7SIG37m5qhvR5H+Gvx7UsJOnRd22VfDAlXa8jKEjx xITtVN5+r8iI0vhO2iu+n63B4bSBQS2dzmkChl8s4p6WVC9nul4JvQx5U5gu0m179MDD8X ipdgGKj2P2mXtQaRcLtH4nOzXbvaZsc= X-MC-Unique: VK8YkakuP0i-HLKWJzJPpQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 21/32] qdev: Add name argument to PropertyInfo.create method Date: Fri, 11 Dec 2020 17:05:18 -0500 Message-Id: <20201211220529.2290218-22-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This will make it easier to remove the Property.name field in the future. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 476737b9da..ab9c538ba4 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -34,7 +34,7 @@ struct PropertyInfo { const QEnumLookup *enum_table; int (*print)(Object *obj, Property *prop, char *dest, size_t len); void (*set_default_value)(ObjectProperty *op, const Property *prop); - void (*create)(ObjectClass *oc, Property *prop); + void (*create)(ObjectClass *oc, const char *name, Property *prop); ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyRelease *release; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 457c7fe4ba..c68a20695d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -851,9 +851,10 @@ const PropertyInfo qdev_prop_size =3D { =20 /* --- object link property --- */ =20 -static void create_link_property(ObjectClass *oc, Property *prop) +static void create_link_property(ObjectClass *oc, const char *name, + Property *prop) { - object_class_property_add_link(oc, prop->name, prop->link_type, + object_class_property_add_link(oc, name, prop->link_type, prop->offset, qdev_prop_allow_set_link_before_realize, OBJ_PROP_LINK_STRONG); @@ -893,7 +894,7 @@ static void qdev_class_add_property(DeviceClass *klass,= const char *name, ObjectClass *oc =3D OBJECT_CLASS(klass); =20 if (prop->info->create) { - prop->info->create(oc, prop); + prop->info->create(oc, name, prop); } else { ObjectProperty *op; =20 --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607725874; cv=none; d=zohomail.com; s=zohoarc; b=NLntzpkAKdDORXCudQ60qf/FvBnmgPv4rawLJEq6h1lNeI879WMOGTsGAvge2viG3wepnNfiUg+vJp4wHzxb7YubG77bBsIlI+R5mz4xB4Q7q1v7c8QGckT9Co6yG4KIjpoqMIqMCjl3IbyxDptWObAhFvpdC1bRLhWMU9wi4zA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607725874; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IYld01Z63IvWlKMUi8NoC+O1zrbx+yCYFq9I1YV7iWs=; b=fGcXjWKsDs7HmzzQoSas6DhOMB6HMQHVVJBnLZ1Esoy+OWFEeqxBDWPBcUDMI5QOR2XfqMZTz3tvKUDZOdUAYEDUhVD4zE8d/etgFF7N+hpgxstUZIbFdu4BHuH0tgolYsFYIWdnBKj2sic6S0HivCTzurAXAb6er/nKD+ow9aM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607725874525846.8700510967121; Fri, 11 Dec 2020 14:31:14 -0800 (PST) Received: from localhost ([::1]:49466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqwT-0003Vt-AZ for importer@patchew.org; Fri, 11 Dec 2020 17:31:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZT-0002fL-QP for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZB-0006fD-FS for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:26 -0500 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-503-DFff8zPUNsaeumx0SNe9jg-1; Fri, 11 Dec 2020 17:07:04 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C991610054FF; Fri, 11 Dec 2020 22:07:03 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34F7260BE5; Fri, 11 Dec 2020 22:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724428; 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=IYld01Z63IvWlKMUi8NoC+O1zrbx+yCYFq9I1YV7iWs=; b=YAN6fr7lRbU/9KdTHyKfrjQjsPbDlinF2an8c53zVVorry+6brMUNpG6i2udxJp6ZvtfR1 LHTUeIRaLZlE++8rCDzEonUSpvHaLT9rtlmy6G+0F28K9xl8svR5RGqhzbkzg+3GFs8Mfd ODQNc+oQZeZiWxbEzVWW4wB7P7w/S6w= X-MC-Unique: DFff8zPUNsaeumx0SNe9jg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 22/32] qdev: Wrap getters and setters in separate helpers Date: Fri, 11 Dec 2020 17:05:19 -0500 Message-Id: <20201211220529.2290218-23-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We'll add extra code to the qdev property getters and setters, so add wrapper functions where additional actions can be performed. The new functions have a "field_prop_" prefix instead of "qdev_" because the code will eventually be moved outside qdev-properties.c, to common QOM code. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Redone after changes in previous patches in the series * Renamed functions from static_prop_* to field_prop_* --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 44 +++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c68a20695d..b924f13d58 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -44,6 +44,40 @@ void *qdev_get_prop_ptr(Object *obj, Property *prop) return ptr; } =20 +static void field_prop_get(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + return prop->info->get(obj, v, name, opaque, errp); +} + +/** + * field_prop_getter: Return getter function to be used for property + * + * Return value can be NULL if @info has no getter function. + */ +static ObjectPropertyAccessor *field_prop_getter(const PropertyInfo *info) +{ + return info->get ? field_prop_get : NULL; +} + +static void field_prop_set(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + return prop->info->set(obj, v, name, opaque, errp); +} + +/** + * field_prop_setter: Return setter function to be used for property + * + * Return value can be NULL if @info has not setter function. + */ +static ObjectPropertyAccessor *field_prop_setter(const PropertyInfo *info) +{ + return info->set ? field_prop_set : NULL; +} + void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -630,8 +664,8 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, assert(qdev_get_prop_ptr(obj, &arrayprop->prop) =3D=3D eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, - arrayprop->prop.info->get, - arrayprop->prop.info->set, + field_prop_getter(arrayprop->prop.info), + field_prop_setter(arrayprop->prop.info), array_element_release, arrayprop); } @@ -873,7 +907,8 @@ void qdev_property_add_static(DeviceState *dev, Propert= y *prop) assert(!prop->info->create); =20 op =3D object_property_add(obj, prop->name, prop->info->name, - prop->info->get, prop->info->set, + field_prop_getter(prop->info), + field_prop_setter(prop->info), prop->info->release, prop); =20 @@ -900,7 +935,8 @@ static void qdev_class_add_property(DeviceClass *klass,= const char *name, =20 op =3D object_class_property_add(oc, name, prop->info->name, - prop->info->get, prop->info->set, + field_prop_getter(prop->info), + field_prop_setter(prop->info), prop->info->release, prop); if (prop->set_default) { --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 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=1607724457; cv=none; d=zohomail.com; s=zohoarc; b=GxDRwR1JAd6d0oB1zis9XHReDJueQxoo1+HCkt+QADoDykTUDkxSHiaIaCjr6ZbolY3SZWhg3EBZJMtytII9X/+YZzJgc3RkzoE9WsW83DzQkUSa9lTi5OImUsA4pdxZI+h3w3dcVOB8gr9ZC3Zd/Ox5WhBWc2jqPew7xqu2usc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724457; 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=liR73qHgx91bdEvSe0pRJgUhS7neRyLuX3mOz/BU+gI=; b=G4leG/c8gUTi/gzbWoD5LbcBXXcnFWw7QZppKhLAyiIMD9G1a94FP7MrTYhFWAyZIoolJoREWciKlv26IJHdpnJc/vU5g6JaJNEQ4nb/w0kO485CnRn7JTz6Fq3FY2+yim3Q2PP6q/Kcj96HdQxHS76EfsYi1PPIEwHnMfOWtJM= 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 1607724457841686.6876571116425; Fri, 11 Dec 2020 14:07:37 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.50930.89789 (Exim 4.92) (envelope-from ) id 1knqZO-0006qe-6g; Fri, 11 Dec 2020 22:07:22 +0000 Received: by outflank-mailman (output) from mailman id 50930.89789; Fri, 11 Dec 2020 22:07:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knqZO-0006qX-2w; Fri, 11 Dec 2020 22:07:22 +0000 Received: by outflank-mailman (input) for mailman id 50930; Fri, 11 Dec 2020 22:07:20 +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 1knqZM-0006qM-ON for xen-devel@lists.xenproject.org; Fri, 11 Dec 2020 22:07:20 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id ad07fcae-a49e-428d-9bc2-121e19c1c9c6; Fri, 11 Dec 2020 22:07:19 +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-513-UpP2mNjkPBywjRPvEBuG2A-1; Fri, 11 Dec 2020 17:07:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9232C292; Fri, 11 Dec 2020 22:07:12 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB9BF5D9E2; Fri, 11 Dec 2020 22:07:04 +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: ad07fcae-a49e-428d-9bc2-121e19c1c9c6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724439; 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=liR73qHgx91bdEvSe0pRJgUhS7neRyLuX3mOz/BU+gI=; b=eg1tAX/G2AAy/coUwyuoVaHmJ4QWjK+OCIsXL2HEzBwN/WBmRBRO4VqxiTiQReCWDi1Ss+ kQjMExMTfoJLXRqX/wtrkceiht6Ik3h7bxKzuRRTkg/MH1HNvsxWMtUg/MgTcwNJdfLAb5 Clkdj/9Q5KZhQn7Zda1Ijjn3C4OCB8s= X-MC-Unique: UpP2mNjkPBywjRPvEBuG2A-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Cc: Markus Armbruster , Igor Mammedov , Stefan Berger , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Daniel P. Berrange" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow , Kevin Wolf , Eric Blake , Paolo Bonzini , Stefan Berger , Stefano Stabellini , Anthony Perard , Paul Durrant , Max Reitz , Cornelia Huck , Halil Pasic , Christian Borntraeger , Richard Henderson , David Hildenbrand , Thomas Huth , Matthew Rosato , Alex Williamson , Mark Cave-Ayland , Artyom Tarasenko , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v4 23/32] qdev: Move dev->realized check to qdev_property_set() Date: Fri, 11 Dec 2020 17:05:20 -0500 Message-Id: <20201211220529.2290218-24-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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) Every single qdev property setter function manually checks dev->realized. We can just check dev->realized inside qdev_property_set() instead. The check is being added as a separate function (qdev_prop_allow_set()) because it will become a callback later. Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Acked-by: Paul Durrant Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Removed unused variable at xen_block_set_vdev() * Redone patch after changes in the previous patches in the series --- 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: Cornelia Huck Cc: Halil Pasic Cc: Christian Borntraeger Cc: Richard Henderson Cc: David Hildenbrand Cc: Thomas Huth 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 --- backends/tpm/tpm_util.c | 6 -- hw/block/xen-block.c | 6 -- hw/core/qdev-properties-system.c | 70 ---------------------- hw/core/qdev-properties.c | 100 ++++++------------------------- hw/s390x/css.c | 6 -- hw/s390x/s390-pci-bus.c | 6 -- hw/vfio/pci-quirks.c | 6 -- target/sparc/cpu.c | 6 -- 8 files changed, 18 insertions(+), 188 deletions(-) diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index a5d997e7dc..39b45fa46d 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -46,16 +46,10 @@ static void get_tpm(Object *obj, Visitor *v, const char= *name, void *opaque, static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; TPMBackend *s, **be =3D qdev_get_prop_ptr(obj, prop); char *str; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 905e4acd97..bd1aef63a7 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -395,17 +395,11 @@ static int vbd_name_to_disk(const char *name, const c= har **endp, static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; XenBlockVdev *vdev =3D qdev_get_prop_ptr(obj, prop); char *str, *p; const char *end; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 42529c3b65..f31aea3de1 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -94,11 +94,6 @@ static void set_drive_helper(Object *obj, Visitor *v, co= nst char *name, bool blk_created =3D false; int ret; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -230,17 +225,11 @@ static void get_chr(Object *obj, Visitor *v, const ch= ar *name, void *opaque, static void set_chr(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; CharBackend *be =3D qdev_get_prop_ptr(obj, prop); Chardev *s; char *str; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -311,18 +300,12 @@ static void get_mac(Object *obj, Visitor *v, const ch= ar *name, void *opaque, static void set_mac(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; MACAddr *mac =3D qdev_get_prop_ptr(obj, prop); int i, pos; char *str; const char *p; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -390,7 +373,6 @@ static void get_netdev(Object *obj, Visitor *v, const c= har *name, static void set_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; NICPeers *peers_ptr =3D qdev_get_prop_ptr(obj, prop); NetClientState **ncs =3D peers_ptr->ncs; @@ -398,11 +380,6 @@ static void set_netdev(Object *obj, Visitor *v, const = char *name, int queues, err =3D 0, i =3D 0; char *str; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -469,18 +446,12 @@ static void get_audiodev(Object *obj, Visitor *v, con= st char* name, static void set_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; QEMUSoundCard *card =3D qdev_get_prop_ptr(obj, prop); AudioState *state; int err =3D 0; char *str; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -582,11 +553,6 @@ static void set_blocksize(Object *obj, Visitor *v, con= st char *name, uint64_t value; Error *local_err =3D NULL; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_size(v, name, &value, errp)) { return; } @@ -686,7 +652,6 @@ static void get_reserved_region(Object *obj, Visitor *v= , const char *name, static void set_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; ReservedRegion *rr =3D qdev_get_prop_ptr(obj, prop); Error *local_err =3D NULL; @@ -694,11 +659,6 @@ static void set_reserved_region(Object *obj, Visitor *= v, const char *name, char *str; int ret; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_str(v, name, &str, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -754,17 +714,11 @@ const PropertyInfo qdev_prop_reserved_region =3D { static void set_pci_devfn(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; int32_t value, *ptr =3D qdev_get_prop_ptr(obj, prop); unsigned int slot, fn, n; char *str; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, NULL)) { if (!visit_type_int32(v, name, &value, errp)) { return; @@ -848,7 +802,6 @@ static void get_pci_host_devaddr(Object *obj, Visitor *= v, const char *name, static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; PCIHostDeviceAddress *addr =3D qdev_get_prop_ptr(obj, prop); char *str, *p; @@ -857,11 +810,6 @@ static void set_pci_host_devaddr(Object *obj, Visitor = *v, const char *name, unsigned long dom =3D 0, bus =3D 0; unsigned int slot =3D 0, func =3D 0; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -972,16 +920,10 @@ static void get_prop_pcielinkspeed(Object *obj, Visit= or *v, const char *name, static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; PCIExpLinkSpeed *p =3D qdev_get_prop_ptr(obj, prop); int speed; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_enum(v, name, &speed, prop->info->enum_table, errp)) { return; @@ -1057,16 +999,10 @@ static void get_prop_pcielinkwidth(Object *obj, Visi= tor *v, const char *name, static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; PCIExpLinkWidth *p =3D qdev_get_prop_ptr(obj, prop); int width; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_enum(v, name, &width, prop->info->enum_table, errp)) { return; @@ -1129,16 +1065,10 @@ static void get_uuid(Object *obj, Visitor *v, const= char *name, void *opaque, static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaq= ue, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); char *str; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index b924f13d58..92f48ecbf2 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -24,6 +24,19 @@ void qdev_prop_set_after_realize(DeviceState *dev, const= char *name, } } =20 +/* returns: true if property is allowed to be set, false otherwise */ +static bool qdev_prop_allow_set(Object *obj, const char *name, + Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return false; + } + return true; +} + void qdev_prop_allow_set_link_before_realize(const Object *obj, const char *name, Object *val, Error **errp) @@ -65,6 +78,11 @@ static void field_prop_set(Object *obj, Visitor *v, cons= t char *name, void *opaque, Error **errp) { Property *prop =3D opaque; + + if (!qdev_prop_allow_set(obj, name, errp)) { + return; + } + return prop->info->set(obj, v, name, opaque, errp); } =20 @@ -90,15 +108,9 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, co= nst char *name, void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; int *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } =20 @@ -148,15 +160,9 @@ static void prop_get_bit(Object *obj, Visitor *v, cons= t char *name, static void prop_set_bit(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; bool value; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_bool(v, name, &value, errp)) { return; } @@ -208,15 +214,9 @@ static void prop_get_bit64(Object *obj, Visitor *v, co= nst char *name, static void prop_set_bit64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; bool value; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_bool(v, name, &value, errp)) { return; } @@ -245,15 +245,9 @@ static void get_bool(Object *obj, Visitor *v, const ch= ar *name, void *opaque, static void set_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; bool *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_bool(v, name, ptr, errp); } =20 @@ -278,15 +272,9 @@ static void get_uint8(Object *obj, Visitor *v, const c= har *name, void *opaque, static void set_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint8_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint8(v, name, ptr, errp); } =20 @@ -323,15 +311,9 @@ static void get_uint16(Object *obj, Visitor *v, const = char *name, static void set_uint16(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint16_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint16(v, name, ptr, errp); } =20 @@ -356,15 +338,9 @@ static void get_uint32(Object *obj, Visitor *v, const = char *name, static void set_uint32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint32(v, name, ptr, errp); } =20 @@ -380,15 +356,9 @@ void qdev_propinfo_get_int32(Object *obj, Visitor *v, = const char *name, static void set_int32(Object *obj, Visitor *v, const char *name, void *opa= que, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_int32(v, name, ptr, errp); } =20 @@ -420,15 +390,9 @@ static void get_uint64(Object *obj, Visitor *v, const = char *name, static void set_uint64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint64(v, name, ptr, errp); } =20 @@ -444,15 +408,9 @@ static void get_int64(Object *obj, Visitor *v, const c= har *name, static void set_int64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; int64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_int64(v, name, ptr, errp); } =20 @@ -495,16 +453,10 @@ static void get_string(Object *obj, Visitor *v, const= char *name, static void set_string(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; char **ptr =3D qdev_get_prop_ptr(obj, prop); char *str; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -545,16 +497,10 @@ void qdev_propinfo_get_size32(Object *obj, Visitor *v= , const char *name, static void set_size32(Object *obj, Visitor *v, const char *name, void *op= aque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); uint64_t value; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_size(v, name, &value, errp)) { return; } @@ -621,10 +567,6 @@ static void set_prop_arraylen(Object *obj, Visitor *v,= const char *name, const char *arrayname; int i; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } if (*alenptr) { error_setg(errp, "array size property %s may not be set more than = once", name); @@ -864,15 +806,9 @@ static void get_size(Object *obj, Visitor *v, const ch= ar *name, void *opaque, static void set_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_size(v, name, ptr, errp); } =20 diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 7a44320d12..496e2c5801 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2372,18 +2372,12 @@ static void get_css_devid(Object *obj, Visitor *v, = const char *name, static void set_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; CssDevId *dev_id =3D qdev_get_prop_ptr(obj, prop); char *str; int num, n1, n2; unsigned int cssid, ssid, devid; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 8b6be1197b..30511f620e 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1338,16 +1338,10 @@ static void s390_pci_get_fid(Object *obj, Visitor *= v, const char *name, static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); S390PCIBusDevice *zpci =3D S390_PCI_DEVICE(obj); Property *prop =3D opaque; uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_uint32(v, name, ptr, errp)) { return; } diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 53569925a2..802979635c 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1498,15 +1498,9 @@ static void set_nv_gpudirect_clique_id(Object *obj, = Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint8_t value, *ptr =3D qdev_get_prop_ptr(obj, prop); =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_uint8(v, name, &value, errp)) { return; } diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 92534bcd18..b730146bbe 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -798,17 +798,11 @@ static void sparc_get_nwindows(Object *obj, Visitor *= v, const char *name, static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev =3D DEVICE(obj); const int64_t min =3D MIN_NWINDOWS; const int64_t max =3D MAX_NWINDOWS; SPARCCPU *cpu =3D SPARC_CPU(obj); int64_t value; =20 - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_int(v, name, &value, errp)) { return; } --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726448; cv=none; d=zohomail.com; s=zohoarc; b=dR8/6u2AxC0P9CB7NBTySkL8ADWr8YYf7f4sGFvcjUH6OYh2sF8gVmAin7pnLmUXbEh2SGHENia9+wXf04TJ9MQN95s4b3vjRDtQj8Jmc6MoOY6KdWaSalbZKOfui7JBlJ+cLPLxHNN97HA8fm4R7BZaOIAZKE+Jds71R0ABlL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726448; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rT65BfAeuTWOVsUE/qQWyErSfi+P/zpLj+r5Yp7uEns=; b=CKQ63Pbkn0Xq2p0a6rFG/4B9TYasUCqERe631ZbHenyU3pmyZDuBSlHQBqv+Q2dpZ5VlPXy3dyArWIqm9HzbtLdsSeSEHGbIoT+8gjFMgiXPoi3aZahjrd9Xv/5BmcRGhCsaPMfWSmKMKR4d+pNSSJzPd7A170n8QqtKt10GqJ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607726448960783.7698923733184; Fri, 11 Dec 2020 14:40:48 -0800 (PST) Received: from localhost ([::1]:35962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr5j-0001c9-DP for importer@patchew.org; Fri, 11 Dec 2020 17:40:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZY-0002jF-Ux for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZM-0006hZ-9F for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:32 -0500 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-486-GT_3cIBmN5SEHX5hnXfNFw-1; Fri, 11 Dec 2020 17:07:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2666D800D53; Fri, 11 Dec 2020 22:07:17 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id B25AE5D9E2; Fri, 11 Dec 2020 22:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724439; 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=rT65BfAeuTWOVsUE/qQWyErSfi+P/zpLj+r5Yp7uEns=; b=hkQO43Id7GjgUI5De6+P+4Mke223bpCnadotxgetsyofkXiBOumc2ppR86VC57J016t3wK Bjn8d7L8LhcyOTZ3t1KPAQDL6/bC79Ytp64AKFf/opZH7/wNAOiPV4uhdk2zoIy33fGCr7 gAkcpg+BjbWdgiP7xbsHrCJ3GilvSJ0= X-MC-Unique: GT_3cIBmN5SEHX5hnXfNFw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 24/32] qdev: Make PropertyInfo.create return ObjectProperty* Date: Fri, 11 Dec 2020 17:05:21 -0500 Message-Id: <20201211220529.2290218-25-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Returning ObjectProperty* will be useful for new property registration code that will add additional callbacks to ObjectProperty after registering it. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Redone patch on top of additional changes in series v2 * Commit message reword --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 3 ++- hw/core/qdev-properties.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index ab9c538ba4..aae882317a 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -34,7 +34,8 @@ struct PropertyInfo { const QEnumLookup *enum_table; int (*print)(Object *obj, Property *prop, char *dest, size_t len); void (*set_default_value)(ObjectProperty *op, const Property *prop); - void (*create)(ObjectClass *oc, const char *name, Property *prop); + ObjectProperty *(*create)(ObjectClass *oc, const char *name, + Property *prop); ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyRelease *release; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 92f48ecbf2..3bb05e7d0d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -821,13 +821,13 @@ const PropertyInfo qdev_prop_size =3D { =20 /* --- object link property --- */ =20 -static void create_link_property(ObjectClass *oc, const char *name, - Property *prop) +static ObjectProperty *create_link_property(ObjectClass *oc, const char *n= ame, + Property *prop) { - object_class_property_add_link(oc, name, prop->link_type, - prop->offset, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_STRONG); + return object_class_property_add_link(oc, name, prop->link_type, + prop->offset, + qdev_prop_allow_set_link_before_= realize, + OBJ_PROP_LINK_STRONG); } =20 const PropertyInfo qdev_prop_link =3D { --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726794; cv=none; d=zohomail.com; s=zohoarc; b=Ytz1dT/DXKDJaO/Toew7YTILYjyZfZeRebLRetKbLTdULGwDSUPKOyhjoELDRmTeEUrRkSDLA5kyDoNNAVokEDSAvvOHi0+UyqQOIpOYzWeCB9G47RTt7qz6DmPlV2kqgvyBR4EqL9qbkj3FIWXhA7IS8pNQlntfFZ9f8r6+Z5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726794; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=46G22GlkPuQJFez3Xsh6hsmFiwSaREpIvSp2hp7j0nU=; b=JT6FYS9OGRX6F4zA9DOZuI4z5dh9C511hiFWkYG1XsTC2q6kNhemWLag/mnnfssYdImHtZUjMa/FEjqUwDewfBRxs1zKxi6dTdbtnK9Y6DLaupW3TkxK3B/7JBjJ3zEhxohJ6fYaMB7/5hQnjYdCXRuRb6mKpbSzv0MG/8Zf+8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607726794697109.61389145709973; Fri, 11 Dec 2020 14:46:34 -0800 (PST) Received: from localhost ([::1]:44464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrBJ-0005MG-AY for importer@patchew.org; Fri, 11 Dec 2020 17:46:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZo-0002xs-Fa for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZQ-0006iV-S0 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:47 -0500 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-324-0R-PQ6R9OrymGeyVO4IBUg-1; Fri, 11 Dec 2020 17:07:22 -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 2B922C292; Fri, 11 Dec 2020 22:07:21 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCF025C8AA; Fri, 11 Dec 2020 22:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724444; 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=46G22GlkPuQJFez3Xsh6hsmFiwSaREpIvSp2hp7j0nU=; b=e8cKrgvUTE3FZXfJsM8QuHz33cXlQt/dVyTu9mCogELuuyFRHtLzBnnKMQCwHdD/RlcGFa Zp5UKdITG7lSL3zkQxPBnXq9brqN3Zn4AD6hIcN+4CClUjPEkT+5ZPnB/UMKCYfnlfegf4 KIIyUfog6dg8aI9IwtKLOlt9UKKT/o0= X-MC-Unique: 0R-PQ6R9OrymGeyVO4IBUg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 25/32] qdev: Make qdev_class_add_property() more flexible Date: Fri, 11 Dec 2020 17:05:22 -0500 Message-Id: <20201211220529.2290218-26-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Support Property.set_default and PropertyInfo.description even if PropertyInfo.create is set. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Patch redone after changes in the previous patches in the series --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3bb05e7d0d..fcda0c8f4b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -863,24 +863,25 @@ static void qdev_class_add_property(DeviceClass *klas= s, const char *name, Property *prop) { ObjectClass *oc =3D OBJECT_CLASS(klass); + ObjectProperty *op; =20 if (prop->info->create) { - prop->info->create(oc, name, prop); + op =3D prop->info->create(oc, name, prop); } else { - ObjectProperty *op; - op =3D object_class_property_add(oc, name, prop->info->name, field_prop_getter(prop->info), field_prop_setter(prop->info), prop->info->release, prop); - if (prop->set_default) { - prop->info->set_default_value(op, prop); - } } - object_class_property_set_description(oc, name, - prop->info->description); + if (prop->set_default) { + prop->info->set_default_value(op, prop); + } + if (prop->info->description) { + object_class_property_set_description(oc, name, + prop->info->description); + } } =20 /** --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726450; cv=none; d=zohomail.com; s=zohoarc; b=byA8IVw9Nx5Gcy8zqeNJiFXTNOEYaX7AHuVn0fSblDbpwYTa5uJTbD6u9ZCJntnIAXT6AxfCZX5CKuEs/XFcVfxtOpx02SussSNa8Qs+NGoFxA+0IVRrLExQIlXPYQvSKvVvwSJkGD7bAaWPAGWsAzqbJCvovnUCinQWX05M5V0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726450; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pRVeBJC73oB1ZWLMle2oyb31+GPywq6tYIYiTT22tXA=; b=Ypes5f8ZTJ88La43f/JwIi5xdMRS5XkORvcuoNPw8ouduJxGSgrJeEL5AqTPmaXqmMqmdsmc0c5VHIDAD95VE00nihj9xdX7xtOHZLsgxuHkQSy+H8NcgQ2sU3hRSqQyVAJn/iT6zglgrEeTYU1at/+RmDlr7TwaRkRodRpGQCU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607726450091433.8936063208406; Fri, 11 Dec 2020 14:40:50 -0800 (PST) Received: from localhost ([::1]:36132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr5l-0001iD-06 for importer@patchew.org; Fri, 11 Dec 2020 17:40:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZu-00031u-Dk for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36330) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZV-0006kz-TQ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:53 -0500 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-62-1SMZKi9sNR2EGNmTtTLeDA-1; Fri, 11 Dec 2020 17:07:27 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 71607800D62; Fri, 11 Dec 2020 22:07:25 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0215B19C78; Fri, 11 Dec 2020 22:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724449; 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=pRVeBJC73oB1ZWLMle2oyb31+GPywq6tYIYiTT22tXA=; b=H48o4IAPb0Et8FKL4PbTQ61RUJd2sYG0sRNsKZ3EPn3berwtlMcuL3wLEgdxgTz1PPO40U W2uvDpZE46Lms073560KvwCZ/XADZez9qIfcAXT7KRyUP+89CO9uQxAOUXI40XnWH3MgwF z5mzzEix4IMIZdDjpUdOiRQnCghrjVU= X-MC-Unique: 1SMZKi9sNR2EGNmTtTLeDA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 26/32] qdev: Separate generic and device-specific property registration Date: Fri, 11 Dec 2020 17:05:23 -0500 Message-Id: <20201211220529.2290218-27-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) qdev_class_add_property() and qdev_property_add_static() will have code that's specific for device types. object_class_property_add_field_static() and object_property_add_field() will be generic and part of the QOM field property API. Note that the new functions have a `name` parameter because the plan is to eventually get rid of the Property.name field. The declarations for the new functions are being added to qdev-properties-internal.h, but they will be moved to a QOM header later. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Re-added array-based array registration function, named as object_class_add_field_properties() * Renamed object_class_property_add_field() to object_class_property_add_field_static(), to indicate that the function expect the Property argument to have static life time. * Keep all new functions as internal API by now, until we decide what's going to be the preferred API for registering class field properties. Changes v1 -> v2: * Patch redone after changes in previous patches in the series * Rename new functions to object*_property_add_field() --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-prop-internal.h | 42 ++++++++++++++++++++++++++++++++++++ hw/core/qdev-properties.c | 37 ++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 8 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index d7b77844fe..6f17ddf271 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -25,4 +25,46 @@ void qdev_propinfo_get_int32(Object *obj, Visitor *v, co= nst char *name, void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp); =20 +/** + * object_property_add_field: Add a field property to an object instance + * @obj: object instance + * @name: property name + * @prop: property definition + * + * This function should not be used in new code. Please add class propert= ies + * instead, using object_class_add_field(). + */ +ObjectProperty * +object_property_add_field(Object *obj, const char *name, + Property *prop); + +/** + * object_class_property_add_field_static: Add a field property to object = class + * @oc: object class + * @name: property name + * @prop: property definition + * + * Add a field property to an object class. A field property is + * a property that will change a field at a specific offset of the + * object instance struct. + * + * *@prop must have static life time. + */ +ObjectProperty * +object_class_property_add_field_static(ObjectClass *oc, const char *name, + Property *prop); + +/** + * object_class_add_field_properties: Add field properties from array to a= class + * @oc: object class + * @props: array of property definitions + * + * Register an array of field properties to a class, using + * object_class_property_add_field_static() for each array element. + * + * The array at @props must end with DEFINE_PROP_END_OF_LIST(), and + * must have static life time. + */ +void object_class_add_field_properties(ObjectClass *oc, Property *props); + #endif diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index fcda0c8f4b..8436b60ec4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -835,20 +835,21 @@ const PropertyInfo qdev_prop_link =3D { .create =3D create_link_property, }; =20 -void qdev_property_add_static(DeviceState *dev, Property *prop) +ObjectProperty * +object_property_add_field(Object *obj, const char *name, + Property *prop) { - Object *obj =3D OBJECT(dev); ObjectProperty *op; =20 assert(!prop->info->create); =20 - op =3D object_property_add(obj, prop->name, prop->info->name, + op =3D object_property_add(obj, name, prop->info->name, field_prop_getter(prop->info), field_prop_setter(prop->info), prop->info->release, prop); =20 - object_property_set_description(obj, prop->name, + object_property_set_description(obj, name, prop->info->description); =20 if (prop->set_default) { @@ -857,12 +858,14 @@ void qdev_property_add_static(DeviceState *dev, Prope= rty *prop) op->init(obj, op); } } + + return op; } =20 -static void qdev_class_add_property(DeviceClass *klass, const char *name, - Property *prop) +ObjectProperty * +object_class_property_add_field_static(ObjectClass *oc, const char *name, + Property *prop) { - ObjectClass *oc =3D OBJECT_CLASS(klass); ObjectProperty *op; =20 if (prop->info->create) { @@ -882,6 +885,22 @@ static void qdev_class_add_property(DeviceClass *klass= , const char *name, object_class_property_set_description(oc, name, prop->info->description); } + return op; +} + +void object_class_add_field_properties(ObjectClass *oc, Property *props) +{ + Property *prop; + + for (prop =3D props; prop && prop->name; prop++) { + object_class_property_add_field_static(oc, prop->name, prop); + } +} + + +void qdev_property_add_static(DeviceState *dev, Property *prop) +{ + object_property_add_field(OBJECT(dev), prop->name, prop); } =20 /** @@ -932,13 +951,15 @@ static void qdev_class_add_legacy_property(DeviceClas= s *dc, Property *prop) =20 void device_class_set_props(DeviceClass *dc, Property *props) { + ObjectClass *oc =3D OBJECT_CLASS(dc); Property *prop; =20 dc->props_ =3D props; for (prop =3D props; prop && prop->name; prop++) { qdev_class_add_legacy_property(dc, prop); - qdev_class_add_property(dc, prop->name, prop); } + + object_class_add_field_properties(oc, props); } =20 void qdev_alias_all_properties(DeviceState *target, Object *source) --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607727098; cv=none; d=zohomail.com; s=zohoarc; b=D71srAqKNYAkHfxAdgOq0wjSjBz6ANJQHJ2+KQ0CZfsrB3FBQYNex8DETAsMttMbeQxfilQdCNhYGBMZZ3A3rYq7DcaC6wHvJm8vlo6VB5NCtOpnsswbZj9Wc0JuYvXJwOjqB4BXWh5FMiqhzaGRt+Awqqqsd4ofgySRp1qassI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607727098; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5dxPgHP3OIor/uPnVuxSeiC5dUE6Uw3EIYpLXIAe42Q=; b=MrG4FAznCcej7TG3h9QDAj7AdoHgGEB/AiKp09ta/ywfPodNgFcKu7DAmpXVMzmirCcGeP5G8A5/VtkVfJn7E7+nA7OA2riAPIj7jmDT9GiJ9F2SCrtBApENf/8ulAUO4HcW6fYd71+KX9pXnLjLEM1QbaZKTpy45Htptt512is= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607727098630368.19771701952504; Fri, 11 Dec 2020 14:51:38 -0800 (PST) Received: from localhost ([::1]:52892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrGD-0000tb-ET for importer@patchew.org; Fri, 11 Dec 2020 17:51:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZt-00031d-2M for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48391) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZZ-0006lv-59 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:52 -0500 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-515-7vfgh4jGNF2t5B_B1qZ29Q-1; Fri, 11 Dec 2020 17:07:30 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC91919251A0; Fri, 11 Dec 2020 22:07:29 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84FDB5D71D; Fri, 11 Dec 2020 22:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724452; 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=5dxPgHP3OIor/uPnVuxSeiC5dUE6Uw3EIYpLXIAe42Q=; b=Bcm1FGmeZcV36HiTKA+c2n+zZP10KDvK2aGWwtCt0gmm2sicLmguAWfb3K8sEaXwlZkT5H hMuMOEPyzQnVk9dhH5SYiS3AwkLZTmqLzV5ZvTRwWq8R5K3VtsLBgtujNCY1dIdCjkRLHG sbJbLE3UQpS1WG7qINC2zgGsWzvhEyA= X-MC-Unique: 7vfgh4jGNF2t5B_B1qZ29Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 27/32] qdev: Rename qdev_propinfo_* to field_prop_* Date: Fri, 11 Dec 2020 17:05:24 -0500 Message-Id: <20201211220529.2290218-28-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These functions will be moved to be part of QOM, so rename them. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v2: * Rename to field_prop_* instead of object_propinfo_* --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-prop-internal.h | 28 +++++++-------- hw/core/qdev-properties-system.c | 48 ++++++++++++------------- hw/core/qdev-properties.c | 62 ++++++++++++++++---------------- 3 files changed, 69 insertions(+), 69 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index 6f17ddf271..740a5e530b 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -8,22 +8,22 @@ #ifndef HW_CORE_QDEV_PROP_INTERNAL_H #define HW_CORE_QDEV_PROP_INTERNAL_H =20 -void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); -void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); +void field_prop_get_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); +void field_prop_set_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); =20 -void qdev_propinfo_set_default_value_enum(ObjectProperty *op, - const Property *prop); -void qdev_propinfo_set_default_value_int(ObjectProperty *op, - const Property *prop); -void qdev_propinfo_set_default_value_uint(ObjectProperty *op, - const Property *prop); +void field_prop_set_default_value_enum(ObjectProperty *op, + const Property *prop); +void field_prop_set_default_value_int(ObjectProperty *op, + const Property *prop); +void field_prop_set_default_value_uint(ObjectProperty *op, + const Property *prop); =20 -void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); -void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); +void field_prop_get_int32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); +void field_prop_get_size32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); =20 /** * object_property_add_field: Add a field property to an object instance diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index f31aea3de1..590c5f3d97 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -537,9 +537,9 @@ QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) !=3D sizeof(in= t)); const PropertyInfo qdev_prop_losttickpolicy =3D { .name =3D "LostTickPolicy", .enum_table =3D &LostTickPolicy_lookup, - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- blocksize --- */ @@ -568,9 +568,9 @@ const PropertyInfo qdev_prop_blocksize =3D { .name =3D "size", .description =3D "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, - .get =3D qdev_propinfo_get_size32, + .get =3D field_prop_get_size32, .set =3D set_blocksize, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 /* --- Block device error handling policy --- */ @@ -582,9 +582,9 @@ const PropertyInfo qdev_prop_blockdev_on_error =3D { .description =3D "Error handling policy, " "report/ignore/enospc/stop/auto", .enum_table =3D &BlockdevOnError_lookup, - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- BIOS CHS translation */ @@ -596,9 +596,9 @@ const PropertyInfo qdev_prop_bios_chs_trans =3D { .description =3D "Logical CHS translation algorithm, " "auto/none/lba/large/rechs", .enum_table =3D &BiosAtaTranslation_lookup, - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- FDC default drive types */ @@ -608,9 +608,9 @@ const PropertyInfo qdev_prop_fdc_drive_type =3D { .description =3D "FDC drive type, " "144/288/120/none/auto", .enum_table =3D &FloppyDriveType_lookup, - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- MultiFDCompression --- */ @@ -620,9 +620,9 @@ const PropertyInfo qdev_prop_multifd_compression =3D { .description =3D "multifd_compression values, " "none/zlib/zstd", .enum_table =3D &MultiFDCompression_lookup, - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- Reserved Region --- */ @@ -766,9 +766,9 @@ const PropertyInfo qdev_prop_pci_devfn =3D { .name =3D "int32", .description =3D "Slot and optional function number, example: 06.0 or = 06", .print =3D print_pci_devfn, - .get =3D qdev_propinfo_get_int32, + .get =3D field_prop_get_int32, .set =3D set_pci_devfn, - .set_default_value =3D qdev_propinfo_set_default_value_int, + .set_default_value =3D field_prop_set_default_value_int, }; =20 /* --- pci host address --- */ @@ -882,9 +882,9 @@ const PropertyInfo qdev_prop_off_auto_pcibar =3D { .name =3D "OffAutoPCIBAR", .description =3D "off/auto/bar0/bar1/bar2/bar3/bar4/bar5", .enum_table =3D &OffAutoPCIBAR_lookup, - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- PCIELinkSpeed 2_5/5/8/16 -- */ @@ -954,7 +954,7 @@ const PropertyInfo qdev_prop_pcie_link_speed =3D { .enum_table =3D &PCIELinkSpeed_lookup, .get =3D get_prop_pcielinkspeed, .set =3D set_prop_pcielinkspeed, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- PCIELinkWidth 1/2/4/8/12/16/32 -- */ @@ -1042,7 +1042,7 @@ const PropertyInfo qdev_prop_pcie_link_width =3D { .enum_table =3D &PCIELinkWidth_lookup, .get =3D get_prop_pcielinkwidth, .set =3D set_prop_pcielinkwidth, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- UUID --- */ diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 8436b60ec4..d2f565f552 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -96,8 +96,8 @@ static ObjectPropertyAccessor *field_prop_setter(const Pr= opertyInfo *info) return info->set ? field_prop_set : NULL; } =20 -void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_get_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop =3D opaque; int *ptr =3D qdev_get_prop_ptr(obj, prop); @@ -105,8 +105,8 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, co= nst char *name, visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } =20 -void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_set_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop =3D opaque; int *ptr =3D qdev_get_prop_ptr(obj, prop); @@ -114,8 +114,8 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, co= nst char *name, visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } =20 -void qdev_propinfo_set_default_value_enum(ObjectProperty *op, - const Property *prop) +void field_prop_set_default_value_enum(ObjectProperty *op, + const Property *prop) { object_property_set_default_str(op, qapi_enum_lookup(prop->info->enum_table, prop->defval.i)); @@ -123,9 +123,9 @@ void qdev_propinfo_set_default_value_enum(ObjectPropert= y *op, =20 const PropertyInfo qdev_prop_enum =3D { .name =3D "enum", - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* Bit */ @@ -278,14 +278,14 @@ static void set_uint8(Object *obj, Visitor *v, const = char *name, void *opaque, visit_type_uint8(v, name, ptr, errp); } =20 -void qdev_propinfo_set_default_value_int(ObjectProperty *op, - const Property *prop) +void field_prop_set_default_value_int(ObjectProperty *op, + const Property *prop) { object_property_set_default_int(op, prop->defval.i); } =20 -void qdev_propinfo_set_default_value_uint(ObjectProperty *op, - const Property *prop) +void field_prop_set_default_value_uint(ObjectProperty *op, + const Property *prop) { object_property_set_default_uint(op, prop->defval.u); } @@ -294,7 +294,7 @@ const PropertyInfo qdev_prop_uint8 =3D { .name =3D "uint8", .get =3D get_uint8, .set =3D set_uint8, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 /* --- 16bit integer --- */ @@ -321,7 +321,7 @@ const PropertyInfo qdev_prop_uint16 =3D { .name =3D "uint16", .get =3D get_uint16, .set =3D set_uint16, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 /* --- 32bit integer --- */ @@ -344,8 +344,8 @@ static void set_uint32(Object *obj, Visitor *v, const c= har *name, visit_type_uint32(v, name, ptr, errp); } =20 -void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_get_int32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop =3D opaque; int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); @@ -366,14 +366,14 @@ const PropertyInfo qdev_prop_uint32 =3D { .name =3D "uint32", .get =3D get_uint32, .set =3D set_uint32, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 const PropertyInfo qdev_prop_int32 =3D { .name =3D "int32", - .get =3D qdev_propinfo_get_int32, + .get =3D field_prop_get_int32, .set =3D set_int32, - .set_default_value =3D qdev_propinfo_set_default_value_int, + .set_default_value =3D field_prop_set_default_value_int, }; =20 /* --- 64bit integer --- */ @@ -418,14 +418,14 @@ const PropertyInfo qdev_prop_uint64 =3D { .name =3D "uint64", .get =3D get_uint64, .set =3D set_uint64, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 const PropertyInfo qdev_prop_int64 =3D { .name =3D "int64", .get =3D get_int64, .set =3D set_int64, - .set_default_value =3D qdev_propinfo_set_default_value_int, + .set_default_value =3D field_prop_set_default_value_int, }; =20 /* --- string --- */ @@ -477,15 +477,15 @@ const PropertyInfo qdev_prop_on_off_auto =3D { .name =3D "OnOffAuto", .description =3D "on/off/auto", .enum_table =3D &OnOffAuto_lookup, - .get =3D qdev_propinfo_get_enum, - .set =3D qdev_propinfo_set_enum, - .set_default_value =3D qdev_propinfo_set_default_value_enum, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, }; =20 /* --- 32bit unsigned int 'size' type --- */ =20 -void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_get_size32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop =3D opaque; uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); @@ -518,9 +518,9 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, =20 const PropertyInfo qdev_prop_size32 =3D { .name =3D "size", - .get =3D qdev_propinfo_get_size32, + .get =3D field_prop_get_size32, .set =3D set_size32, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 /* --- support for array properties --- */ @@ -617,7 +617,7 @@ const PropertyInfo qdev_prop_arraylen =3D { .name =3D "uint32", .get =3D get_uint32, .set =3D set_prop_arraylen, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 /* --- public helpers --- */ @@ -816,7 +816,7 @@ const PropertyInfo qdev_prop_size =3D { .name =3D "size", .get =3D get_size, .set =3D set_size, - .set_default_value =3D qdev_propinfo_set_default_value_uint, + .set_default_value =3D field_prop_set_default_value_uint, }; =20 /* --- object link property --- */ --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607726793; cv=none; d=zohomail.com; s=zohoarc; b=Lo06Bsw9AsJ3PoXpyycvciCxVFqO2Zhmn/jMQg3FAvGg0L2StcV/RSMH6mCPnOkjCxqqmw5aBLigg9TstNOZ0nuqxSke1fqvtEiuXRy+2As9ofm7S61oumf0ZgrSG5EgBMYtoyyKt4pUl3DL8/2O6mMdI11n9B0+zW6SSbifIrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607726793; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ssVB4ZKQeXjPj0kPwgwgUjyGM2Mm4Eg/AnpASc9lPTE=; b=V4tne9txhTT+1VIASy1D7AJ8HIgZwF9jKJjnnrgWLpYa1DoVTzUS9WEBo/iUT2zYcDktLzaTe7lrDGhfUZJso5EowjvjCZZ9vahgLlBl3jX1fDUPnQc58X4lPH25NfIUEJIcSre7ZyxuH9goHd+/oJYK3zbhX0/gwqyo3Vs40dU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160772679369441.207031942463004; Fri, 11 Dec 2020 14:46:33 -0800 (PST) Received: from localhost ([::1]:44400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrBH-0005KW-U9 for importer@patchew.org; Fri, 11 Dec 2020 17:46:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZx-00034S-0i for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZb-0006mB-RZ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:56 -0500 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-594-7yXpOObOOnmEZBiyUgsWtg-1; Fri, 11 Dec 2020 17:07:32 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2807C100F343; Fri, 11 Dec 2020 22:07:31 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8D7A5D742; Fri, 11 Dec 2020 22:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724454; 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=ssVB4ZKQeXjPj0kPwgwgUjyGM2Mm4Eg/AnpASc9lPTE=; b=IECfTz0SRIfSexdc4QIbjDDYkKpvoF4UHoT9qlXZ08aZCovuquOeH19IzlQgQI/7/0aAkZ ec+vXrLNno917XsmjWrcckI//bClQz9xSoMj6tybsiH2e8X5QirAsdWgnodf1Y/owkQpGK WMIx8vBtoxT0lwASuHYWyBTZ0HL5oYE= X-MC-Unique: 7yXpOObOOnmEZBiyUgsWtg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 28/32] qdev: Move qdev_prop_tpm declaration to tpm_prop.h Date: Fri, 11 Dec 2020 17:05:25 -0500 Message-Id: <20201211220529.2290218-29-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , Stefan Berger , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Move the variable declaration close to the macro that uses it. Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Cc: Stefan Berger Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/tpm/tpm_prop.h | 2 ++ include/hw/qdev-properties.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/tpm/tpm_prop.h b/hw/tpm/tpm_prop.h index d19e40c112..bbd4225d66 100644 --- a/hw/tpm/tpm_prop.h +++ b/hw/tpm/tpm_prop.h @@ -25,6 +25,8 @@ #include "sysemu/tpm_backend.h" #include "hw/qdev-properties.h" =20 +extern const PropertyInfo qdev_prop_tpm; + #define DEFINE_PROP_TPMBE(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_tpm, TPMBackend *) =20 diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index aae882317a..68e544708b 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -56,7 +56,6 @@ extern const PropertyInfo qdev_prop_uint64; extern const PropertyInfo qdev_prop_int64; extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; -extern const PropertyInfo qdev_prop_tpm; extern const PropertyInfo qdev_prop_on_off_auto; extern const PropertyInfo qdev_prop_size32; extern const PropertyInfo qdev_prop_arraylen; --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607727079; cv=none; d=zohomail.com; s=zohoarc; b=Im1CeHuaFptwfwjetfLzMi9wqPn2TaNAm6YLXTQEGbJyhHRUQAzTQdGfO8+SSLMc38XAHqJHWPXSyp+NjcXx/Gqyz5vWMMeydpHozi3rV+5zF+S+cmNhB3SR1OP60YjrhrIdyy7f6fVGO8ACv6xw7oujiVING/AXomrZDY9JQbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607727079; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qEmjy/8vk3/5tVoHt3DAuCGhxai+lJk/GoA2h1anmJA=; b=US9dimY9DqnjrGElKaGE2bPkNDMcjUmKnNvPKEVxpMzQ97QU/rZOT21mE7jvH+xXBk05YS4kL2qWLLPnRvzfLILSVqcjuclTu3YSST9SKFcK3YxKWwhZatqxqrv+zxMy3uimhxeTNAsjG5YA4QLOKb8XM3gy+7IiN3vsvRhX7a4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607727079474810.2786684078131; Fri, 11 Dec 2020 14:51:19 -0800 (PST) Received: from localhost ([::1]:52872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrFt-0000t9-JE for importer@patchew.org; Fri, 11 Dec 2020 17:51:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqa9-0003Ds-IA for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZk-0006pY-Qv for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:09 -0500 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-455-6ojzbqprPIum9yEA41rcSg-1; Fri, 11 Dec 2020 17:07:39 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1DDD419251A0; Fri, 11 Dec 2020 22:07:38 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB94460BE5; Fri, 11 Dec 2020 22:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724463; 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=qEmjy/8vk3/5tVoHt3DAuCGhxai+lJk/GoA2h1anmJA=; b=GCZbKPwdA+cBPAaMC1t+/3w02KdZs64NIxvPdz3xGgTZcQFAYjmJMJmAGo3oDPxWkyPOO6 cYmzafYzPpK58RYaX84KzVUj4nG+Sdh334cbXpry8aTj44T0XmAHKARFjzd7ZkVMlILmG7 /hKY/3MPssMvlI48aWyfdIqN2GENBiU= X-MC-Unique: 6ojzbqprPIum9yEA41rcSg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 29/32] qdev: Rename qdev_prop_* to prop_info_* Date: Fri, 11 Dec 2020 17:05:26 -0500 Message-Id: <20201211220529.2290218-30-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , Dmitry Fleytman , "Daniel P. Berrange" , Yoshinori Sato , John Snow , Jason Wang , Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The basic property types in qdev-properties.c are not going to be qdev-specific anymore. Rename the variables to prop_info_*. Signed-off-by: Eduardo Habkost --- Changes v1 -> v2: * Redone patch after moving UUID property to qdev-properties-system.c --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: Peter Maydell Cc: Yoshinori Sato Cc: Dmitry Fleytman Cc: Jason Wang Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org --- include/hw/qdev-properties.h | 62 ++++++++++++++++++------------------ hw/core/qdev-properties.c | 36 ++++++++++----------- hw/intc/arm_gicv3_common.c | 2 +- hw/intc/rx_icu.c | 4 +-- hw/misc/arm_sysctl.c | 4 +-- hw/net/e1000e.c | 6 ++-- target/arm/cpu.c | 2 +- target/sparc/cpu.c | 2 +- 8 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 68e544708b..90222822f1 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -44,22 +44,22 @@ struct PropertyInfo { =20 /*** qdev-properties.c ***/ =20 -extern const PropertyInfo qdev_prop_bit; -extern const PropertyInfo qdev_prop_bit64; -extern const PropertyInfo qdev_prop_bool; -extern const PropertyInfo qdev_prop_enum; -extern const PropertyInfo qdev_prop_uint8; -extern const PropertyInfo qdev_prop_uint16; -extern const PropertyInfo qdev_prop_uint32; -extern const PropertyInfo qdev_prop_int32; -extern const PropertyInfo qdev_prop_uint64; -extern const PropertyInfo qdev_prop_int64; -extern const PropertyInfo qdev_prop_size; -extern const PropertyInfo qdev_prop_string; -extern const PropertyInfo qdev_prop_on_off_auto; -extern const PropertyInfo qdev_prop_size32; -extern const PropertyInfo qdev_prop_arraylen; -extern const PropertyInfo qdev_prop_link; +extern const PropertyInfo prop_info_bit; +extern const PropertyInfo prop_info_bit64; +extern const PropertyInfo prop_info_bool; +extern const PropertyInfo prop_info_enum; +extern const PropertyInfo prop_info_uint8; +extern const PropertyInfo prop_info_uint16; +extern const PropertyInfo prop_info_uint32; +extern const PropertyInfo prop_info_int32; +extern const PropertyInfo prop_info_uint64; +extern const PropertyInfo prop_info_int64; +extern const PropertyInfo prop_info_size; +extern const PropertyInfo prop_info_string; +extern const PropertyInfo prop_info_on_off_auto; +extern const PropertyInfo prop_info_size32; +extern const PropertyInfo prop_info_arraylen; +extern const PropertyInfo prop_info_link; =20 #define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ .name =3D (_name), \ @@ -78,7 +78,7 @@ extern const PropertyInfo qdev_prop_link; DEFINE_PROP(_name, _state, _field, _prop, _type) =20 #define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_bit, uint32_t, \ + DEFINE_PROP(_name, _state, _field, prop_info_bit, uint32_t, \ .bitnr =3D (_bit), \ .set_default =3D true, \ .defval.u =3D (bool)_defval) @@ -92,13 +92,13 @@ extern const PropertyInfo qdev_prop_link; DEFINE_PROP(_name, _state, _field, _prop, _type) =20 #define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_bit64, uint64_t, \ + DEFINE_PROP(_name, _state, _field, prop_info_bit64, uint64_t, \ .bitnr =3D (_bit), \ .set_default =3D true, \ .defval.u =3D (bool)_defval) =20 #define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool, \ + DEFINE_PROP(_name, _state, _field, prop_info_bool, bool, \ .set_default =3D true, \ .defval.u =3D (bool)_defval) =20 @@ -131,7 +131,7 @@ extern const PropertyInfo qdev_prop_link; #define DEFINE_PROP_ARRAY(_name, _state, _field, \ _arrayfield, _arrayprop, _arraytype) \ DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \ - _state, _field, qdev_prop_arraylen, uint32_t, \ + _state, _field, prop_info_arraylen, uint32_t, \ .set_default =3D true, \ .defval.u =3D 0, \ .arrayinfo =3D &(_arrayprop), \ @@ -139,29 +139,29 @@ extern const PropertyInfo qdev_prop_link; .arrayoffset =3D offsetof(_state, _arrayfield)) =20 #define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_link, _ptr_type, \ + DEFINE_PROP(_name, _state, _field, prop_info_link, _ptr_type, \ .link_type =3D _type) =20 #define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint8, uint8_t) #define DEFINE_PROP_UINT16(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint16, uint16_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint16, uint16_t) #define DEFINE_PROP_UINT32(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint32, uint32_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint32, uint32_t) #define DEFINE_PROP_INT32(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t) + DEFINE_PROP_SIGNED(_n, _s, _f, _d, prop_info_int32, int32_t) #define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint64, uint64_t) #define DEFINE_PROP_INT64(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) + DEFINE_PROP_SIGNED(_n, _s, _f, _d, prop_info_int64, int64_t) #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size, uint64_t) #define DEFINE_PROP_STRING(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) + DEFINE_PROP(_n, _s, _f, prop_info_string, char*) #define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto) + DEFINE_PROP_SIGNED(_n, _s, _f, _d, prop_info_on_off_auto, OnOffAuto) #define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size32, uint32_t) =20 #define DEFINE_PROP_END_OF_LIST() \ {} diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index d2f565f552..c1dd4ae71b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -121,7 +121,7 @@ void field_prop_set_default_value_enum(ObjectProperty *= op, qapi_enum_lookup(prop->info->enum_table, prop->defval.i)); } =20 -const PropertyInfo qdev_prop_enum =3D { +const PropertyInfo prop_info_enum =3D { .name =3D "enum", .get =3D field_prop_get_enum, .set =3D field_prop_set_enum, @@ -132,7 +132,7 @@ const PropertyInfo qdev_prop_enum =3D { =20 static uint32_t qdev_get_prop_mask(Property *prop) { - assert(prop->info =3D=3D &qdev_prop_bit); + assert(prop->info =3D=3D &prop_info_bit); return 0x1 << prop->bitnr; } =20 @@ -174,7 +174,7 @@ static void set_default_value_bool(ObjectProperty *op, = const Property *prop) object_property_set_default_bool(op, prop->defval.u); } =20 -const PropertyInfo qdev_prop_bit =3D { +const PropertyInfo prop_info_bit =3D { .name =3D "bool", .description =3D "on/off", .get =3D prop_get_bit, @@ -186,7 +186,7 @@ const PropertyInfo qdev_prop_bit =3D { =20 static uint64_t qdev_get_prop_mask64(Property *prop) { - assert(prop->info =3D=3D &qdev_prop_bit64); + assert(prop->info =3D=3D &prop_info_bit64); return 0x1ull << prop->bitnr; } =20 @@ -223,7 +223,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, con= st char *name, bit64_prop_set(obj, prop, value); } =20 -const PropertyInfo qdev_prop_bit64 =3D { +const PropertyInfo prop_info_bit64 =3D { .name =3D "bool", .description =3D "on/off", .get =3D prop_get_bit64, @@ -251,7 +251,7 @@ static void set_bool(Object *obj, Visitor *v, const cha= r *name, void *opaque, visit_type_bool(v, name, ptr, errp); } =20 -const PropertyInfo qdev_prop_bool =3D { +const PropertyInfo prop_info_bool =3D { .name =3D "bool", .get =3D get_bool, .set =3D set_bool, @@ -290,7 +290,7 @@ void field_prop_set_default_value_uint(ObjectProperty *= op, object_property_set_default_uint(op, prop->defval.u); } =20 -const PropertyInfo qdev_prop_uint8 =3D { +const PropertyInfo prop_info_uint8 =3D { .name =3D "uint8", .get =3D get_uint8, .set =3D set_uint8, @@ -317,7 +317,7 @@ static void set_uint16(Object *obj, Visitor *v, const c= har *name, visit_type_uint16(v, name, ptr, errp); } =20 -const PropertyInfo qdev_prop_uint16 =3D { +const PropertyInfo prop_info_uint16 =3D { .name =3D "uint16", .get =3D get_uint16, .set =3D set_uint16, @@ -362,14 +362,14 @@ static void set_int32(Object *obj, Visitor *v, const = char *name, void *opaque, visit_type_int32(v, name, ptr, errp); } =20 -const PropertyInfo qdev_prop_uint32 =3D { +const PropertyInfo prop_info_uint32 =3D { .name =3D "uint32", .get =3D get_uint32, .set =3D set_uint32, .set_default_value =3D field_prop_set_default_value_uint, }; =20 -const PropertyInfo qdev_prop_int32 =3D { +const PropertyInfo prop_info_int32 =3D { .name =3D "int32", .get =3D field_prop_get_int32, .set =3D set_int32, @@ -414,14 +414,14 @@ static void set_int64(Object *obj, Visitor *v, const = char *name, visit_type_int64(v, name, ptr, errp); } =20 -const PropertyInfo qdev_prop_uint64 =3D { +const PropertyInfo prop_info_uint64 =3D { .name =3D "uint64", .get =3D get_uint64, .set =3D set_uint64, .set_default_value =3D field_prop_set_default_value_uint, }; =20 -const PropertyInfo qdev_prop_int64 =3D { +const PropertyInfo prop_info_int64 =3D { .name =3D "int64", .get =3D get_int64, .set =3D set_int64, @@ -464,7 +464,7 @@ static void set_string(Object *obj, Visitor *v, const c= har *name, *ptr =3D str; } =20 -const PropertyInfo qdev_prop_string =3D { +const PropertyInfo prop_info_string =3D { .name =3D "str", .release =3D release_string, .get =3D get_string, @@ -473,7 +473,7 @@ const PropertyInfo qdev_prop_string =3D { =20 /* --- on/off/auto --- */ =20 -const PropertyInfo qdev_prop_on_off_auto =3D { +const PropertyInfo prop_info_on_off_auto =3D { .name =3D "OnOffAuto", .description =3D "on/off/auto", .enum_table =3D &OnOffAuto_lookup, @@ -516,7 +516,7 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, *ptr =3D value; } =20 -const PropertyInfo qdev_prop_size32 =3D { +const PropertyInfo prop_info_size32 =3D { .name =3D "size", .get =3D field_prop_get_size32, .set =3D set_size32, @@ -613,7 +613,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, } } =20 -const PropertyInfo qdev_prop_arraylen =3D { +const PropertyInfo prop_info_arraylen =3D { .name =3D "uint32", .get =3D get_uint32, .set =3D set_prop_arraylen, @@ -812,7 +812,7 @@ static void set_size(Object *obj, Visitor *v, const cha= r *name, void *opaque, visit_type_size(v, name, ptr, errp); } =20 -const PropertyInfo qdev_prop_size =3D { +const PropertyInfo prop_info_size =3D { .name =3D "size", .get =3D get_size, .set =3D set_size, @@ -830,7 +830,7 @@ static ObjectProperty *create_link_property(ObjectClass= *oc, const char *name, OBJ_PROP_LINK_STRONG); } =20 -const PropertyInfo qdev_prop_link =3D { +const PropertyInfo prop_info_link =3D { .name =3D "link", .create =3D create_link_property, }; diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 58ef65f589..6d06b4d4c5 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -496,7 +496,7 @@ static Property arm_gicv3_common_properties[] =3D { DEFINE_PROP_UINT32("revision", GICv3State, revision, 3), DEFINE_PROP_BOOL("has-security-extensions", GICv3State, security_extn,= 0), DEFINE_PROP_ARRAY("redist-region-count", GICv3State, nb_redist_regions, - redist_region_count, qdev_prop_uint32, uint32_t), + redist_region_count, prop_info_uint32, uint32_t), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/intc/rx_icu.c b/hw/intc/rx_icu.c index e5c01807b9..dde05eaf8b 100644 --- a/hw/intc/rx_icu.c +++ b/hw/intc/rx_icu.c @@ -363,9 +363,9 @@ static const VMStateDescription vmstate_rxicu =3D { =20 static Property rxicu_properties[] =3D { DEFINE_PROP_ARRAY("ipr-map", RXICUState, nr_irqs, map, - qdev_prop_uint8, uint8_t), + prop_info_uint8, uint8_t), DEFINE_PROP_ARRAY("trigger-level", RXICUState, nr_sense, init_sense, - qdev_prop_uint8, uint8_t), + prop_info_uint8, uint8_t), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c index 42d4693854..634f3d916f 100644 --- a/hw/misc/arm_sysctl.c +++ b/hw/misc/arm_sysctl.c @@ -628,10 +628,10 @@ static Property arm_sysctl_properties[] =3D { DEFINE_PROP_UINT32("proc_id", arm_sysctl_state, proc_id, 0), /* Daughterboard power supply voltages (as reported via SYS_CFG) */ DEFINE_PROP_ARRAY("db-voltage", arm_sysctl_state, db_num_vsensors, - db_voltage, qdev_prop_uint32, uint32_t), + db_voltage, prop_info_uint32, uint32_t), /* Daughterboard clock reset values (as reported via SYS_CFG) */ DEFINE_PROP_ARRAY("db-clock", arm_sysctl_state, db_num_clocks, - db_clock_reset, qdev_prop_uint32, uint32_t), + db_clock_reset, prop_info_uint32, uint32_t), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index a8a77eca95..9d2f471c7c 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -686,15 +686,15 @@ static void e1000e_class_init(ObjectClass *class, voi= d *data) dc->reset =3D e1000e_qdev_reset; dc->vmsd =3D &e1000e_vmstate; =20 - e1000e_prop_disable_vnet =3D qdev_prop_uint8; + e1000e_prop_disable_vnet =3D prop_info_uint8; e1000e_prop_disable_vnet.description =3D "Do not use virtio headers, " "perform SW offloads emulation " "instead"; =20 - e1000e_prop_subsys_ven =3D qdev_prop_uint16; + e1000e_prop_subsys_ven =3D prop_info_uint16; e1000e_prop_subsys_ven.description =3D "PCI device Subsystem Vendor ID= "; =20 - e1000e_prop_subsys =3D qdev_prop_uint16; + e1000e_prop_subsys =3D prop_info_uint16; e1000e_prop_subsys.description =3D "PCI device Subsystem ID"; =20 device_class_set_props(dc, e1000e_properties); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index d6188f6566..bb34ff1aab 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1111,7 +1111,7 @@ static Property arm_cpu_has_mpu_property =3D static Property arm_cpu_pmsav7_dregion_property =3D DEFINE_PROP_UNSIGNED_NODEFAULT("pmsav7-dregion", ARMCPU, pmsav7_dregion, - qdev_prop_uint32, uint32_t); + prop_info_uint32, uint32_t); =20 static bool arm_get_pmu(Object *obj, Error **errp) { diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index b730146bbe..0da2190cac 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -839,7 +839,7 @@ static Property sparc_cpu_properties[] =3D { DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, 12, false), DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, 13, false), DEFINE_PROP_UNSIGNED("iu-version", SPARCCPU, env.def.iu_version, 0, - qdev_prop_uint64, target_ulong), + prop_info_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0), DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0), DEFINE_PROP("nwindows", SPARCCPU, env.def.nwindows, --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 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=1607724494; cv=none; d=zohomail.com; s=zohoarc; b=eTUdXNo84SbiFWb+L6ffosiucCNnSz4P+X6Z6MNDJXyDoYYJ3E6mq8+2qAtKb5vQ8AZAyzzkh6qCPkXmLw7kM7haA8AqpaJqYmoOCHiO67ubtcluX7RDImslxr01cfXcIGDCmTeS32ZQuZsKvM1xJOsNcVs9VfM+qw/U7RDfzoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607724494; 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=/5ZoGD/Z4aeOrYeqXoenztMGPJ1MAS8OAd9A0/6z3M4=; b=KNa5OlrDuJFSo4azo2krndhJ963EN6mopvbUeVOuy/oKG/PzvkWrdsg2iLIWUjHxoJ5PNqKOnowvy9kRiugnucYjmFhyEyKKWG96CJtEy1bvXj6nVTti5U48u3jGxdbbqWEfBrbTHF7Rmb6AGNLNqCw8DgAP2WF7gkkL0TJbFNs= 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 1607724494659825.6126681094103; Fri, 11 Dec 2020 14:08:14 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.50940.89813 (Exim 4.92) (envelope-from ) id 1knqZw-00073P-UN; Fri, 11 Dec 2020 22:07:56 +0000 Received: by outflank-mailman (output) from mailman id 50940.89813; Fri, 11 Dec 2020 22:07:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knqZw-00073I-RE; Fri, 11 Dec 2020 22:07:56 +0000 Received: by outflank-mailman (input) for mailman id 50940; Fri, 11 Dec 2020 22:07:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knqZv-000732-1m for xen-devel@lists.xenproject.org; Fri, 11 Dec 2020 22:07:55 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id b1795c04-b247-4fdf-a045-784b1937d0b7; Fri, 11 Dec 2020 22:07:53 +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-536-YzaAqyL8PFaykowR_ziKuw-1; Fri, 11 Dec 2020 17:07:49 -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 20688C294; Fri, 11 Dec 2020 22:07:47 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFBD25C8AA; Fri, 11 Dec 2020 22:07:38 +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: b1795c04-b247-4fdf-a045-784b1937d0b7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724472; 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=/5ZoGD/Z4aeOrYeqXoenztMGPJ1MAS8OAd9A0/6z3M4=; b=Kzlg6zy20qY8nNf59l6EzwhV0gwmr1h7YHS6AYVDI8KU0SdWhxcURDDRIhyjFeSnJIz0we coxYo89iCn5TRbDyCFaEwFEVbVUqxdnl5jTE8O11AiZkglk7a+5FK66SU8QMTLStKATgI8 b+XbR9VT5r377b+qIci4xJNTScaLnPs= X-MC-Unique: YzaAqyL8PFaykowR_ziKuw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Cc: Markus Armbruster , Igor Mammedov , Stefan Berger , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Daniel P. Berrange" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow , Kevin Wolf , Eric Blake , Paolo Bonzini , Stefan Berger , Stefano Stabellini , Anthony Perard , Paul Durrant , Max Reitz , Cornelia Huck , Halil Pasic , Christian Borntraeger , Richard Henderson , David Hildenbrand , Thomas Huth , Matthew Rosato , Alex Williamson , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v4 30/32] qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr() Date: Fri, 11 Dec 2020 17:05:27 -0500 Message-Id: <20201211220529.2290218-31-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-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) The function will be moved to common QOM code, as it is not specific to TYPE_DEVICE anymore. Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Acked-by: Paul Durrant Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Rename to object_field_prop_ptr() instead of object_static_prop_ptr() --- 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: Cornelia Huck Cc: Halil Pasic Cc: Christian Borntraeger Cc: Richard Henderson Cc: David Hildenbrand Cc: Thomas Huth Cc: Matthew Rosato Cc: Alex Williamson Cc: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org Cc: qemu-block@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- backends/tpm/tpm_util.c | 6 ++-- hw/block/xen-block.c | 4 +-- hw/core/qdev-properties-system.c | 50 +++++++++++++------------- hw/core/qdev-properties.c | 60 ++++++++++++++++---------------- hw/s390x/css.c | 4 +-- hw/s390x/s390-pci-bus.c | 4 +-- hw/vfio/pci-quirks.c | 4 +-- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 90222822f1..97bb9494ae 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -193,7 +193,7 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char= *name, const uint8_t *value); void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); =20 -void *qdev_get_prop_ptr(Object *obj, Property *prop); +void *object_field_prop_ptr(Object *obj, Property *prop); =20 void qdev_prop_register_global(GlobalProperty *prop); const GlobalProperty *qdev_find_global_prop(Object *obj, diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index 39b45fa46d..a6e6d3e72f 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -35,7 +35,7 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - TPMBackend **be =3D qdev_get_prop_ptr(obj, opaque); + TPMBackend **be =3D object_field_prop_ptr(obj, opaque); char *p; =20 p =3D g_strdup(*be ? (*be)->id : ""); @@ -47,7 +47,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *= name, void *opaque, Error **errp) { Property *prop =3D opaque; - TPMBackend *s, **be =3D qdev_get_prop_ptr(obj, prop); + TPMBackend *s, **be =3D object_field_prop_ptr(obj, prop); char *str; =20 if (!visit_type_str(v, name, &str, errp)) { @@ -67,7 +67,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *= name, void *opaque, static void release_tpm(Object *obj, const char *name, void *opaque) { Property *prop =3D opaque; - TPMBackend **be =3D qdev_get_prop_ptr(obj, prop); + TPMBackend **be =3D object_field_prop_ptr(obj, prop); =20 if (*be) { tpm_backend_reset(*be); diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index bd1aef63a7..718d886e5c 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -336,7 +336,7 @@ static void xen_block_get_vdev(Object *obj, Visitor *v,= const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - XenBlockVdev *vdev =3D qdev_get_prop_ptr(obj, prop); + XenBlockVdev *vdev =3D object_field_prop_ptr(obj, prop); char *str; =20 switch (vdev->type) { @@ -396,7 +396,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v,= const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - XenBlockVdev *vdev =3D qdev_get_prop_ptr(obj, prop); + XenBlockVdev *vdev =3D object_field_prop_ptr(obj, prop); char *str, *p; const char *end; =20 diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 590c5f3d97..e6d378a34e 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -62,7 +62,7 @@ static void get_drive(Object *obj, Visitor *v, const char= *name, void *opaque, Error **errp) { Property *prop =3D opaque; - void **ptr =3D qdev_get_prop_ptr(obj, prop); + void **ptr =3D object_field_prop_ptr(obj, prop); const char *value; char *p; =20 @@ -88,7 +88,7 @@ static void set_drive_helper(Object *obj, Visitor *v, con= st char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - void **ptr =3D qdev_get_prop_ptr(obj, prop); + void **ptr =3D object_field_prop_ptr(obj, prop); char *str; BlockBackend *blk; bool blk_created =3D false; @@ -181,7 +181,7 @@ static void release_drive(Object *obj, const char *name= , void *opaque) { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - BlockBackend **ptr =3D qdev_get_prop_ptr(obj, prop); + BlockBackend **ptr =3D object_field_prop_ptr(obj, prop); =20 if (*ptr) { AioContext *ctx =3D blk_get_aio_context(*ptr); @@ -214,7 +214,7 @@ const PropertyInfo qdev_prop_drive_iothread =3D { static void get_chr(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - CharBackend *be =3D qdev_get_prop_ptr(obj, opaque); + CharBackend *be =3D object_field_prop_ptr(obj, opaque); char *p; =20 p =3D g_strdup(be->chr && be->chr->label ? be->chr->label : ""); @@ -226,7 +226,7 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, Error **errp) { Property *prop =3D opaque; - CharBackend *be =3D qdev_get_prop_ptr(obj, prop); + CharBackend *be =3D object_field_prop_ptr(obj, prop); Chardev *s; char *str; =20 @@ -262,7 +262,7 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, static void release_chr(Object *obj, const char *name, void *opaque) { Property *prop =3D opaque; - CharBackend *be =3D qdev_get_prop_ptr(obj, prop); + CharBackend *be =3D object_field_prop_ptr(obj, prop); =20 qemu_chr_fe_deinit(be, false); } @@ -286,7 +286,7 @@ static void get_mac(Object *obj, Visitor *v, const char= *name, void *opaque, Error **errp) { Property *prop =3D opaque; - MACAddr *mac =3D qdev_get_prop_ptr(obj, prop); + MACAddr *mac =3D object_field_prop_ptr(obj, prop); char buffer[2 * 6 + 5 + 1]; char *p =3D buffer; =20 @@ -301,7 +301,7 @@ static void set_mac(Object *obj, Visitor *v, const char= *name, void *opaque, Error **errp) { Property *prop =3D opaque; - MACAddr *mac =3D qdev_get_prop_ptr(obj, prop); + MACAddr *mac =3D object_field_prop_ptr(obj, prop); int i, pos; char *str; const char *p; @@ -363,7 +363,7 @@ static void get_netdev(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - NICPeers *peers_ptr =3D qdev_get_prop_ptr(obj, prop); + 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 visit_type_str(v, name, &p, errp); @@ -374,7 +374,7 @@ static void set_netdev(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - NICPeers *peers_ptr =3D qdev_get_prop_ptr(obj, prop); + NICPeers *peers_ptr =3D object_field_prop_ptr(obj, prop); NetClientState **ncs =3D peers_ptr->ncs; NetClientState *peers[MAX_QUEUE_NUM]; int queues, err =3D 0, i =3D 0; @@ -436,7 +436,7 @@ static void get_audiodev(Object *obj, Visitor *v, const= char* name, void *opaque, Error **errp) { Property *prop =3D opaque; - QEMUSoundCard *card =3D qdev_get_prop_ptr(obj, prop); + QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); char *p =3D g_strdup(audio_get_id(card)); =20 visit_type_str(v, name, &p, errp); @@ -447,7 +447,7 @@ static void set_audiodev(Object *obj, Visitor *v, const= char* name, void *opaque, Error **errp) { Property *prop =3D opaque; - QEMUSoundCard *card =3D qdev_get_prop_ptr(obj, prop); + QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); AudioState *state; int err =3D 0; char *str; @@ -549,7 +549,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); uint64_t value; Error *local_err =3D NULL; =20 @@ -637,7 +637,7 @@ static void get_reserved_region(Object *obj, Visitor *v= , const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - ReservedRegion *rr =3D qdev_get_prop_ptr(obj, prop); + ReservedRegion *rr =3D object_field_prop_ptr(obj, prop); char buffer[64]; char *p =3D buffer; int rc; @@ -653,7 +653,7 @@ static void set_reserved_region(Object *obj, Visitor *v= , const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - ReservedRegion *rr =3D qdev_get_prop_ptr(obj, prop); + ReservedRegion *rr =3D object_field_prop_ptr(obj, prop); Error *local_err =3D NULL; const char *endptr; char *str; @@ -715,7 +715,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, cons= t char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - int32_t value, *ptr =3D qdev_get_prop_ptr(obj, prop); + int32_t value, *ptr =3D object_field_prop_ptr(obj, prop); unsigned int slot, fn, n; char *str; =20 @@ -753,7 +753,7 @@ invalid: static int print_pci_devfn(Object *obj, Property *prop, char *dest, size_t len) { - int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + int32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 if (*ptr =3D=3D -1) { return snprintf(dest, len, ""); @@ -777,7 +777,7 @@ static void get_pci_host_devaddr(Object *obj, Visitor *= v, const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - PCIHostDeviceAddress *addr =3D qdev_get_prop_ptr(obj, prop); + PCIHostDeviceAddress *addr =3D object_field_prop_ptr(obj, prop); char buffer[] =3D "ffff:ff:ff.f"; char *p =3D buffer; int rc =3D 0; @@ -803,7 +803,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *= v, const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - PCIHostDeviceAddress *addr =3D qdev_get_prop_ptr(obj, prop); + PCIHostDeviceAddress *addr =3D object_field_prop_ptr(obj, prop); char *str, *p; char *e; unsigned long val; @@ -893,7 +893,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor= *v, const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - PCIExpLinkSpeed *p =3D qdev_get_prop_ptr(obj, prop); + PCIExpLinkSpeed *p =3D object_field_prop_ptr(obj, prop); int speed; =20 switch (*p) { @@ -921,7 +921,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor= *v, const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - PCIExpLinkSpeed *p =3D qdev_get_prop_ptr(obj, prop); + PCIExpLinkSpeed *p =3D object_field_prop_ptr(obj, prop); int speed; =20 if (!visit_type_enum(v, name, &speed, prop->info->enum_table, @@ -963,7 +963,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor= *v, const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - PCIExpLinkWidth *p =3D qdev_get_prop_ptr(obj, prop); + PCIExpLinkWidth *p =3D object_field_prop_ptr(obj, prop); int width; =20 switch (*p) { @@ -1000,7 +1000,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visit= or *v, const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - PCIExpLinkWidth *p =3D qdev_get_prop_ptr(obj, prop); + PCIExpLinkWidth *p =3D object_field_prop_ptr(obj, prop); int width; =20 if (!visit_type_enum(v, name, &width, prop->info->enum_table, @@ -1051,7 +1051,7 @@ static void get_uuid(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); + QemuUUID *uuid =3D object_field_prop_ptr(obj, prop); char buffer[UUID_FMT_LEN + 1]; char *p =3D buffer; =20 @@ -1066,7 +1066,7 @@ static void set_uuid(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - QemuUUID *uuid =3D qdev_get_prop_ptr(obj, prop); + QemuUUID *uuid =3D object_field_prop_ptr(obj, prop); char *str; =20 if (!visit_type_str(v, name, &str, errp)) { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c1dd4ae71b..3d648b088d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -50,7 +50,7 @@ void qdev_prop_allow_set_link_before_realize(const Object= *obj, } } =20 -void *qdev_get_prop_ptr(Object *obj, Property *prop) +void *object_field_prop_ptr(Object *obj, Property *prop) { void *ptr =3D obj; ptr +=3D prop->offset; @@ -100,7 +100,7 @@ void field_prop_get_enum(Object *obj, Visitor *v, const= char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - int *ptr =3D qdev_get_prop_ptr(obj, prop); + int *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } @@ -109,7 +109,7 @@ void field_prop_set_enum(Object *obj, Visitor *v, const= char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - int *ptr =3D qdev_get_prop_ptr(obj, prop); + int *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } @@ -138,7 +138,7 @@ static uint32_t qdev_get_prop_mask(Property *prop) =20 static void bit_prop_set(Object *obj, Property *props, bool val) { - uint32_t *p =3D qdev_get_prop_ptr(obj, props); + uint32_t *p =3D object_field_prop_ptr(obj, props); uint32_t mask =3D qdev_get_prop_mask(props); if (val) { *p |=3D mask; @@ -151,7 +151,7 @@ static void prop_get_bit(Object *obj, Visitor *v, const= char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint32_t *p =3D qdev_get_prop_ptr(obj, prop); + uint32_t *p =3D object_field_prop_ptr(obj, prop); bool value =3D (*p & qdev_get_prop_mask(prop)) !=3D 0; =20 visit_type_bool(v, name, &value, errp); @@ -192,7 +192,7 @@ static uint64_t qdev_get_prop_mask64(Property *prop) =20 static void bit64_prop_set(Object *obj, Property *props, bool val) { - uint64_t *p =3D qdev_get_prop_ptr(obj, props); + uint64_t *p =3D object_field_prop_ptr(obj, props); uint64_t mask =3D qdev_get_prop_mask64(props); if (val) { *p |=3D mask; @@ -205,7 +205,7 @@ static void prop_get_bit64(Object *obj, Visitor *v, con= st char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint64_t *p =3D qdev_get_prop_ptr(obj, prop); + uint64_t *p =3D object_field_prop_ptr(obj, prop); bool value =3D (*p & qdev_get_prop_mask64(prop)) !=3D 0; =20 visit_type_bool(v, name, &value, errp); @@ -237,7 +237,7 @@ static void get_bool(Object *obj, Visitor *v, const cha= r *name, void *opaque, Error **errp) { Property *prop =3D opaque; - bool *ptr =3D qdev_get_prop_ptr(obj, prop); + bool *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_bool(v, name, ptr, errp); } @@ -246,7 +246,7 @@ static void set_bool(Object *obj, Visitor *v, const cha= r *name, void *opaque, Error **errp) { Property *prop =3D opaque; - bool *ptr =3D qdev_get_prop_ptr(obj, prop); + bool *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_bool(v, name, ptr, errp); } @@ -264,7 +264,7 @@ static void get_uint8(Object *obj, Visitor *v, const ch= ar *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint8_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint8_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); } @@ -273,7 +273,7 @@ static void set_uint8(Object *obj, Visitor *v, const ch= ar *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint8_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint8_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); } @@ -303,7 +303,7 @@ static void get_uint16(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint16_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint16_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint16(v, name, ptr, errp); } @@ -312,7 +312,7 @@ static void set_uint16(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint16_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint16_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint16(v, name, ptr, errp); } @@ -330,7 +330,7 @@ static void get_uint32(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } @@ -339,7 +339,7 @@ static void set_uint32(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } @@ -348,7 +348,7 @@ void field_prop_get_int32(Object *obj, Visitor *v, cons= t char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + int32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int32(v, name, ptr, errp); } @@ -357,7 +357,7 @@ static void set_int32(Object *obj, Visitor *v, const ch= ar *name, void *opaque, Error **errp) { Property *prop =3D opaque; - int32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + int32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int32(v, name, ptr, errp); } @@ -382,7 +382,7 @@ static void get_uint64(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint64(v, name, ptr, errp); } @@ -391,7 +391,7 @@ static void set_uint64(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint64(v, name, ptr, errp); } @@ -400,7 +400,7 @@ static void get_int64(Object *obj, Visitor *v, const ch= ar *name, void *opaque, Error **errp) { Property *prop =3D opaque; - int64_t *ptr =3D qdev_get_prop_ptr(obj, prop); + int64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int64(v, name, ptr, errp); } @@ -409,7 +409,7 @@ static void set_int64(Object *obj, Visitor *v, const ch= ar *name, void *opaque, Error **errp) { Property *prop =3D opaque; - int64_t *ptr =3D qdev_get_prop_ptr(obj, prop); + int64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_int64(v, name, ptr, errp); } @@ -433,14 +433,14 @@ const PropertyInfo prop_info_int64 =3D { static void release_string(Object *obj, const char *name, void *opaque) { Property *prop =3D opaque; - g_free(*(char **)qdev_get_prop_ptr(obj, prop)); + g_free(*(char **)object_field_prop_ptr(obj, prop)); } =20 static void get_string(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - char **ptr =3D qdev_get_prop_ptr(obj, prop); + char **ptr =3D object_field_prop_ptr(obj, prop); =20 if (!*ptr) { char *str =3D (char *)""; @@ -454,7 +454,7 @@ static void set_string(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - char **ptr =3D qdev_get_prop_ptr(obj, prop); + char **ptr =3D object_field_prop_ptr(obj, prop); char *str; =20 if (!visit_type_str(v, name, &str, errp)) { @@ -488,7 +488,7 @@ void field_prop_get_size32(Object *obj, Visitor *v, con= st char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); uint64_t value =3D *ptr; =20 visit_type_size(v, name, &value, errp); @@ -498,7 +498,7 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); uint64_t value; =20 if (!visit_type_size(v, name, &value, errp)) { @@ -561,7 +561,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, */ DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint32_t *alenptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *alenptr =3D object_field_prop_ptr(obj, prop); void **arrayptr =3D (void *)dev + prop->arrayoffset; void *eltptr; const char *arrayname; @@ -603,7 +603,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, * being inside the device struct. */ arrayprop->prop.offset =3D eltptr - (void *)dev; - assert(qdev_get_prop_ptr(obj, &arrayprop->prop) =3D=3D eltptr); + assert(object_field_prop_ptr(obj, &arrayprop->prop) =3D=3D eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, field_prop_getter(arrayprop->prop.info), @@ -798,7 +798,7 @@ static void get_size(Object *obj, Visitor *v, const cha= r *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_size(v, name, ptr, errp); } @@ -807,7 +807,7 @@ static void set_size(Object *obj, Visitor *v, const cha= r *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint64_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_size(v, name, ptr, errp); } diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 496e2c5801..fe47751df4 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2344,7 +2344,7 @@ static void get_css_devid(Object *obj, Visitor *v, co= nst char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - CssDevId *dev_id =3D qdev_get_prop_ptr(obj, prop); + CssDevId *dev_id =3D object_field_prop_ptr(obj, prop); char buffer[] =3D "xx.x.xxxx"; char *p =3D buffer; int r; @@ -2373,7 +2373,7 @@ static void set_css_devid(Object *obj, Visitor *v, co= nst char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - CssDevId *dev_id =3D qdev_get_prop_ptr(obj, prop); + CssDevId *dev_id =3D object_field_prop_ptr(obj, prop); char *str; int num, n1, n2; unsigned int cssid, ssid, devid; diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 30511f620e..dd138dae94 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1330,7 +1330,7 @@ static void s390_pci_get_fid(Object *obj, Visitor *v,= const char *name, void *opaque, Error **errp) { Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint32(v, name, ptr, errp); } @@ -1340,7 +1340,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v,= const char *name, { S390PCIBusDevice *zpci =3D S390_PCI_DEVICE(obj); Property *prop =3D opaque; - uint32_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 if (!visit_type_uint32(v, name, ptr, errp)) { return; diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 802979635c..fc8d63c850 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1489,7 +1489,7 @@ static void get_nv_gpudirect_clique_id(Object *obj, V= isitor *v, Error **errp) { Property *prop =3D opaque; - uint8_t *ptr =3D qdev_get_prop_ptr(obj, prop); + uint8_t *ptr =3D object_field_prop_ptr(obj, prop); =20 visit_type_uint8(v, name, ptr, errp); } @@ -1499,7 +1499,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, V= isitor *v, Error **errp) { Property *prop =3D opaque; - uint8_t value, *ptr =3D qdev_get_prop_ptr(obj, prop); + uint8_t value, *ptr =3D object_field_prop_ptr(obj, prop); =20 if (!visit_type_uint8(v, name, &value, errp)) { return; --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607727360; cv=none; d=zohomail.com; s=zohoarc; b=ZwBGjOD1m8Opnn+lyMposATMSGrtqIkv6trfxW0Lv4jSGfKedxFXLnomLSjeIcI+kQw/r+FF3NTSgBkIWwL/pdihpcHdFZkGAQHOrSZ/Pk0KH2eMJ2MUlgxdGzmp9obZb3W2WS3XF7JR9J8hUlHXBaUhoIjI3T8VI7cFi+iGphg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607727360; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aKfie8HDs4Bj5KUMmmQqgBylUh0kwLqLFFOC3bbKRvM=; b=UISeMQtf5F0oLa3Bk2RxSWrxMECVNsCHjW+80awhcixahigcLqcGByIsBhUFIAfP9WbKODy9HzzcMcu/ZeyKCHPK5mCZEX83JXbPZVQksakyDpvno+L/N38Jy9yKw1YYzl8Xsg/h2e3f/IBJ6FWodCdPATCvSVPukqywdvgXYOs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16077273605950.9371733328327991; Fri, 11 Dec 2020 14:56:00 -0800 (PST) Received: from localhost ([::1]:32980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrKR-0004a0-5N for importer@patchew.org; Fri, 11 Dec 2020 17:55:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqaG-0003IV-DY for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24090) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZv-0006sa-6k for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:16 -0500 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-162-iKOqZwxBMPmdpSl-0f-5Iw-1; Fri, 11 Dec 2020 17:07:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E556A107ACE3; Fri, 11 Dec 2020 22:07:51 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08E3C5D9E2; Fri, 11 Dec 2020 22:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724474; 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=aKfie8HDs4Bj5KUMmmQqgBylUh0kwLqLFFOC3bbKRvM=; b=PRgcoQoD6wsVXqM44d6LXXcAjdoKRGN/AFZ0XpiUY8/zd7aMXG1llu0kst0IIvxthPWELi AajpRTCIK1RiByeHGfliLt15ALO4qu47P7QKqSfyX1Y/AcNIa0CXoeY/ZHJtE2mX7DfBWh yP50F6AkRqCgiXbChW4VQrm12hNq/fg= X-MC-Unique: iKOqZwxBMPmdpSl-0f-5Iw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 31/32] qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen() Date: Fri, 11 Dec 2020 17:05:28 -0500 Message-Id: <20201211220529.2290218-32-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We're just doing pointer math with the device pointer, we can simply use obj instead. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3d648b088d..9d25b49fc1 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -559,10 +559,9 @@ static void set_prop_arraylen(Object *obj, Visitor *v,= const char *name, * array-length field in the device struct, we have to create the * array itself and dynamically add the corresponding properties. */ - DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; uint32_t *alenptr =3D object_field_prop_ptr(obj, prop); - void **arrayptr =3D (void *)dev + prop->arrayoffset; + void **arrayptr =3D (void *)obj + prop->arrayoffset; void *eltptr; const char *arrayname; int i; @@ -602,7 +601,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, * they get the right answer despite the array element not actually * being inside the device struct. */ - arrayprop->prop.offset =3D eltptr - (void *)dev; + arrayprop->prop.offset =3D eltptr - (void *)obj; assert(object_field_prop_ptr(obj, &arrayprop->prop) =3D=3D eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, --=20 2.28.0 From nobody Sat May 18 23:55:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607727669; cv=none; d=zohomail.com; s=zohoarc; b=ARR47o8etkEdCTilZSnnPuEq3PgyvFidxrCJqz4Jm+M62+otKXsqY2swABZ4LYAZ8IlwJrMI702+pGAwpvk2aYdAjFk45eOwrslIsXDhAVMTqjYHv8nHgdMBV4aYSvodBYAFjpd1EmsoeSDto7d6v8nv1j4wnDEfVJ2o+fZ4214= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607727669; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9SbFl2yOXu+0VCiayKzhvj7M0fCoKeZLWqJHQW7JehU=; b=SCaLswmOrBJnFONjb7bOONEM1cP/lzpAfIvi5iRP9PQpERau8BX6cLF95jqyGKpISZA+myDVJFJmDe5ZiDPx114eeG5YgF1rEBRdFTCHn42MfCw/uv4hOReJdOWFCPN4CGZYN9v/SOalODYdYTr6pdEP34gj+oyCfMoEh4ImwzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160772766949042.49879772084864; Fri, 11 Dec 2020 15:01:09 -0800 (PST) Received: from localhost ([::1]:41428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrPO-0008NY-Mr for importer@patchew.org; Fri, 11 Dec 2020 18:01:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqaH-0003JK-UX for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZz-0006tS-BC for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:16 -0500 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-579-50drsqLdPNi5bBf5lkDtQw-1; Fri, 11 Dec 2020 17:07:54 -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 2AADFC29F; Fri, 11 Dec 2020 22:07:53 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2A0771C80; Fri, 11 Dec 2020 22:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724476; 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=9SbFl2yOXu+0VCiayKzhvj7M0fCoKeZLWqJHQW7JehU=; b=LAW1QQBju0AnA7kth/PNrPDncbCEwWDNJmy7Zb5GNm1hj1FV0CoC+1jHdyXDPPhUdjedqK WUZOoNTXmp1Jzwx4v2VSuSi8IlUtrjRs779lCYgBOnz2eX6B5bZZqsOMx95UCp3+ajjU0m jnqJ6axCgCYqOflEeqmiBLjcs0//Dlg= X-MC-Unique: 50drsqLdPNi5bBf5lkDtQw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 32/32] tests: Add unit test for qdev array properties Date: Fri, 11 Dec 2020 17:05:29 -0500 Message-Id: <20201211220529.2290218-33-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Add a test case to ensure array properties are behaving as expected. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of this series. --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- tests/test-qdev-global-props.c | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index c8862cac5f..9426ce2a72 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -44,11 +44,16 @@ struct MyType { =20 uint32_t prop1; uint32_t prop2; + + char **myarray; + uint32_t myarray_len; }; =20 static Property static_props[] =3D { DEFINE_PROP_UINT32("prop1", MyType, prop1, PROP_DEFAULT), DEFINE_PROP_UINT32("prop2", MyType, prop2, PROP_DEFAULT), + DEFINE_PROP_ARRAY("myarray", MyType, myarray_len, myarray, + prop_info_string, char *), DEFINE_PROP_END_OF_LIST() }; =20 @@ -60,11 +65,19 @@ static void static_prop_class_init(ObjectClass *oc, voi= d *data) device_class_set_props(dc, static_props); } =20 +static void static_props_finalize(Object *obj) +{ + MyType *mt =3D STATIC_TYPE(obj); + + g_free(mt->myarray); +} + static const TypeInfo static_prop_type =3D { .name =3D TYPE_STATIC_PROPS, .parent =3D TYPE_DEVICE, .instance_size =3D sizeof(MyType), .class_init =3D static_prop_class_init, + .instance_finalize =3D static_props_finalize, }; =20 static const TypeInfo subclass_type =3D { @@ -91,6 +104,52 @@ static void test_static_prop(void) g_test_trap_assert_stdout(""); } =20 +static void test_static_prop_array(void) +{ + Error *err =3D NULL; + ObjectClass *oc =3D object_class_by_name(TYPE_STATIC_PROPS); + Object *obj =3D object_new(TYPE_STATIC_PROPS); + char *s =3D NULL; + + g_assert_nonnull(object_class_property_find(oc, "len-myarray")); + g_assert_null(object_class_property_find(oc, "myarray[0]")); + + g_assert_nonnull(object_property_find(obj, "len-myarray")); + g_assert_null(object_property_find(obj, "myarray[0]")); + + g_assert_cmpint(object_property_get_int(obj, "len-myarray", &error_abo= rt), =3D=3D, 0); + object_property_set_int(obj, "len-myarray", 3, &error_abort); + g_assert_cmpint(object_property_get_int(obj, "len-myarray", &error_abo= rt), =3D=3D, 3); + + g_assert_nonnull(object_property_find(obj, "myarray[0]")); + g_assert_nonnull(object_property_find(obj, "myarray[1]")); + g_assert_nonnull(object_property_find(obj, "myarray[2]")); + g_assert_null(object_property_find(obj, "myarray[3]")); + + /* Setting length a second time must fail */ + object_property_set_int(obj, "len-myarray", 42, &err); + error_free_or_abort(&err); + + g_assert_nonnull(object_property_find(obj, "myarray[2]")); + g_assert_null(object_property_find(obj, "myarray[3]")); + + s =3D object_property_get_str(obj, "myarray[2]", &error_abort); + g_assert_cmpstr(s, =3D=3D, ""); + g_free(s); + + object_property_set_str(obj, "myarray[1]", "value", &error_abort); + + s =3D object_property_get_str(obj, "myarray[1]", &error_abort); + g_assert_cmpstr(s, =3D=3D, "value"); + g_free(s); + + s =3D object_property_get_str(obj, "myarray[2]", &error_abort); + g_assert_cmpstr(s, =3D=3D, ""); + g_free(s); + + object_unref(obj); +} + static void register_global_properties(GlobalProperty *props) { int i; @@ -299,6 +358,8 @@ int main(int argc, char **argv) test_static_prop_subprocess); g_test_add_func("/qdev/properties/static/default", test_static_prop); + g_test_add_func("/qdev/properties/static/array", + test_static_prop_array); =20 g_test_add_func("/qdev/properties/static/global/subprocess", test_static_globalprop_subprocess); --=20 2.28.0