From nobody Sat May 4 16:51:48 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=1605217628; cv=none; d=zohomail.com; s=zohoarc; b=PRtFHbgQljM5yOGltvCNQYsgLDg8JndNYKynI2Xzgjd+1KbMAg3sxvxy65kJZ0udBLjsyQgKT1JnzkZq3z1Dy2iATdwaPSFOgZYtr9U02LKo/ZHqhG5oF+Xybceax9OVoV2uKNPjeaqYAvJ5xWWOgugif4pIlhiOrWdn0hmcqYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217628; 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=WaLi1CAhHiY25zoTgK6zjRWsYZmiyWZG/+tgkw4r/vvfNRjsnmJkY9LJp+Kxg5Or+NdePi7IS7huOU7dqC9C32gUmkuuutUOiyUE1o7jeh2nGqjvSh+8D8ezKKfVap4JgOIq75pR8BCZ7w8WbR1d+QmAz+ePxrSkFC6899NRXuo= 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 1605217628630173.05035256272663; Thu, 12 Nov 2020 13:47:08 -0800 (PST) Received: from localhost ([::1]:56156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKQt-0007F5-Aj for importer@patchew.org; Thu, 12 Nov 2020 16:47:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKNz-0005M0-3t for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKNx-00039q-6s for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:06 -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-532-cmRXWPXkP920fw6fTtxwLA-1; Thu, 12 Nov 2020 16:44:01 -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 067F0805F1C; Thu, 12 Nov 2020 21:44:01 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E502619C59; Thu, 12 Nov 2020 21:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217444; 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=Hj7boE9HGXIYCJxf0/1OLMpz8Cl9hzSJLiBNmvOjPuWKaFOawxj1FIOaLAdYWmQngBQb5X Nahr+1o3+ykNILaXizE6u6QCLMpfUr09LeV+IdzGakcJ9eu0Np1pwmt5nJ2kUsD6xaGV+l ovVFI0AdRXgA6N8aTKaNRNxlzsZwJAU= X-MC-Unique: cmRXWPXkP920fw6fTtxwLA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 01/53] cs4231: Get rid of empty property array Date: Thu, 12 Nov 2020 16:42:58 -0500 Message-Id: <20201112214350.872250-2-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605217778; cv=none; d=zohomail.com; s=zohoarc; b=Qqu0Ixx1FR9E5k7izpq9UoEZj9LLcW/IDm/TVz5kpHyLZdbebfoa4HvD5p2egjSwD4B1w1Fr8iYYcYnw5RR+WA8LmWt32tpOhhB+zf82dIfiC27DJvVc4H1fHzSRDoePF4J8BoLuKg3v58oVPy9ncUmrizZdY01iErqMKHX6aCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217778; 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=NgAggK+nVjaePDR/9G/xwOqLWpnFGic2+9HsUcCsIgqytlJvMpL+tGN64Ob5IyafFa4C9vidF3qhoXv3bpt2iYtRIWhBCPlM0SSLj4h0dDWn3FP7v6h8oF5WkcF10wU7ftp/u1cKqZFTe2MhhnThWEV0E5XEdspdlHnnjkoJH5A= 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 1605217778783852.2331949821307; Thu, 12 Nov 2020 13:49:38 -0800 (PST) Received: from localhost ([::1]:35920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKTJ-0002Fx-Er for importer@patchew.org; Thu, 12 Nov 2020 16:49:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKO1-0005Pd-Q0 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKO0-0003AT-1a for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44: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-212-Rp1YzelGPric-TbbmUf6TQ-1; Thu, 12 Nov 2020 16:44:05 -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 1E81680475A; Thu, 12 Nov 2020 21:44:04 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 517CE19C59; Thu, 12 Nov 2020 21:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217446; 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=KnemorcWYvkwUGzL4/1bRwYD+dHNjP+hWo3yoBaxTwOvU81hpEY91E+ZfiZyWZR/pEfUE8 TmkLiZHC2pudGg8l9WzvdXm9nXEHpTtBfkRiCvZM6Gq9U9UTVhKalWolXmRj8MOhJC425Z oKCz3bPl+NrW9zGD9z5edgIJe1qblxk= X-MC-Unique: Rp1YzelGPric-TbbmUf6TQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 02/53] cpu: Move cpu_common_props to hw/core/cpu.c Date: Thu, 12 Nov 2020 16:42:59 -0500 Message-Id: <20201112214350.872250-3-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605217939; cv=none; d=zohomail.com; s=zohoarc; b=SNROC2avQhNX7zWkQalCsEp6+d22N77YVpZ+SNMGM1X+MWuyA1ELdlD6FvLKpE/uEFkllNqGgKDKsEMifqx+5QoYFIgd/kNvJlrjjK9sZPWnMCoQc3/Rfknnxu01MTPIUCIDAMO2I8rL36Xt1gDRmuuL0UrEcwXrdjfhTTe8AZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217939; 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=mLHcXxvL4/Fn7ZA1TVnh2xM1zfh1GK0H4FBoNyqLuXQ=; b=DVSFy0c9RUiahRiY3N818qqJ64lDP0Sez06iskgrhaAXU0z6HAcAscNvU4m3Zmkd/Nu8JVfvu+b04XpvbIMJgQUUWUCPOLzhRKibPxLoLJWjBOJBJUsPYod4g0cibCmZrMP3qiHiTqyqDUjgmT9M2Jr9Y0sAIg5Ojwfkt1c7B5Y= 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 1605217939196984.3899873160219; Thu, 12 Nov 2020 13:52:19 -0800 (PST) Received: from localhost ([::1]:44452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKVt-0005qQ-LT for importer@patchew.org; Thu, 12 Nov 2020 16:52:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOE-0005TW-9E for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOB-0003BF-NY for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:21 -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-11-5XYrwRMYPbqpuLqU888oCQ-1; Thu, 12 Nov 2020 16:44:16 -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 F3B748030A7; Thu, 12 Nov 2020 21:44:15 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 079445C1C2; Thu, 12 Nov 2020 21:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217458; 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=mLHcXxvL4/Fn7ZA1TVnh2xM1zfh1GK0H4FBoNyqLuXQ=; b=BCIn4kdQVHzw2Dq6XafOwu7bFCSEubuitc/HMZxEksRASimcTfQIAhcnrXGkY3Zhpzeo6m pYCa1qVCZA4w702VgnTnr/vTVpq9Hy7XJMuLJ4DjRkgMINVDejf8moNCmtiQ8RTLKyrW7C AFkDZDn4kbZUFvHkpbH02YeoQT5aWBg= X-MC-Unique: 5XYrwRMYPbqpuLqU888oCQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 03/53] qdev: Move property code to qdev-properties.[ch] Date: Thu, 12 Nov 2020 16:43:00 -0500 Message-Id: <20201112214350.872250-4-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 5e737195b5..d75cf47145 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -274,43 +274,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 fc4daa36fa..3c43107f71 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -714,115 +714,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); @@ -1217,17 +1108,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 bcfb90a08f..79164e4a3f 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 4 16:51:48 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=1605217635; cv=none; d=zohomail.com; s=zohoarc; b=PNGmqt43+HEFXN3iR2tMu+ClV/X+LCB+5e7vdeFq2B/2vPZSjJ0KY5b4Ntu/c/vPZctIBbVNeBBimsU16jFT36aqWCJa+nBvhuMt/EPTi9qfQwNbVlSPe+xHOa+mtDAJSg0JLLQhHth4gJ7FloWMEiFxhZwL+Nm7rwIfVfV//ao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217635; 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=XHZK6RBco8CwNCjboo6oFCVj85YmjTE2pZhzn2ysP07VeNnd6uumvDZz39hcPmGdv+fXa8TGxTbo0jIglwxY5n/T3DymSck+gzQlpL0a5nY0nHSPHp8+V6XEI/zlvxRxgR4cGJ/o7nH5NK/GKnXP134ElPjhuQPDGVR8PCeu+hI= 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 1605217635225729.1732280934821; Thu, 12 Nov 2020 13:47:15 -0800 (PST) Received: from localhost ([::1]:56686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKR0-0007TK-3u for importer@patchew.org; Thu, 12 Nov 2020 16:47:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOT-0005UU-Lu for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:29995) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOH-0003Bo-Q7 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:35 -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-104-XyHtkva7Noe97voyc3kFeA-1; Thu, 12 Nov 2020 16:44:22 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31BBA809DE2; Thu, 12 Nov 2020 21:44:21 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E960F1C4; Thu, 12 Nov 2020 21:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217463; 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=AZHQvFRNiY1f2vcqxALidLQ4KcEaVSFF/BksMnWVm3g+01iHa66Ii8T61Gjr/wnV+dd6ST 30M3E8ePwVlmpJZ5c8Wf3TAWDgjNE4VJqro+1TT1NbeNpu7hukxwEimjjevsIiJGVIg983 kMiR4XaDlTRZvem3k4gvuvE+LXM915s= X-MC-Unique: XyHtkva7Noe97voyc3kFeA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 04/53] qdev: Check dev->realized at set_size() Date: Thu, 12 Nov 2020 16:43:01 -0500 Message-Id: <20201112214350.872250-5-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605217791; cv=none; d=zohomail.com; s=zohoarc; b=G1nN2WvuCWtvx4sgAp1UAto9DojLxWb1QyZCH3RV0W3+fbWQRShBGl+7R67ckfgAiKxsEfF9WMt0tfuB2t6toNJgemAnviDAB9CDDtL1WCc5QrrUc/pVApZkZl8azhfV9CEzYW0UHDuNHINJnHkOzvQbicETAE+IQDdMRrRCBQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217791; 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=e1w67iYQ+9XepZPuBza1kMNBRESrNxur8ZCrpoHr6vg=; b=i1KQwMANNPNNf2Q75YLAmdnYNbXN9CW2nOA50DdO8FPbT6OlQZIe8M7wKb2pobX1TUpqWFNagpUzeyIf2ZVLy7ZFY2VAHrXmw2qNCHjyywetSAHuwQc4FSldDErBlsBwAoT+BBh26rmexEQ7b+/WnqiZYvJlRHO9ks0y55W+KJc= 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 160521779169973.61589046401753; Thu, 12 Nov 2020 13:49:51 -0800 (PST) Received: from localhost ([::1]:36928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKTW-0002ev-GO for importer@patchew.org; Thu, 12 Nov 2020 16:49:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOY-0005Vr-7b for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOT-0003CC-Dl for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:41 -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-500-S_WVC7pcNtyt2IS3BvCQHA-1; Thu, 12 Nov 2020 16:44:27 -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 12F5C803F41; Thu, 12 Nov 2020 21:44:26 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9511C1002C37; Thu, 12 Nov 2020 21:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217469; 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=e1w67iYQ+9XepZPuBza1kMNBRESrNxur8ZCrpoHr6vg=; b=KOncINFKhboyJd3v7ACI1Fl8vid7f5KA4j0+k725iih70iQ8wWqxf/OKxrP5s6tvYcB8qI fVoJPTEyluKP8YB800Pp+nIzHR3Zi9QkJA+OcSCfSV2IH13F73rBcO6FZqqHIQfKnrV87g eCPuBN7V8sz5xWQAOiYBjVINc44pRGY= X-MC-Unique: S_WVC7pcNtyt2IS3BvCQHA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 05/53] sparc: Check dev->realized at sparc_set_nwindows() Date: Thu, 12 Nov 2020 16:43:02 -0500 Message-Id: <20201112214350.872250-6-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 cf21efd85f..8ecb20e55f 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 4 16:51:48 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=1605218091; cv=none; d=zohomail.com; s=zohoarc; b=nCaBrc4qHzZ1/ocbXhxJYjrkmscSfz7SiwTGoabeFcDAh52FujY/w2VxMk/l4g2Yedg/iXxh8ttL4x1BXriLGLJgn6MnLOROzStilmy9V5V46l+Bi/zmUxZ9HT/Pt+NiWml7UfcXo4XdtAb+GPNvZb15xMAeUHziyMHST46nlIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218091; 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=ixh/uw9Uu1fgOWhSwHADCauXqDY6RJNNkSqMdpdxJVjMX1i0HvZU8EX71sSQzKyLvo3OLx/OLJ0z3uSRu1iQ/1pd6jkBUfSzBl7J7nwzlfCLxyJycvO7JGZAoS5rp/jdVChy8mxFk7IhB4RyJrMCQfG/uJZKoOnQHbpDKoPljFo= 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 1605218091859882.5366683093827; Thu, 12 Nov 2020 13:54:51 -0800 (PST) Received: from localhost ([::1]:52822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKYM-0000r3-Nj for importer@patchew.org; Thu, 12 Nov 2020 16:54:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOY-0005Xh-Or for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOR-0003CB-Vs for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:42 -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-363-21RxLOnpPfWP3Bl47Pf7mA-1; Thu, 12 Nov 2020 16:44:28 -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 310AA809DE2; Thu, 12 Nov 2020 21:44:27 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E67141002D46; Thu, 12 Nov 2020 21:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217469; 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=TRAdGTEMfTXlo9BsCjz7JY//l5MJJ23hwrLr5KbpAV50CbYlbur6uczAyn83C1l+0eNRax nA3wn1M2dxaJ8Zk7hBNetP4Zbf2mEPNLga0LMzzeIFOVNjsFr75dA+dKqE1meMP1FdZ3as mQeT9mxds2nXVPpucu2nQUzm2M6+kYM= X-MC-Unique: 21RxLOnpPfWP3Bl47Pf7mA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 06/53] qdev: Don't use dev->id on set_size32() error message Date: Thu, 12 Nov 2020 16:43:03 -0500 Message-Id: <20201112214350.872250-7-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605217636; cv=none; d=zohomail.com; s=zohoarc; b=c92bzUvBcQhTeZtDShE5wH8atq9/sAv2Q32ZEQPRZIC5Ls5tHplKtsToO1cZGXjMIyZuTCqif7Oweqio+kAGROERtW/WKjCmmDhc+eMXQNkO/r9AJfaR15NAY7IJzAU7dugYMEibHeno6VLA2yDtWxPAJUE263fhu6dw+uxLJvk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217636; 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=GQ0NhKPBVv20x0zpCb2NBxK3BLDlcnNcp6ai4Es5lBw=; b=Ls7mrmaKpq1fwnIEoQDqA3k1zDKEOkvvBjxsqt/l3uJs7ImBO4fFlqqhUfac838TYL/UrfGQHkRCwiVaMF6Y2G/uM2gzgWelsGQ4m813L50QLlDyfusU515Dx10Mj6Ti1fq+KbsZSSw9ZMaSC65oSeFL6977WCs5Wdueflxd3s4= 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 1605217636784535.4014445952715; Thu, 12 Nov 2020 13:47:16 -0800 (PST) Received: from localhost ([::1]:56742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKR1-0007Ul-KR for importer@patchew.org; Thu, 12 Nov 2020 16:47:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOX-0005VL-0p for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53315) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOT-0003CP-DR for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:40 -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-414-lCliYUHNO6KX-jZ9bEKF4w-1; Thu, 12 Nov 2020 16:44:33 -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 D339A803F41; Thu, 12 Nov 2020 21:44:32 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FF9F60C13; Thu, 12 Nov 2020 21:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217475; 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=GQ0NhKPBVv20x0zpCb2NBxK3BLDlcnNcp6ai4Es5lBw=; b=MoOgEbJtqoZeIeo01CNGsi8WvJOA8h4mjO2oNRLi4/DhjpFWKWkmb+UEr/3zWRhSgNVPbn oxukIC+xIiipgmi+7bum35KJeWl16vWjKOrhOXlVAhHBQUGN/uFKGSfwog/zSva3SUeHBr sWHqQsFpEvKsdgRuIc96SdMeu0weX10= X-MC-Unique: lCliYUHNO6KX-jZ9bEKF4w-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 07/53] qdev: Make PropertyInfo.print method get Object* argument Date: Thu, 12 Nov 2020 16:43:04 -0500 Message-Id: <20201112214350.872250-8-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 b81a4e8d14..d0fb063a49 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 4 16:51:48 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=1605217955; cv=none; d=zohomail.com; s=zohoarc; b=PmuWS8OB9l2srIsu8rpWIlyd4suZ/3P9dHS2UMJg78Ad3PWWNZ6EjEyFKpC+Dxd6gFXkOXDjUP361A9KEaQzItUTYy0zapJoBEI1aRDZWuwCoAP10RB6UUe2YAOiR/3DzfcMxX1MxmdTJj/cyuRJV457SmUf/cLE4lHyKljpWjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217955; 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=nDzX2EXklm3W8RhM5NMM+AqgTdfAPBWEELwLa44isc1HHL7aWCciPgZFwOy1eOjXjUDb1wQCQtV6qbMG5UlXtekIw/CfxeJbqWo80WCMcQ2mSV+yXxFy6IuKgWwMjAMULceL7kAjjFsYcQ+4yo5ivVxEAVSijv8prlswMBgb9XI= 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 1605217955046916.5150466731142; Thu, 12 Nov 2020 13:52:35 -0800 (PST) Received: from localhost ([::1]:45284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKW9-0006Ao-BJ for importer@patchew.org; Thu, 12 Nov 2020 16:52:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOY-0005X0-Kj for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOW-0003Cq-Tc for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44:42 -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-591-Hic_p3ZVMQSGkWT8totNOQ-1; Thu, 12 Nov 2020 16:44:38 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A9BBE1018F70; Thu, 12 Nov 2020 21:44:37 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id C64185B4A7; Thu, 12 Nov 2020 21:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217480; 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=Tr+icB/7urX/7vqE1zNPpMtdTj/PMUpvP3m2Q4B2wVifwbj+sygquV2BRIF0rj9M6wXkm7 BI4+x75/nmEwR1XsmUHqNh0vN7H5eF07ikT1lzdvcKOCGw6xQxGdygyf0ZOXdDTRPsEUdr StnLI+IyQb6YXpjYyQloR8ihu54cfxM= X-MC-Unique: Hic_p3ZVMQSGkWT8totNOQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 08/53] qdev: Make bit_prop_set() get Object* argument Date: Thu, 12 Nov 2020 16:43:05 -0500 Message-Id: <20201112214350.872250-9-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605217524; cv=none; d=zohomail.com; s=zohoarc; b=C/fhemScDfXDf9tgSrzX7NoS1O++j4EKK4tyRkbcJywg0LUITwc4TvWzTMjdX07SfCABbrwHRhLnc/C76LBhfc0rzaNhp6g1XlTOCN8LY9lrNSJQsYo+C0OHnQ45eEGxeVwoBVER4uaP2OmyoXMQuTkXX0WUeftNPC5F/WAKsiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217524; 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=fsQe7Mm1Y7+ujDMAz+Zy/FiKiDElt5mnHtrgipEPHRs=; b=BSoYiIVJDR2mcjxsD9Mai0gLW2Ui2Z39+n9j4A1WHPB5y21+0EnfBCCR+Mie/rCIsV+oNLVHBT6rolFk5RFJ86fRrHxmHlGNeOTeu5+MBK5rTZqfpGyhiOSf/FpG/OZq/z07fNJB2X/u813J2FiGtIoyzym3QCJ8H0P769DHcuo= 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 160521752487482.36173071969972; Thu, 12 Nov 2020 13:45:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.26074.54202 (Exim 4.92) (envelope-from ) id 1kdKOn-00009u-W9; Thu, 12 Nov 2020 21:44:57 +0000 Received: by outflank-mailman (output) from mailman id 26074.54202; Thu, 12 Nov 2020 21:44:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kdKOn-00009n-TB; Thu, 12 Nov 2020 21:44:57 +0000 Received: by outflank-mailman (input) for mailman id 26074; Thu, 12 Nov 2020 21:44:56 +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 1kdKOl-00009i-Sp for xen-devel@lists.xenproject.org; Thu, 12 Nov 2020 21:44:56 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id be3cb944-7732-4a93-b71b-bd8a2701a698; Thu, 12 Nov 2020 21:44:52 +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-283-HzfKj2k2Oy2N0dzTzOJcrQ-1; Thu, 12 Nov 2020 16:44:50 -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 467451018F6F; Thu, 12 Nov 2020 21:44:48 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EBE45D9CA; Thu, 12 Nov 2020 21:44:38 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kdKOl-00009i-Sp for xen-devel@lists.xenproject.org; Thu, 12 Nov 2020 21:44:56 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id be3cb944-7732-4a93-b71b-bd8a2701a698; Thu, 12 Nov 2020 21:44:52 +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-283-HzfKj2k2Oy2N0dzTzOJcrQ-1; Thu, 12 Nov 2020 16:44:50 -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 467451018F6F; Thu, 12 Nov 2020 21:44:48 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EBE45D9CA; Thu, 12 Nov 2020 21:44: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: be3cb944-7732-4a93-b71b-bd8a2701a698 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217492; 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=fsQe7Mm1Y7+ujDMAz+Zy/FiKiDElt5mnHtrgipEPHRs=; b=PpiHi/8m5QwIeYhxdM5kjXl67ns4GDj0ReIKXEku0dkf+lhvmMgKOF3Iv/HlJLzXq57T3+ th92C8Q5zRA/2JAL1vs3SYyNmutumjXsjMeIvlJ/gCtbTE0lDuAGuzp7BXSl5MsBpl4hHB x8AyheRfWJPeh7RGl7IuJnZdRMQ2Hwo= X-MC-Unique: HzfKj2k2Oy2N0dzTzOJcrQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Cc: Igor Mammedov , Markus Armbruster , Kevin Wolf , "Daniel P. Berrange" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Eric Blake , John Snow , Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger , Stefano Stabellini , Anthony Perard , Paul Durrant , Max Reitz , Cornelia Huck , 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 v3 09/53] qdev: Make qdev_get_prop_ptr() get Object* arg Date: Thu, 12 Nov 2020 16:43:06 -0500 Message-Id: <20201112214350.872250-10-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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) Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Eduardo Habkost Reviewed-by: Cornelia Huck #s390 parts --- 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 b58d298c1a..e91c21dd4a 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 d0fb063a49..c8c73c371b 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; const char *e; unsigned long val; @@ -950,9 +941,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) { @@ -981,7 +971,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) { @@ -1027,9 +1017,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) { @@ -1067,7 +1056,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 48a3be802f..ab27b6e848 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1323,7 +1323,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); } @@ -1334,7 +1334,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 4 16:51:48 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=1605217790; cv=none; d=zohomail.com; s=zohoarc; b=PeDPJHAj6R7fkLf6kC1k9dNp2XxNLZIBe9XpbV+FK/3aqrC8QsFMxuj6p006kT2fXFyPgC1LRsSADOelLD8QrcLXAvZYSPko7ja4GpqnhjK/CQJjJuu0MEoLc7uVM1l2oy/F8fHVcIovN9deblkFwaj/IlqJhna3l/WfM9Q2YeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217790; 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=VS6q04t6dHHN72NkI74EXZ/EGgWszfu/YZ3EAegBiW8=; b=a1WlINJimptOYEVYKNE1LS73dBm0E0wvM1X9TMh4p0v7Qb1pKGf1mQwtev8M3NdXl8eB8zIg8qGwl3ygswM52w8WuUqFp5BVXEKknuc4Gg2qGJ+8ZACyDMRWNKtmjMpCpWjI3e5M6KwMoO70t5V0MDgcjGt/pcnIQtzM9V9/5L0= 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 1605217790106952.8939830380897; Thu, 12 Nov 2020 13:49:50 -0800 (PST) Received: from localhost ([::1]:36828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKTU-0002cO-UD for importer@patchew.org; Thu, 12 Nov 2020 16:49:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:32810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOn-0005rX-Us for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOj-0003Dh-Qp for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:44: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-552-Hgprl6UMOBirS6MpEjJeoA-1; Thu, 12 Nov 2020 16:44:50 -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 B625280475B; Thu, 12 Nov 2020 21:44:49 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4554B5D9CA; Thu, 12 Nov 2020 21:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217492; 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=VS6q04t6dHHN72NkI74EXZ/EGgWszfu/YZ3EAegBiW8=; b=hpX7FAog7Wfxh/a4l8UukXzUAnloiXOGhCpgQhs+iJ7i9APQ1BqTY2ls7GLYSNwnnnlHUG Y5/3rXxs3i86bQARUlzIyfiqXpJH4vOHc66fgzAlpdOSvqSKIf+2vz0FTRJJnb4K2yk57l IMe4A2KjNoMiHtFo7s0QImLqiADkI0k= X-MC-Unique: Hgprl6UMOBirS6MpEjJeoA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 10/53] qdev: Make qdev_find_global_prop() get Object* argument Date: Thu, 12 Nov 2020 16:43:07 -0500 Message-Id: <20201112214350.872250-11-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 c8c73c371b..af1339e562 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 4 16:51:48 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=1605217787; cv=none; d=zohomail.com; s=zohoarc; b=NZLiYnnAiS8TnxUnVNcFQNI5KhamDQ/a8Uz8IB8gDk/wBE15IwDFXJqcoGZCUmM2vB4ssmMF0AGh3S0PfDSw7NdggdnMYSJpJv3oIZ435zHGWY5mSBB0GuGv666xRTa1y089gn+fnhTVucSerqX4iRAqdX0JrBJChtXY4BKB8cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217787; 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=B/Dy3vbFXj/PEABANWsi/yWsndCc/kQP2GOtgkpAUPA=; b=GrbiL5zriBN1ZqyXBf0qcjWGEvQbfZ8Rjn8vw1B3+4VZ9P8M6Dhy0Z/qXz/x1Yp7VJ6CyF4HZ1zO/XT6duYNjUOgFZybQl9fRTq03zaSZ3QgTc2gSseEl/pvTCYqZ0uhJbZfPM4h2lhObJ1fu8Y9vqv+mN4KmRgxgzXioa35Tn8= 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 1605217787424785.7084170066541; Thu, 12 Nov 2020 13:49:47 -0800 (PST) Received: from localhost ([::1]:36558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKTS-0002Vp-8C for importer@patchew.org; Thu, 12 Nov 2020 16:49:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:32864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOu-0005sz-7J for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43189) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOn-0003E2-MN for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45: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-196-b_VtTnplNy6ZTJvcGMJrdw-1; Thu, 12 Nov 2020 16:44:55 -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 12887CEC62; Thu, 12 Nov 2020 21:44:54 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACEF119C66; Thu, 12 Nov 2020 21:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217496; 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=B/Dy3vbFXj/PEABANWsi/yWsndCc/kQP2GOtgkpAUPA=; b=XWS38UJwyVp5jjJ5hFMMMOwmGvhu5gIGFCgYKpksL8IfEIC0ahJOg6lsTeOWxXcDliJKPZ VpVZk/Se9tZv6pCdev/m2MxoQOPL2smOGuGob4AWQBL/+dzHgjVAQS+WkBgB2JLlxaJ1ER 7RsTQffOGp0MvalAyASiVi5JMiD8Yfw= X-MC-Unique: b_VtTnplNy6ZTJvcGMJrdw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 11/53] qdev: Make check_prop_still_unset() get Object* argument Date: Thu, 12 Nov 2020 16:43:08 -0500 Message-Id: <20201112214350.872250-12-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 af1339e562..85dd38db0f 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 4 16:51:48 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=1605218497; cv=none; d=zohomail.com; s=zohoarc; b=lYZa8IRpePhLEqiLdMGS3BkOVeOt72bVtFGaPAAi6qm2V1JxVU9KTfla8HiuATBpeSu8ROhU3/BxM7oyfcqUcI3sBpC7sxDBD0DwLYN5TqBnTF67e20IciO4m1hQtakv6netPSc9XopHqG+BqMEvLNGvsJL32gHuaKlaUAfKzMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218497; 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=4QElOHDC/35LO7q4B7zn7FLHHICgXF/5toJDsrOlvt4=; b=ZTKvXYF9kazALmkWRf4LBSm6UhXoBQFqADULx0teHNvKqjWuctwsZVlHNdb2fse+wn8DLCiumHL1tsNir3kMr6C+jV5mDeOAuPAt8QmXA4hSxSeCOqX74MXSYKQDzKta+Uen8r5A5C1gNSMpviJgODRe+Ym+bM8hwUc9ZgXMxVg= 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 1605218497781753.0076722047152; Thu, 12 Nov 2020 14:01:37 -0800 (PST) Received: from localhost ([::1]:43966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKeu-0000k1-LP for importer@patchew.org; Thu, 12 Nov 2020 17:01:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:32880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKOy-0005uP-8W for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKOv-0003GY-Ou for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45: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-161-XGcBN1HSMuKPhQBkF01Wtw-1; Thu, 12 Nov 2020 16:45:03 -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 B4636190A3E1; Thu, 12 Nov 2020 21:45:01 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id F14E460C13; Thu, 12 Nov 2020 21:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217504; 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=4QElOHDC/35LO7q4B7zn7FLHHICgXF/5toJDsrOlvt4=; b=IZ1ojGMETo7BTdeliBuD5KXin08MwjW7SiYoPMTyVGLmz2IFO+aeNbXXvmxn1g5ABB9/nt sC5K9Oc6mDk2xkCgxC2cb6IJ/aLBYkUiQzNk9sasU/qYCW6qFUW+7uJaFAg8uauR5rGlcD efWuhdtfquy4zWEXb8fuu8fgOlf2FRk= X-MC-Unique: XGcBN1HSMuKPhQBkF01Wtw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 12/53] qdev: Make error_set_from_qdev_prop_error() get Object* argument Date: Thu, 12 Nov 2020 16:43:09 -0500 Message-Id: <20201112214350.872250-13-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-s390x@nongnu.org, Paolo Bonzini , Igor Mammedov , Richard Henderson , Christian Borntraeger , 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 Reviewed-by: Cornelia Huck #s390 parts --- 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 85dd38db0f..fca1b694ca 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 @@ -913,7 +913,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 4 16:51:48 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=1605218678; cv=none; d=zohomail.com; s=zohoarc; b=JZvCuUQckVQzsrZLsJcCqM80N6fk50jYCgG6ta1d4PcKLH7+dlyGOQ4FQLQKdlL7z9QKSv8/xX7RyNpBisBO0CBAKbheanSNCnZLqNSNqC1KRwfvVi9jUKgz+PvbxpiEbGXo7//McYOofDEq9RhMBNGsUSZ7sbn5nZhagxidUPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218678; 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=WawL40rTSVvQVvje8qDxYXbxpzfbuVIls966ym+zJGPaz+QQlqNo2AoOvZJ4TazuXpZJIyVc7ZPBKmDclMNl7JTeXsT6SE32CZRwYw5BivGPaHY449RiQ587Jo20Kz+xWzfJoE2zx9k7mT0yivs5rBPI3qJwWZtdPgk7R4HGujw= 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 160521867894346.67576596517142; Thu, 12 Nov 2020 14:04:38 -0800 (PST) Received: from localhost ([::1]:52176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKho-0004NC-50 for importer@patchew.org; Thu, 12 Nov 2020 17:04:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:32948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKP4-0005wV-86 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKP2-0003H1-42 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:13 -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-109-zfjucTHyMASxtzyBO-qccg-1; Thu, 12 Nov 2020 16:45:08 -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 2253880474B; Thu, 12 Nov 2020 21:45:07 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 968875D9CA; Thu, 12 Nov 2020 21:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217509; 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=HZWBLSp3nCdjqNIguinthgZrLHg2esOfR2wi/0ZYhIHAkjr0IIkLHMNc6thISwO7qENYQB 3xUPW8Mi2YKwvOGXy4LzYuqNogUT7rR912+hd8bBH4iHI0n4/3PG3Q0ja9Uu0FsJUirCmK cPn5hN4L3heAXSy2p9G7j0Aog+JQXIs= X-MC-Unique: zfjucTHyMASxtzyBO-qccg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 13/53] qdev: Make qdev_propinfo_get_uint16() static Date: Thu, 12 Nov 2020 16:43:10 -0500 Message-Id: <20201112214350.872250-14-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605217949; cv=none; d=zohomail.com; s=zohoarc; b=jxzJzXuhpD2UouyY/tiKtCf3nK9MuTorwpXQKU9b5ZkE9Kh/vxPgs/UIH9vzQPvm1/4kZRi4PCuGP2ie6lQyk6RoVjc2ZMwzQy0uRm4rJnECcPLTDq8IQ0NvL/waPpDiq4EVSd+lDxXA88fsI/6IXsBOud7jrshPlUrVkCNMlXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217949; 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=xRQE+h84RpMU/EfoXCBgVLENx+SzpU+pjO6YsvFZjlk=; b=T0nZZGLvAaiAxJoXpsFmyeq84kxpE6qDznOsEyGBDG+QbWQa6Cu8s5ouIDWLbvwbAzxlQuFGE41xndNY7lN8yUK3c/OXsvtOjpzll7BmJt6SuBq0BDiHaK+THSpFF/X/LQkDvML2+K0Lm5vNsXqI/xix6wpnIPfTo7OXa8ibks4= 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 160521794942351.675550036551954; Thu, 12 Nov 2020 13:52:29 -0800 (PST) Received: from localhost ([::1]:45180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKW2-00068L-3r for importer@patchew.org; Thu, 12 Nov 2020 16:52:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPA-0005yB-1e for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKP7-0003Hk-LM for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:19 -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-357-jnArBD9MMEaBrWCIn80qiA-1; Thu, 12 Nov 2020 16:45:14 -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 00B2F803F41; Thu, 12 Nov 2020 21:45:12 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1EFE55795; Thu, 12 Nov 2020 21:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217515; 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=xRQE+h84RpMU/EfoXCBgVLENx+SzpU+pjO6YsvFZjlk=; b=GfLO6tkLRePieGET4vndSeubWbENF18gqbKXPdpvmH0JqMgFDlCjst41q14s67FKIARkTu CsQmJ05OQpWaCoN5VhaS7ImW4BVng685UD84gti1Mqz638/oM+opgvIsfFnk6AT/pZ9HWf r9Fi0YjWN2z/eHCPEsGwwL323BBI/AI= X-MC-Unique: jnArBD9MMEaBrWCIn80qiA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 14/53] qdev: Move UUID property to qdev-properties-system.c Date: Thu, 12 Nov 2020 16:43:11 -0500 Message-Id: <20201112214350.872250-15-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 fca1b694ca..35515886a9 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 @@ -1105,3 +1106,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 4 16:51:48 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=1605218865; cv=none; d=zohomail.com; s=zohoarc; b=JkJ+dF36Ms0f9e37Wqy2iYrLrx3FzIQ1sL8MoxY6z1/8NaWSdPLH+lF0JNslb2PIEyYdm8rL976SSr8WKbbehFSWaVCtI366QN4SDnSGL9AtF1yPfGoy1cqWc2l2jtpaHVS9Jwo/CLLPYANE9U7kA3uUoVorliruNqA5hbQ41PY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218865; 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=2WZkvj3S+aHVKpuoFMhL6L6VqPa64O9nCFem0ziEyIs=; b=kSluAPnbbhhI2vn2ONcu/fQeBMTCVv75EBondsLk3I4rHHAuxrMB9ZTR64HOfXwyMNuEVk9KEZKcTRornv0+4LCVgxn0VGnwVmqqJZeZxLMOCjo99QzRRhXUStc3lHfo5+v33RZ/d5G9QMxARMwgCcMy1uhYhQDKaGrtf2DSKcI= 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 160521886571059.8031641683184; Thu, 12 Nov 2020 14:07:45 -0800 (PST) Received: from localhost ([::1]:60552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKkq-00080d-7E for importer@patchew.org; Thu, 12 Nov 2020 17:07:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPG-00062Z-7w for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPC-0003J9-3v for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:25 -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-211-N_PyIW4tM2GG8Q7s-hhxPg-1; Thu, 12 Nov 2020 16:45:18 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EA7B91018F75; Thu, 12 Nov 2020 21:45:16 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FC8F6EF62; Thu, 12 Nov 2020 21:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217520; 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=2WZkvj3S+aHVKpuoFMhL6L6VqPa64O9nCFem0ziEyIs=; b=gFh3Mvv9zXPhiRAnSGujGDQjWZLZKi8JxjJigFpHifxJw1H/bSBvBd7JX95U8VrGKf/Vag huVLkicckqXaKOySiXX5cBnqzsyBF6UnWZhGDeZXKgf3NvwbGP5Xs8ikNGC1cy+hje7scq MmsP8VYSZQD4FdKFbUtHiu6BM4afdHw= X-MC-Unique: N_PyIW4tM2GG8Q7s-hhxPg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 15/53] qdev: Move softmmu properties to qdev-properties-system.h Date: Thu, 12 Nov 2020 16:43:12 -0500 Message-Id: <20201112214350.872250-16-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 897b2d7595..da48bc8254 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 591776ba88..9c8030a271 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 483925f57a..0ef7f00cb6 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 bcceb64ebb..5558f5d2fa 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 f0fcd63f84..90baa72f82 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 eb02fccfa5..e2d8a004fe 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 b97aacba91..c5ead05e08 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 0e8b4e46a3..5cb87de548 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 1e83dbcafa..09e2f6bd76 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 97f71879ff..d99daa7695 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -35,6 +35,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 35515886a9..a05150bfd0 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 27ff1f7f66..73499a6235 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 0131d9d02c..ad2fa1eea2 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -30,6 +30,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 e859534eaf..f9a591cd17 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 3091382614..fa07398c8c 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 58c0ce8971..edfaed8c9a 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 3263aa55a9..68c8c715fa 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 4 16:51:48 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=1605218268; cv=none; d=zohomail.com; s=zohoarc; b=Vhq7HqM2zNqQwlWUXT1IjW622uDjnQiDhVtjfV1+miQjii0nRjs3cnIggqK5GWP60P3OFclpdVzj903PfkGwIS2Whh1xEOm3+hB8YziBFsKcvsWEgItH9NU9Eouu5XuuvaF5Fa9IB20/2GSzgjMM0Xtm4uQaOJgC02juVYOTzPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218268; 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=c1Z9/eXFf3OVLCXWRRe400ihvpKngA3vxncX8xO52OEygkEwzN1D6/f834Bxq6nhXBjyPA5p29QvXU/OqR637p/W5p+O4cYTvyKIXMjY1pbYjAJSqmvjm9IA04+cHT04+8LwzVRR0Zk3yH5MMl3AP4/MACAEWA+OLyxbFXhVcR4= 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 1605218268641618.1038685564927; Thu, 12 Nov 2020 13:57:48 -0800 (PST) Received: from localhost ([::1]:33444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKbD-0004ch-6C for importer@patchew.org; Thu, 12 Nov 2020 16:57:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPI-00063O-7I for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50390) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPE-0003LP-Cr for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:27 -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-143-TYl-mB2BPKOzdQR8yqOloA-1; Thu, 12 Nov 2020 16:45:19 -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 5C4E1190A3E0; Thu, 12 Nov 2020 21:45:18 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AC4F5D9CA; Thu, 12 Nov 2020 21:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217522; 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=X43SAQOEVGIHn2qKKYdW+q3Ua5KtRbpbFbNbCHp8oTX1tSDMDpQluPN3haVbN5koRi+xVV R9ObS8HSklaOBdLpoEtX9prwzQ1CeeIK/4d5cmJ1A9ztT18emCv4MVVuPW5gx22wmB+gFh 6c5oyrfs3Ah0yLBu71ug6MelUn+n+Uc= X-MC-Unique: TYl-mB2BPKOzdQR8yqOloA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 16/53] qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros Date: Thu, 12 Nov 2020 16:43:13 -0500 Message-Id: <20201112214350.872250-17-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 4 16:51:48 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=1605218099; cv=none; d=zohomail.com; s=zohoarc; b=HnMzTSAXVw5A4vQjGnME4w3tnRipKe2An1xhN3UnBmf0ZjmE3POQJDyHoSgcHXIJGg0GfTD26C9BthfjsSqJqGPWeEXZJxnJZ1r/8zcHd5V6lmWCp8+ItY63gQVpRb94GhAiQ6974I39KlTfHmvQ4HSnMFjuPTGKpU9XBZOKAe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218099; 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=1gXyAjYBFMPg/HrFf5+9sbnRwUI8ySsTuB3LOsuSUww=; b=kjPVyfg8wXc7gXr5SMfQUDig9/Q0qds66wXy49I4njPdJNs363bi+kiucG3R4v+cgjQW1p/UssTyDkIqgbpG4AvtGMMJYBIkLNj4eoXqYmOBHgr0n+mMIlWWijaS1rUkDyV7ftDHk4SuAXq7lPxi9kyhkGTauSDdGFLTPxxoEPc= 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 1605218099549963.6282981428977; Thu, 12 Nov 2020 13:54:59 -0800 (PST) Received: from localhost ([::1]:53606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKYU-0001A2-EK for importer@patchew.org; Thu, 12 Nov 2020 16:54:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPF-00061M-GS for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPD-0003KX-3G for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:25 -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-528-KstTFu20PWuwgeaFD8Lutg-1; Thu, 12 Nov 2020 16:45: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 7E4F0190A3E4; Thu, 12 Nov 2020 21:45:19 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DDCD5D9CA; Thu, 12 Nov 2020 21:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217522; 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=1gXyAjYBFMPg/HrFf5+9sbnRwUI8ySsTuB3LOsuSUww=; b=iAEmhzX1Qxxe46OAHcdfDCzkkcJau2p8px6NnW71ilPWZvh/dPjH98/38JgCjKHNzTIg/2 DFzquQKcK6ytsmEAJ9XfbV8+MYQJp4i5JmfgBnsJY7zRqlRX80ZAtcBTlhJSAzevJYwtW3 AYeq9F+wWDJdR1zQLFOjhqSbot/2mdg= X-MC-Unique: KstTFu20PWuwgeaFD8Lutg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 17/53] sparc: Use DEFINE_PROP for nwindows property Date: Thu, 12 Nov 2020 16:43:14 -0500 Message-Id: <20201112214350.872250-18-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 8ecb20e55f..f5cff4103b 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 4 16:51:48 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=1605218123; cv=none; d=zohomail.com; s=zohoarc; b=RTaBKXHLGummkKfQ89G0vxrCGXs/dMhLfts3Owyk6Fx7AlYs50X/1/UKL1g15JGMsg1pIM0+qFTE8sXsH6Dp35VFkQrA0r47quyx7W1IYnZ8LWM/3ZZV2fcyCaDn5CgILxfB1xIcguBpNNRBKVpnibJ+FVMtAr8UbacnR+YtXDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218123; 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=wPgPqQ9++AMho+S9RNneV8XCkLbwMta6POqqRICYcZk=; b=X0hipUACyiOjiSjdWgwx3Z2l3aW8P4wN4X+mJk6Ds551vElgPD4g4583l9n+436NqO1o8Zg3EWn9eqxVSinYnFdZdMG4cjv25nSCoilcN7i5C4lXywi3aEa1V/fEyBMn/x+7IbZrXAUBKJ0jsbesipdKzWBcGOaW86SmNbeuXeo= 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 1605218123894462.69488697967495; Thu, 12 Nov 2020 13:55:23 -0800 (PST) Received: from localhost ([::1]:54376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKYs-0001Ug-P7 for importer@patchew.org; Thu, 12 Nov 2020 16:55:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPL-000698-6P for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35021) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPH-0003O7-QV for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45: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-557-88IwWCY8NU-17ukTBURnDw-1; Thu, 12 Nov 2020 16:45:25 -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 B6E208031FA; Thu, 12 Nov 2020 21:45:23 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6958F55763; Thu, 12 Nov 2020 21:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217526; 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=wPgPqQ9++AMho+S9RNneV8XCkLbwMta6POqqRICYcZk=; b=ccSKtDR7gkWVPHzvXRviS3oP8wOdn2dBZ+y//TUXyqiJCypSJBp2vuB5071cH0PrtDkX7R Is1oNq85KpTFDqO/rNyPSChaIP8UhRn03/fu6aJ45iiDkvHdO8AFqxv5Z2oYNLcoKsu7U1 021TcOuJU1F388S9bpCeqiLXio+2Dvs= X-MC-Unique: 88IwWCY8NU-17ukTBURnDw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 18/53] qdev: Get just property name at error_set_from_qdev_prop_error() Date: Thu, 12 Nov 2020 16:43:15 -0500 Message-Id: <20201112214350.872250-19-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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=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 , Thomas Huth , "Daniel P. Berrange" , Christian Borntraeger , John Snow , Cornelia Huck , David Hildenbrand , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-s390x@nongnu.org, Paolo Bonzini , Igor Mammedov , Richard Henderson , 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 --- 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 a05150bfd0..808e7136a0 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 @@ -915,7 +915,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 @@ -1145,7 +1145,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 4 16:51:48 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=1605219077; cv=none; d=zohomail.com; s=zohoarc; b=g6u2JBFMHHTAvM8koETn5FENZq7dbiZKv/LswK1vcBIrlfYgpei5spRu6YTJTsxoKaZnA+hLzXi6m5xtPfQ6UTp0XC14BVk5SMiFIHxPypzkiDT74L64NZrtvyBddKUgv/B+8fTl6LmSPbRobBZ5AwSIEDRpX1eKsYE7fTjHyIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219077; 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=k/SQLTuPjEMWYqy7TZdUNWsNX6yogYSzymEF07xNEY4=; b=AAx/4iQAPdbD6RPL+emoclE0zqebtA5/6cfPWCP0GctRCNQmdkQe4CTGRSfwB4tu98Eg9A/nUSpqmQyJe1KLICv0uIKOMdGFKY9vE9fYAMcTnw+SKEiv2JFB9bz6kX9Uv6LLs2p1WCvUjBLU9Sac/5UBOt6JDLGsTeA07rDS0Vk= 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 1605219077515157.792554526603; Thu, 12 Nov 2020 14:11:17 -0800 (PST) Received: from localhost ([::1]:40610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKoG-00037A-AL for importer@patchew.org; Thu, 12 Nov 2020 17:11:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPO-0006FB-5Y for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPL-0003R2-SH for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:33 -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-576-G6dFlsTJPDyOIzWSs8zhqg-1; Thu, 12 Nov 2020 16:45:29 -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 3A8FC803F41; Thu, 12 Nov 2020 21:45:28 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E67991002382; Thu, 12 Nov 2020 21:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217531; 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=k/SQLTuPjEMWYqy7TZdUNWsNX6yogYSzymEF07xNEY4=; b=i7DLYtVJh/W+8wS+hNGZBYw2WqaoEvNqfYytmHHMHorxMDRAxiRhTlXEEkI7Wzc12JlH5W 0OTCmxz8E4yejq8IaVd3FrAYzwrGer28ayaP8Y655yinoMHkxcZ2MujTjIjMG/CRqUfDnr 6tM3BCiNJQWU/OZ2ZNP17H1u1P4OcM0= X-MC-Unique: G6dFlsTJPDyOIzWSs8zhqg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 19/53] qdev: Avoid using prop->name unnecessarily Date: Thu, 12 Nov 2020 16:43:16 -0500 Message-Id: <20201112214350.872250-20-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 e91c21dd4a..dba2f6b04a 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 808e7136a0..202abd0e4b 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); } @@ -965,7 +965,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, @@ -981,7 +981,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; } @@ -1050,7 +1050,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, @@ -1066,7 +1066,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 4 16:51:48 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=1605217994; cv=none; d=zohomail.com; s=zohoarc; b=itxZjkAgwLPOa2VeTNRMrn4UXipk7JTPgu606dn92sCjWZLEsetHbLWjBMlSfsrsVx2pv0eE6ARO8tnPDVamq7wz5X6I/y7pKFHZ+kxNNVBUvJlO2E/LgmXstetVuWLMHcGDLczzbPu1n8VWcLQYFul1NpDvlE6wmVnpTnLFSTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217994; 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=f2MXMJfxv7r1iOf7ueLah0brmKmv5qhMWPGV5dRdOinY98tYw0sOcLzbbtI4uR4nlKaaq4w6UAfeQJy8ssknQs3yaHjxLoyqPun9TLsUQ50EiXF7x8iWIiIsWeAdASKfM3N8oeVQNoykskrRlRS15pTUz77we4IGZRYIlO3lSFg= 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 1605217994421597.5698829624343; Thu, 12 Nov 2020 13:53:14 -0800 (PST) Received: from localhost ([::1]:47438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKWn-000746-At for importer@patchew.org; Thu, 12 Nov 2020 16:53:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPV-0006R0-03 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPT-0003WC-5c for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:40 -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-415-ZFGYBya4PN-JJEepJArZXQ-1; Thu, 12 Nov 2020 16:45:34 -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 B9EA2803625; Thu, 12 Nov 2020 21:45:33 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C8625D9CA; Thu, 12 Nov 2020 21:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217538; 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=GbhYi1vUxTPFk/j33Gzh93QS2tT5IBT3vAxjR9RGc7WkOGIq7gdduyyA+avPjLOl0tMVoM 9R2MV5Wx+/Vrs7MYzPjJAZ9Yg33K6RPAV9pnNGJN/kulGenNArkCZXXUEDSVDM6DYtw9Kn GiWZX9UgJMDsqUlv7h8XTGuSPSS3Naw= X-MC-Unique: ZFGYBya4PN-JJEepJArZXQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 20/53] qdev: Add name parameter to qdev_class_add_property() Date: Thu, 12 Nov 2020 16:43:17 -0500 Message-Id: <20201112214350.872250-21-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605218138; cv=none; d=zohomail.com; s=zohoarc; b=jyKYzOCv5mZUJ7q2GEdYCj8a7mku6X7lLJDsWRyY/sRswhSFDOgrHEBB53D78qD/NmbcUqWh8Nt7iVxG4sFnXMMfaSVp+ReujKJuEaOOqzI6xRpl1L/lctfi2jF/qUPDqnHrsn4FwalBhUStmKmKazQemdta724m/HS8T/nkW+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218138; 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=VEENLeBbtRBQrTYWvbDJliBVq7fQp7QZqu6sY7/ZA/ML07E2h0nLTy7aaStqCc6JUfJ/jfTk54rexf9SPZ0IDRhXu5f92rJsyUFCtR7bvPxS4GOJmHH1uR2dUcx/mF7Yq6TC0hQOZx7gjXpj7gzqMVJYQUvN80MLRMlHYDifp40= 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 1605218138634816.9388267637505; Thu, 12 Nov 2020 13:55:38 -0800 (PST) Received: from localhost ([::1]:55748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKZ7-00023p-Gt for importer@patchew.org; Thu, 12 Nov 2020 16:55:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPW-0006VL-RZ for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57030) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPU-0003WS-Q0 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:42 -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-588-TeJ1FDhdORy49sKMBVoVWQ-1; Thu, 12 Nov 2020 16:45:38 -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 847A1107B467; Thu, 12 Nov 2020 21:45:37 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 656915C1C2; Thu, 12 Nov 2020 21:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217540; 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=ebXe0M5tjCGn2RSBX7RA+kq0iSEACI7UQVCheMp2TrVNMF9iC1rw4qzJd3PivZpGPYYC0K OP99RiXqhMJuZU9om7X5dqlBW+dQiOfPkHffilWfxrEFqjbKhDfSJJsJ7iyjMwHBPCae9j 7mC1+TSQaU9YRIfC7bDFT9IT9LBkfyo= X-MC-Unique: TeJ1FDhdORy49sKMBVoVWQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 21/53] qdev: Add name argument to PropertyInfo.create method Date: Thu, 12 Nov 2020 16:43:18 -0500 Message-Id: <20201112214350.872250-22-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 4 16:51:48 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=1605218358; cv=none; d=zohomail.com; s=zohoarc; b=nz6w6k1qrHPfP/Q5wuRV12yo7fYz1xFdY2US8WZnckIExnKyNgl9QGeWw707Iw8VTeeOtEaSjbCrsidfZ17+Vv6ei2W1F9kW5rimBg20jo5sX8mZJXOt8B4b//gvNmMz7fLbZLrizovUvyEUG7AliYlywp5cffBtxwBqnNTXoTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218358; 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=QiBAPS9AVSHYfisTEYBSnRxM6amCZtA0O5OnM++j64BgyKEXFwjBuAp6AyhFf2dkT1l+ZrALjpyXwO4xIfnElaxQO0BeWjBnWcJ1bCMxXiufpPlGKbM+zEyZqsbaifdx1v8exzRtzSt5l4kwH7YfyHD9HwooDk1UYOobTp91h4I= 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 1605218358241686.5564660544248; Thu, 12 Nov 2020 13:59:18 -0800 (PST) Received: from localhost ([::1]:37196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKcf-0006EI-1u for importer@patchew.org; Thu, 12 Nov 2020 16:59:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPZ-0006ck-DF for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31162) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPX-0003Wj-Jl for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:45:45 -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-22-_jPE_hIUP9S2dpINJHiOcg-1; Thu, 12 Nov 2020 16:45:39 -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 912F6803F4A; Thu, 12 Nov 2020 21:45:38 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F19E5C1C2; Thu, 12 Nov 2020 21:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217542; 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=Ut5etrSQrAEDS+bREPoY9g5CyAERY4mSKPslbKk4ob5E2ku1TqCQO0kZsuaLUzdBPiqtSs mEQW2F8LDW61JOII+PzFN6IflZ0wd4MqQ8mhJMW5PkblGrZyqUd5dbD066iQ/LUtTjo1EU YTupqEcoUsWEupW63eCgfD13/rrRTiE= X-MC-Unique: _jPE_hIUP9S2dpINJHiOcg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 22/53] qdev: Wrap getters and setters in separate helpers Date: Thu, 12 Nov 2020 16:43:19 -0500 Message-Id: <20201112214350.872250-23-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 4 16:51:48 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=1605217575; cv=none; d=zohomail.com; s=zohoarc; b=KY0GptEk9IM7gUtY9+SkJ9PIWi9BefRo5wXR8ZICYkfTP3LsyYsNS9aHmyS4Fx+Np1hoGm1pn7eTCB2ofilT/gZcdhqSRDwJQVk2rQQwtDOtQpjgX9cGTA6Dm6zjvAFoyowPRQsqGm1WkcGFEaSgzpSQjDxgsL5KckJGhL56FG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217575; 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=96y8FlxASBqueB7vdblz6B3QBe6EDXkcFeOt+FcgiDo=; b=muUTQCkVJpXb6QhS7+TqwKtyzQDvfmXfhC+1UFQQtEBe2of36xNnrzt8vGl5CGCZ2qfuT8niBzJvDlxI5eM/aGTtbLmvXYOAXyRP8wiSzZai2SWTee2F4ciaqTQRpMKsXMF/X4eLWlxh75FslxYNgZusRpY/VJwg7mHfav0bTMo= 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 1605217575236939.1745331067511; Thu, 12 Nov 2020 13:46:15 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.26079.54215 (Exim 4.92) (envelope-from ) id 1kdKPm-0000I9-Gg; Thu, 12 Nov 2020 21:45:58 +0000 Received: by outflank-mailman (output) from mailman id 26079.54215; Thu, 12 Nov 2020 21:45:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kdKPm-0000I2-Co; Thu, 12 Nov 2020 21:45:58 +0000 Received: by outflank-mailman (input) for mailman id 26079; Thu, 12 Nov 2020 21:45:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kdKPl-0000Hx-A4 for xen-devel@lists.xenproject.org; Thu, 12 Nov 2020 21:45:57 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id fbea7561-b99f-40b3-b6b5-31883ca77d7a; Thu, 12 Nov 2020 21:45:55 +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-287-nulqUWz6NqS_XwYyoOuy-A-1; Thu, 12 Nov 2020 16:45:52 -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 C4D5557204; Thu, 12 Nov 2020 21:45:49 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBD8C19C66; Thu, 12 Nov 2020 21:45:39 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kdKPl-0000Hx-A4 for xen-devel@lists.xenproject.org; Thu, 12 Nov 2020 21:45:57 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id fbea7561-b99f-40b3-b6b5-31883ca77d7a; Thu, 12 Nov 2020 21:45:55 +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-287-nulqUWz6NqS_XwYyoOuy-A-1; Thu, 12 Nov 2020 16:45:52 -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 C4D5557204; Thu, 12 Nov 2020 21:45:49 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBD8C19C66; Thu, 12 Nov 2020 21:45:39 +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: fbea7561-b99f-40b3-b6b5-31883ca77d7a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217555; 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=96y8FlxASBqueB7vdblz6B3QBe6EDXkcFeOt+FcgiDo=; b=J00yptfY8u64eME2rC60GZWk/4mIuC9zmbuNYOCJWlgU4kWD3nPIi17ATG4iPxMG6hf93n fRg6ELvYmwdN75d4w/ZAbLpcoyhMwVURQLd7zcl+NTt8oFm/GW7+L907fkJQtNnG7T4rJe h6iyiohiX7xwlKAxdhUr3adrwqLj5fk= X-MC-Unique: nulqUWz6NqS_XwYyoOuy-A-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Cc: Igor Mammedov , Markus Armbruster , Kevin Wolf , "Daniel P. Berrange" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Eric Blake , John Snow , Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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 v3 23/53] qdev: Move dev->realized check to qdev_property_set() Date: Thu, 12 Nov 2020 16:43:20 -0500 Message-Id: <20201112214350.872250-24-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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) 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 --- 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 dba2f6b04a..0b07cf55ea 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 202abd0e4b..0d3e57bba0 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; } @@ -971,16 +919,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; @@ -1056,16 +998,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; @@ -1128,16 +1064,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 ab27b6e848..54fac3851d 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1331,16 +1331,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 f5cff4103b..3375fffb38 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 4 16:51:48 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=1605219387; cv=none; d=zohomail.com; s=zohoarc; b=R+c4d1fG4VPN37pLfRAYgnmJ7xOClRpB16L1mKg2AZLgYvyFVyGy8BiBbR/oSgkvmMXHtMHstH0hQD2RKu0OTCbeC3fPFmS0+R6Le6h53/MsiMg1bI84liTJ7N3tFr+2a0L2VMwVFeIlJ12v2AjuYVVJLtbIBolFXpnXfA4I/8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219387; 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=DZ+icPxTl5/B0UpRTyhMj8B+WUYOvjPCdJIzi+ucc0jwiKK5vev4SZijwPWQRmyVOKRg/6gfZzTihfq/Aq/qlHtuUN2bgjF7j51vw6jw7NPE7eaFKiMCgVrUTqDlp3PYIYCDObs3oSAoBK0dvbwbvTRwB0GnccX+dxzbhk3f7j4= 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 1605219387527263.1277166289019; Thu, 12 Nov 2020 14:16:27 -0800 (PST) Received: from localhost ([::1]:53920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKtF-0000Ou-Pe for importer@patchew.org; Thu, 12 Nov 2020 17:16:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPp-0006mJ-36 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20143) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPl-0003Yz-As for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46: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-516-QBlVYwKlPBe8eH3tkyPE5Q-1; Thu, 12 Nov 2020 16:45: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 085AD1074643; Thu, 12 Nov 2020 21:45:54 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C218619B5; Thu, 12 Nov 2020 21:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217556; 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=IWgxCohmhHlYkG7bMt419UvCCS+8v/zsCeg8uP6NqXV1ZaZwmI5bbEXrHE03PJGX91zhk5 lRSh2LH8WQH08vjP88c4+IjTho/Wrd6MjE+KKLwFAs1BitGP6nuj6CvYXrGDMFXh390WqK ehEBnO6jUXiaVylkkz6iMCieB018V4w= X-MC-Unique: QBlVYwKlPBe8eH3tkyPE5Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 24/53] qdev: Make PropertyInfo.create return ObjectProperty* Date: Thu, 12 Nov 2020 16:43:21 -0500 Message-Id: <20201112214350.872250-25-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 4 16:51:48 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=1605219540; cv=none; d=zohomail.com; s=zohoarc; b=MLrcwiM4bk/AQJ0kMHgxZFsFPtXdV+BqAe/7qucp8VggAlIyK34ec3/X9JAjOSbdqOwjl/eoZNseRsdm8CEBvmTRB4RhslrcviJDnpJMzcHxCHAyxdottR5XJuX+FJpIBKe1ek3TC48IcQNkmo/oLIIVCCFCKc2FAY+qUXlrAsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219540; 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=X9vZPPrvjQsXXIKGrL5MNJR+bSdJvriH0+FcE/UA4KTVhd+CLivnHGEW56pEpzTgbh+sXtrrfGKBXxx/vZacr6REX1pjfDGjbuoRIX53mgHj4CCKb8o4CIet/GicMZ4GzY5/pvL+HrFIN3We/8W7/8R3phnMoogn5Ggvuq4fjj8= 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 1605219540276848.033365707575; Thu, 12 Nov 2020 14:19:00 -0800 (PST) Received: from localhost ([::1]:60310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKvi-0003AI-Ve for importer@patchew.org; Thu, 12 Nov 2020 17:18:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPw-0006rh-2V for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPu-0003Zg-4i for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46: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-284-OGCmMlcQPWi-EX8hKhZH2Q-1; Thu, 12 Nov 2020 16:45: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 760D78049D7; Thu, 12 Nov 2020 21:45:58 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C3125C26A; Thu, 12 Nov 2020 21:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217561; 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=VDk5hP2zR2SsHa+jD4C6WKJFjpPlBumXPRs458c91Nh9S1sEZFKX+kf092/wGwDFx5rE4V xdWSTWb1sjVvS43wH3cH7iT9PdywFKJdQOxQ3QHY9wn6Q9uBFbNaYgXn9tMzLYfLwehvUL NsA90HVhUSppMC5wi9o0NRzT6t1cthY= X-MC-Unique: OGCmMlcQPWi-EX8hKhZH2Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 25/53] qdev: Make qdev_class_add_property() more flexible Date: Thu, 12 Nov 2020 16:43:22 -0500 Message-Id: <20201112214350.872250-26-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 4 16:51:48 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=1605218725; cv=none; d=zohomail.com; s=zohoarc; b=EiRXUkV5I9KLKSYsa6/n1oFJYouQjReck0YUo6TrU0UnH0/oFyKEmji2SixcvL2KPTzwWs4hMBs3KkwihMrt2Zzbg8zaTXqptgeIgouZiR6+Zd8aSxxeOan0iDzVPLPiE3AVT4lBTcnQA0UiW9yLMUIp+wlCy/lIvGmrWOzxV4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218725; 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=EhvY9gZLQ9oGCtD99CdwUn7/UuXJijPC7YE4fGEIagOyDbH77DUdkvZAflK25r7zcoh8RNYb9WNElT/roiYwbX3f9JoloDTjR19fvtHHvCfpXpTIR/Ao3f+RImczJ9ydoV6S6A/bzupbZDguMMbXIheUAEpSZGIqVsSh3JlzVQI= 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 1605218725204957.1864483828027; Thu, 12 Nov 2020 14:05:25 -0800 (PST) Received: from localhost ([::1]:53846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKia-00053T-1p for importer@patchew.org; Thu, 12 Nov 2020 17:05:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPw-0006ss-Oe for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPu-0003az-5h for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46: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-260-QeIJH6lMNC-jH--FLEVttg-1; Thu, 12 Nov 2020 16:46:00 -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 75CF5190A3E4; Thu, 12 Nov 2020 21:45:59 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36F0F5C1C2; Thu, 12 Nov 2020 21:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217564; 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=VQXHx2YGz0hV1HnWOEl9EwVkRKIc9xrPD0hkgV+yu/soEh9zkxfBk4pVCaBdfQFh6WzlQl CDN+0yPBFWyerxxbf1pq8BVGOG/w6Wm6W5zuegR28ukr5QQeVx636RQG5eSJFXbYF3zMJi C/Z8jGaSkhQh/bZzXkkS1obTw/ZeJOU= X-MC-Unique: QeIJH6lMNC-jH--FLEVttg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 26/53] qdev: Separate generic and device-specific property registration Date: Thu, 12 Nov 2020 16:43:23 -0500 Message-Id: <20201112214350.872250-27-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 4 16:51:48 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=1605218618; cv=none; d=zohomail.com; s=zohoarc; b=mxcTsGFv7maGI7NVbL1MU2Yyd02n2VFTb2+Kbc9ci0OJrY7yXL5YO5w5xyYQfD/RmJfu771Kz2lLuwBEH4ORuCMJEl2u0XVJt7RPC7q56BpdMBbMeG/h72uG3pH/p8/50sQ/4D5yfcbOYmn1OwavE9+LriMZPNbhd3WfDRzbxC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218618; 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=LXR7duY2tvL6a/t3iaiFSweT4mtqDHoY6W+RdWpyXN4=; b=a3uh8zD0FHsrG+LyXDBUIxusaN2GmdUj8kNYoXwEevJcysUDadBPtERwzf2sa0ve8S8CZxKlm8wie4nmjVXqrBWj1A7L3bNyxsh8IBvmSMOttw+MobOi6sXnZEEGrrgx3Q56Ouv5qjaOK82cYpaAd8L4EiTiZ04lD6E68z7mPjo= 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 1605218618211552.9922326764002; Thu, 12 Nov 2020 14:03:38 -0800 (PST) Received: from localhost ([::1]:49454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKgq-0003Cr-Ig for importer@patchew.org; Thu, 12 Nov 2020 17:03:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPz-0006wl-1X for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPu-0003b5-TX for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:10 -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-472-JnHEIIEsNUezlM-4WMO4ew-1; Thu, 12 Nov 2020 16:46:04 -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 7CE7A1018F73; Thu, 12 Nov 2020 21:46:03 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D3DB19C59; Thu, 12 Nov 2020 21:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217566; 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=LXR7duY2tvL6a/t3iaiFSweT4mtqDHoY6W+RdWpyXN4=; b=GKNHyojMe2c16wASWi6UvfF0w6monb3zj+wN6Tvwm3E8W6NVNAZyKd6ADXHnmCn0dDvGZA d1RiHvMgmj40vvzTYYs3uiv2WvCZxlAyJOPIZhEKTHKSxOkci8mQvlYu9fehkelqIoOqW8 4BwUrQM7+K0KAabvaez7NVg/7a3rwUE= X-MC-Unique: JnHEIIEsNUezlM-4WMO4ew-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 27/53] qdev: Rename qdev_propinfo_* to field_prop_* Date: Thu, 12 Nov 2020 16:43:24 -0500 Message-Id: <20201112214350.872250-28-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 0d3e57bba0..96a0bc5109 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 --- */ @@ -881,9 +881,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 -- */ @@ -953,7 +953,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 -- */ @@ -1041,7 +1041,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 4 16:51:48 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=1605218425; cv=none; d=zohomail.com; s=zohoarc; b=leEZwcSDeFVJY4Bo/1dGZkKR/SZMyt5SMe2VD+WD3ONfEsKHMr9tq4WLcVyeg046EXhlEogMHqWPznn4LJY/jAxr5UTiMCKasbGnfhScj4/GdKoCXjhtAogAyCohiI6s3qtPcop/f3OmVmef4ZzWHbR1rkAOoSDPJgfHqAf60iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218425; 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=IdlqyPfqAles/T9xw/I9NuyjWfrvv4Cj5LG5Ssrh8zI=; b=PZeNXT50vqYn73mvGaFMB3n1httb5LFRImCGvup8zavJuOLkpX8obFC+W7WfTe/jp9l5YDAMXlWAcaFhS9DndEeEcZIC3bo5GlgeZEO8DfZgeHCrjK0a+dl/LXO2k8PB4+Izp14fvn6oyKls9s56mlQdSMnLGxCVkMKmR32E5Qw= 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 1605218425687565.7504003406169; Thu, 12 Nov 2020 14:00:25 -0800 (PST) Received: from localhost ([::1]:41448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKdk-00083H-Gh for importer@patchew.org; Thu, 12 Nov 2020 17:00:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKPx-0006un-Nl for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPv-0003bc-Sy for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46: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-172-o5ZCUdawOJ-jHx7S3y3WVw-1; Thu, 12 Nov 2020 16:46:05 -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 9780F80364D; Thu, 12 Nov 2020 21:46:04 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2437A19C59; Thu, 12 Nov 2020 21:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217567; 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=IdlqyPfqAles/T9xw/I9NuyjWfrvv4Cj5LG5Ssrh8zI=; b=e8JSUdaVO/e7KUu7nZIE2tKY1gy3RxqyLkHVn8rg3vOLVOHiMXaiU/ei6CSuxlsAAUQslY mtHUe9oim5lVSRny1VspS+fM9dIZN2oiKtJKdzEaHQAJ/ZF2JKYOUvTRCgzEf7G1/ErnCZ OzfzERDaz2sU2HZpdUcwWEJEdJbMErU= X-MC-Unique: o5ZCUdawOJ-jHx7S3y3WVw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 28/53] qdev: Move qdev_prop_tpm declaration to tpm_prop.h Date: Thu, 12 Nov 2020 16:43:25 -0500 Message-Id: <20201112214350.872250-29-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 85e1ae5718..871af584b7 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 4 16:51:48 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=1605218905; cv=none; d=zohomail.com; s=zohoarc; b=RnqQmhCaEOBeVb9ozHkDLbMlq8205Jod52R6bnhhFNJI3wnd/bFdbsY3sIgGylSDAKO0GO6wdv9q5fzkW/9M+MmPUIhaWsicuqNqm46IDPi6KOJqqQJWZTjOPHWHQGsAt+QMzcVaZI0npbXEnpDeYcITGssZBo5rMLmocjln+RM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218905; 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=59J7H5ykytVLR9f3V0k1PAbPW+Ahu8Da8Sp/Vo8HO/8=; b=hIeVDXLJ4c5M1mAmyQMrb4jpnR7e+e+0NTxTI6IK+UgegD/qkjb4xMWFDhF3lJ0oJoiNtzWLssdRggdDH3/iwsfT2XuqE18I6vTEeUS4V0+pWqpAsvgFlDolPNuioLUrSLycFmfu2GelTEQthvnPrn6OzKtLAVt0MaGbjDJfIdQ= 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 1605218905396636.5534052292262; Thu, 12 Nov 2020 14:08:25 -0800 (PST) Received: from localhost ([::1]:33700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKlU-00009n-48 for importer@patchew.org; Thu, 12 Nov 2020 17:08:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQ3-00075o-7C for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKPz-0003c9-Ha for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:14 -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-459-rZxuRycYMT-Dppjrkjezvw-1; Thu, 12 Nov 2020 16:46:08 -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 0FF4F190A3E3; Thu, 12 Nov 2020 21:46:06 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D23E19C59; Thu, 12 Nov 2020 21:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217570; 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=59J7H5ykytVLR9f3V0k1PAbPW+Ahu8Da8Sp/Vo8HO/8=; b=UG7cxVIwaUwKF1F9ZYNdEqFOTprlXapIqFi6yNAfYdQfBC1AsCAn2Qjft/8KejuMu+yijz g4FCeeD0EP2goigSJqIJNQDRnatJ1YT4p3IOdxOLbgBS0QBa2LyrqNfe1mubs9ZevhJ3C4 dk7g1KXS5k/ShVqL84C3NeClS6bpryw= X-MC-Unique: rZxuRycYMT-Dppjrkjezvw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 29/53] qdev: Rename qdev_prop_* to prop_info_* Date: Thu, 12 Nov 2020 16:43:26 -0500 Message-Id: <20201112214350.872250-30-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-arm@nongnu.org, Paolo Bonzini , Igor Mammedov , 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 94e17a9dea..823160d9a8 100644 --- a/hw/intc/rx_icu.c +++ b/hw/intc/rx_icu.c @@ -365,9 +365,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 b6f1ae3c8f..7928939ae2 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 07492e9f9a..cef92879b0 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1108,7 +1108,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 3375fffb38..ec59a13eb8 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 4 16:51:48 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=1605217604; cv=none; d=zohomail.com; s=zohoarc; b=lm0NNrjMy7nYCl46BCp04DOUbg9BhU1wxhzfbdjF2xNxtiuNhvX9nUsSZf3lGuUvfqplBrCIKHpfNXjOST/sfJtKZMhMsB9oQ/ZLoACmS5bTiNz5AJbKfEHaeWpAxnDhxhZxmTLpG1f0Omp3iywRnHXo+cq5YrxK/+e2CSQtsOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217604; 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=GV8b5aWpq0pxpt4OGLqF3eBIk8WCOaMqmTCMXLaIIeo=; b=De2tUuca3tnh3NK+kggCbFI4rxl3BonBki29diZGT7pkr9IKzW83dt783FH+Xzrmk/d1aIc5Kz4rWW4uw87eYNhu+gtQgvCQt17sM7FD8Gd/w7Y1Ata7sRzNp4gC1gXsgA1+9PshxPBXFbjzANrRTkZPqSnxjQty60JD/qgO9+0= 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 1605217604370978.4402721777045; Thu, 12 Nov 2020 13:46:44 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.26083.54227 (Exim 4.92) (envelope-from ) id 1kdKQC-0000OW-PP; Thu, 12 Nov 2020 21:46:24 +0000 Received: by outflank-mailman (output) from mailman id 26083.54227; Thu, 12 Nov 2020 21:46:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kdKQC-0000OO-ML; Thu, 12 Nov 2020 21:46:24 +0000 Received: by outflank-mailman (input) for mailman id 26083; Thu, 12 Nov 2020 21:46:24 +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 1kdKQB-0000OF-UC for xen-devel@lists.xenproject.org; Thu, 12 Nov 2020 21:46:23 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 12b0889b-7f1e-40a1-8f53-d7d983f2cbb3; Thu, 12 Nov 2020 21:46:21 +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-29-2nHHWv-2PvinfqL9fdW78A-1; Thu, 12 Nov 2020 16:46:19 -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 29C821074643; Thu, 12 Nov 2020 21:46:17 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BC1E1002388; Thu, 12 Nov 2020 21:46:06 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kdKQB-0000OF-UC for xen-devel@lists.xenproject.org; Thu, 12 Nov 2020 21:46:23 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 12b0889b-7f1e-40a1-8f53-d7d983f2cbb3; Thu, 12 Nov 2020 21:46:21 +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-29-2nHHWv-2PvinfqL9fdW78A-1; Thu, 12 Nov 2020 16:46:19 -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 29C821074643; Thu, 12 Nov 2020 21:46:17 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BC1E1002388; Thu, 12 Nov 2020 21:46: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: 12b0889b-7f1e-40a1-8f53-d7d983f2cbb3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217581; 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=GV8b5aWpq0pxpt4OGLqF3eBIk8WCOaMqmTCMXLaIIeo=; b=K8rt+JM5wGETur3HZuVtSb4euEqmO+cwaKRWG+tXQ7udimv/lYm7t3Gp3WeLjFlLYiIMnu M+ZPhpwMDCI5qYFLkiQtfqstWNWEgmccM31ScoC9WJE2yV1HmmqYed9+Pp9SMS3PTbo1ho SKqyZyxv8REt3n55w9hb5vq6JzELlnY= X-MC-Unique: 2nHHWv-2PvinfqL9fdW78A-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Cc: Igor Mammedov , Markus Armbruster , Kevin Wolf , "Daniel P. Berrange" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Eric Blake , John Snow , Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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 v3 30/53] qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr() Date: Thu, 12 Nov 2020 16:43:27 -0500 Message-Id: <20201112214350.872250-31-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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 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 --- 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 0b07cf55ea..bb1ab34a75 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 96a0bc5109..8781b856d3 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; const char *e; unsigned long val; @@ -892,7 +892,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) { @@ -920,7 +920,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, @@ -962,7 +962,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) { @@ -999,7 +999,7 @@ static void set_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 if (!visit_type_enum(v, name, &width, prop->info->enum_table, @@ -1050,7 +1050,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 @@ -1065,7 +1065,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 54fac3851d..99b18d56ba 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1323,7 +1323,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); } @@ -1333,7 +1333,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 4 16:51:48 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=1605218789; cv=none; d=zohomail.com; s=zohoarc; b=LXiCAomRu8kNQu2/mkFnCjJfJ7MoQ6J26sFjbYL8F+mVT+OLlchZHL+zERplssZu1EPfodHChDz926WJAgzy7/CZbEghjy6/C1NhHbOPiIjvOnmns4+AjSUwgJ1cBVeqe4NBMj2IhvcbMsID8YEROvmw9GpNWYatHnxieboSTE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218789; 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=PQy1TDM4I6+TDehOC0Cz8zn4MLOWNKGtmqVLWN2UeLJMq5//0kLUHnxFpuxVNjFv3xP9rqkgE1aP1ZN2s1mllbPklhVoRKxVTwuuq3zn+7oUChJogrWY/gaHilT04yLpr+0r7G4HWsfOLmF14z/0hP6NvA6QyffVljOr9SMCCAo= 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 1605218789520580.2450595826357; Thu, 12 Nov 2020 14:06:29 -0800 (PST) Received: from localhost ([::1]:57712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKjc-0006oW-Ci for importer@patchew.org; Thu, 12 Nov 2020 17:06:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQE-0007Kd-KA for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQC-0003d9-PY for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46: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-448-dAkDbgt9PIazjzmsM9gTzg-1; Thu, 12 Nov 2020 16:46:22 -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 66A915F9D1; Thu, 12 Nov 2020 21:46:21 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE15060C13; Thu, 12 Nov 2020 21:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217584; 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=fRAnxD3Ub6pzjv29yKVh2dosIb7WTTT8zVqZP20sEqS3gvWu5RdAp+t0SLorOaxX5lZSOE ZszxAYOOrnYVy5dzFrzciU3MadsRu7AAAnUJp69JkImGeukzwkpZEpD+Vg0SAkwyyojotC 2L417rgqRtTXzhSKguvXBysUb6pam2Y= X-MC-Unique: dAkDbgt9PIazjzmsM9gTzg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 31/53] qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen() Date: Thu, 12 Nov 2020 16:43:28 -0500 Message-Id: <20201112214350.872250-32-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 --- 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 4 16:51:48 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=1605218994; cv=none; d=zohomail.com; s=zohoarc; b=egRJgnInRJSvYK/2kKjdUMBGikvx4aSnMdJCcBlqFcoYGyPYmG/5o0zQwyO3+DUxvzM5Td/DHdjeKbhTMRi6cbTmf32mlVLbLz/HIdSPZWEFjBO/C22zWs0mU8bZHdUXNwfOgw8v2cVqqHCFDCdUkT55cGohrbt6iLfxWorko5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218994; 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=G+eKdWAccfQ9hmHKi5IYSZygpRJ4JmMcTAO3LQ7Qxq6hw5RKfPcQIOhNU8CFqoiniFVCTBqGewGdvm+z3TcUL56yCDbO4PiZE3VHmrShxCKZOLyY7JUafHz3Gt1qiuvejmOAvb+VQ3YEaF+jRsejqzpfphT5Bm73WczzGlWoMKE= 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 1605218994851199.66792359603858; Thu, 12 Nov 2020 14:09:54 -0800 (PST) Received: from localhost ([::1]:37646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKmv-0001se-HY for importer@patchew.org; Thu, 12 Nov 2020 17:09:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQL-0007ZT-NL for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQJ-0003ds-Rl for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:33 -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-251-1iwRfYxGPNGZwOrYNYlQbg-1; Thu, 12 Nov 2020 16:46:27 -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 43445190A3E2; Thu, 12 Nov 2020 21:46:26 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9E415D9CA; Thu, 12 Nov 2020 21:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217591; 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=UaIVcoQTq2KyGfxxupt7Zq0drITOqmkqHADiEmj0yKWR9pBE6+qDs8p4EJtymXuftvohcU GMRlFLet1sTOZJQJ3ue6cgYtjmEH0OSLNiVMfe2TQxb/igsS1LUaVYqjLsFBLP5djwwQR7 FjeTOkOMY7/qKr9qfI6QDFXhzYVltRw= X-MC-Unique: 1iwRfYxGPNGZwOrYNYlQbg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 32/53] tests: Add unit test for qdev array properties Date: Thu, 12 Nov 2020 16:43:29 -0500 Message-Id: <20201112214350.872250-33-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 From nobody Sat May 4 16:51:48 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=1605219139; cv=none; d=zohomail.com; s=zohoarc; b=dSCcx+mNORNvFC1rSzfVyttQFP4wE8eZkXeZ2jLZm9mPEE6kQHIGDXY/bDp1o3mIUCxbatHRK790oTbEv82u3hFdnBFIN00Z4zjMXQdaleqNyodSFoJbkGGSJgcqedQUuIiMxOgqJmDLZTeekYYMN9Lu5Tyf+Dq2KkgaAoroi0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219139; 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=H98XLpUksdIgX7C5G11L5PaMJaT7m6T8YKA2VVNxxBo=; b=U+EGlo/6NVJ0XOV0XOaNpze+U//Tf3FngBht/BrI30sg5PybL+by1+Cjc7Y9tA3YxiEjkpMReFOVRbCEqJCL3wAsL30LKmMDJbe4B/NiUlW7mTeHn2XNyK9X6zVBYOa6ekzUP6i6iYUR0RPeQEdd59+zX3iDpNah451BPff5EJY= 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 1605219139072241.1910093028946; Thu, 12 Nov 2020 14:12:19 -0800 (PST) Received: from localhost ([::1]:44378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKpF-0004mq-TO for importer@patchew.org; Thu, 12 Nov 2020 17:12:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQN-0007db-IV for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQL-0003e0-NT for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:35 -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-195-lzDkyDBhNiW053H1Hm_hCg-1; Thu, 12 Nov 2020 16:46:31 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 118791018F6F; Thu, 12 Nov 2020 21:46:30 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0AA26EF62; Thu, 12 Nov 2020 21:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217592; 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=H98XLpUksdIgX7C5G11L5PaMJaT7m6T8YKA2VVNxxBo=; b=gQoxAxE30fOp0BzSb1YmklApo0Zsve+dZz+GSKKA3qk/K88ppnkIKPmJvkiKPdu3A4gvIF yk72cUwFWCWVtTw9ygRmuI+E93p1DMtxQ2kHISeJ6Rcvno/AoQHg+8735MyWXboBKUmzor aDeU37p+DMQKFO2LmQSi5SkPoT14y4A= X-MC-Unique: lzDkyDBhNiW053H1Hm_hCg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 33/53] qom: Add allow_set callback to ObjectProperty Date: Thu, 12 Nov 2020 16:43:30 -0500 Message-Id: <20201112214350.872250-34-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 ObjectProperty.allow_set callback, that can be set by QOM property registration functions. Note that this doesn't replace the check callback at object*_property_add_link() (yet), because currently the link property check callback needs to get the property value as argument (despite this not being necessary in most cases). Signed-off-by: Eduardo Habkost --- Changes v1 -> v2: * Redone patch on top of changes in previous patches in the series * Provide prop_allow_set_always() and prop_allow_set_never() helpers --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/qom/object.h | 38 ++++++++++++++++++++++++++++++++++++++ qom/object.c | 16 ++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index d378f13a11..2ab124b8f0 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -86,6 +86,43 @@ typedef void (ObjectPropertyRelease)(Object *obj, */ typedef void (ObjectPropertyInit)(Object *obj, ObjectProperty *prop); =20 +/** + * typedef ObjectPropertyAllowSet: + * @obj: the object that owns the property + * @prop: the property being set + * @errp: pointer to error information + * + * Called when a property is being set. + * + * If return value is false, it will prevent the property from + * being changed. Error information should be filled in @errp + * if return vlaue is false. + */ +typedef bool (ObjectPropertyAllowSet)(Object *obj, ObjectProperty *prop, + Error **errp); + +/** + * prop_allow_set_always: + * @obj: the object that owns the property + * @prop: the property being set + * @errp: pointer to error information + * + * ObjectPropertyAllowSet implementation that always allow the + * property to be set. + */ +bool prop_allow_set_always(Object *obj, ObjectProperty *prop, Error **errp= ); + +/** + * prop_allow_set_never: + * @obj: the object that owns the property + * @prop: the property being set + * @errp: pointer to error information + * + * ObjectPropertyAllowSet implementation that never allows the + * property to be set. + */ +bool prop_allow_set_never(Object *obj, ObjectProperty *prop, Error **errp); + struct ObjectProperty { char *name; @@ -96,6 +133,7 @@ struct ObjectProperty ObjectPropertyResolve *resolve; ObjectPropertyRelease *release; ObjectPropertyInit *init; + ObjectPropertyAllowSet *allow_set; void *opaque; QObject *defval; }; diff --git a/qom/object.c b/qom/object.c index 1065355233..7c11bcd3b1 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1381,6 +1381,18 @@ bool object_property_get(Object *obj, const char *na= me, Visitor *v, return !err; } =20 +bool prop_allow_set_always(Object *obj, ObjectProperty *prop, Error **errp) +{ + return true; +} + +bool prop_allow_set_never(Object *obj, ObjectProperty *prop, Error **errp) +{ + error_setg(errp, "Property '%s.%s' can't be set", + object_get_typename(obj), prop->name); + return false; +} + bool object_property_set(Object *obj, const char *name, Visitor *v, Error **errp) { @@ -1395,6 +1407,10 @@ bool object_property_set(Object *obj, const char *na= me, Visitor *v, error_setg(errp, QERR_PERMISSION_DENIED); return false; } + if (prop->allow_set && !prop->allow_set(obj, prop, errp)) { + return false; + } + prop->set(obj, v, name, prop->opaque, &err); error_propagate(errp, err); return !err; --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219098; cv=none; d=zohomail.com; s=zohoarc; b=a7hBfTNajUo/J8lVIWGOuLNNpcr4IhDb8bi5HTlvwBEHAH0shFDFA8M9GJ1mIVwkA1zEXuVeeC91gok2iTdlzWt2TK3L7bo7U2yg0ceGW2MQdooqN4s+c5Cm91wkswe86E1Ry7DOwg/bBwsEA33NK5mkIasUM7MxtVCb89ntF+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219098; 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=EEDG9Rp82MKd8keWELsCUMQrOmi76cKVVr3EnZnuOn4=; b=Ydu1tH1plFBHwU7wh+grUy1ccJAYO+/Pealw9iw5Quif13Nl2fnO8mQwqSK4kwdHh8xHA/MSOQCDmFt3uuNz7aAp5cmCbFZj6GroVEbRaP/23PYLJX8U1VXnTG/gGvVYF+0ZdfuzvfYvHmCzSkrWtRAmr/ZFHWlZ4wxaGpmVv5o= 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 1605219098113923.7178531606313; Thu, 12 Nov 2020 14:11:38 -0800 (PST) Received: from localhost ([::1]:42238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKob-0003uC-16 for importer@patchew.org; Thu, 12 Nov 2020 17:11:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQQ-0007k5-RZ for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25401) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQO-0003eO-IZ for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46: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-205-W0ZsSr8DMA6Q4ZLgb-DV8A-1; Thu, 12 Nov 2020 16:46:32 -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 08A568049D5; Thu, 12 Nov 2020 21:46:31 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCA865D9CA; Thu, 12 Nov 2020 21:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217595; 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=EEDG9Rp82MKd8keWELsCUMQrOmi76cKVVr3EnZnuOn4=; b=ewI1bnrkhZjIG0LqfN3NJKkuEXbUoD5WxWIGpr7rVCh67GxVH+B0JACwAhP0iL/9nMJwoT mCsOPzEeAbpPmYr46516k57y0+oXhV8S2ZUJdtS+I61lEY8vWoSIkkyrj7VQPx4y0xUeWe +TgQobmDOm0m0b/MCA50iv5kCN0SzKY= X-MC-Unique: W0ZsSr8DMA6Q4ZLgb-DV8A-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 34/53] qdev: Make qdev_prop_allow_set() a ObjectProperty.allow_set callback Date: Thu, 12 Nov 2020 16:43:31 -0500 Message-Id: <20201112214350.872250-35-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 new allow_set parameter to object*_property_add_field(), and pass qdev_prop_allow_set as argument in the qdev registration code. This removes the last remaining line of code inside the core field property code that's specific to TYPE_DEVICE, and will allow us to make field properties a core QOM feature. The array property also needs to set PropertyInfo.allow_set manually, but this will be cleaned up later (that code will be changed to use object_class_property_add_field() too). Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Moved earlier in the series, before array property cleanup (I did this to allow us to move the code to QOM earlier) * Redone after object_class_add_field_properties() was reintroduced Changes v1 -> v2: * Redone patch on top of changes in previous patches in the series * Forbid allow_set=3D=3DNULL to avoid confusion with link property semantics (where NULL makes the property read only) --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-prop-internal.h | 16 ++++++++--- hw/core/qdev-properties.c | 51 ++++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index 740a5e530b..47bab46810 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -30,34 +30,43 @@ void field_prop_get_size32(Object *obj, Visitor *v, con= st char *name, * @obj: object instance * @name: property name * @prop: property definition + * @allow_set: check function called when property is set * * 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); + Property *prop, + ObjectPropertyAllowSet allow_set); =20 /** * object_class_property_add_field_static: Add a field property to object = class * @oc: object class * @name: property name * @prop: property definition + * @allow_set: check function called when property is set * * 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. + * + * @allow_set should not be NULL. If the property can always be + * set, `prop_allow_set_always` can be used. If the property can + * never be set, `prop_allow_set_never` can be used. */ ObjectProperty * object_class_property_add_field_static(ObjectClass *oc, const char *name, - Property *prop); + Property *prop, + ObjectPropertyAllowSet allow_set); =20 /** * object_class_add_field_properties: Add field properties from array to a= class * @oc: object class * @props: array of property definitions + * @allow_set: check function called when property is set * * Register an array of field properties to a class, using * object_class_property_add_field_static() for each array element. @@ -65,6 +74,7 @@ object_class_property_add_field_static(ObjectClass *oc, c= onst char *name, * 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); +void object_class_add_field_properties(ObjectClass *oc, Property *props, + ObjectPropertyAllowSet allow_set); =20 #endif diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 9d25b49fc1..638daf1ebf 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -25,13 +25,13 @@ void qdev_prop_set_after_realize(DeviceState *dev, cons= t 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, +static bool qdev_prop_allow_set(Object *obj, ObjectProperty *op, Error **errp) { DeviceState *dev =3D DEVICE(obj); =20 if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); + qdev_prop_set_after_realize(dev, op->name, errp); return false; } return true; @@ -79,10 +79,6 @@ static void field_prop_set(Object *obj, Visitor *v, cons= t char *name, { Property *prop =3D opaque; =20 - if (!qdev_prop_allow_set(obj, name, errp)) { - return; - } - return prop->info->set(obj, v, name, opaque, errp); } =20 @@ -560,6 +556,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, * array itself and dynamically add the corresponding properties. */ Property *prop =3D opaque; + ObjectProperty *op =3D object_property_find_err(obj, name, &error_abor= t); uint32_t *alenptr =3D object_field_prop_ptr(obj, prop); void **arrayptr =3D (void *)obj + prop->arrayoffset; void *eltptr; @@ -592,6 +589,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, for (i =3D 0; i < *alenptr; i++, eltptr +=3D prop->arrayfieldsize) { char *propname =3D g_strdup_printf("%s[%d]", arrayname, i); ArrayElementProperty *arrayprop =3D g_new0(ArrayElementProperty, 1= ); + ObjectProperty *elmop; arrayprop->release =3D prop->arrayinfo->release; arrayprop->propname =3D propname; arrayprop->prop.info =3D prop->arrayinfo; @@ -603,12 +601,13 @@ static void set_prop_arraylen(Object *obj, Visitor *v= , const char *name, */ 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, - field_prop_getter(arrayprop->prop.info), - field_prop_setter(arrayprop->prop.info), - array_element_release, - arrayprop); + elmop =3D object_property_add(obj, propname, + arrayprop->prop.info->name, + field_prop_getter(arrayprop->prop.info= ), + field_prop_setter(arrayprop->prop.info= ), + array_element_release, + arrayprop); + elmop->allow_set =3D op->allow_set; } } =20 @@ -823,9 +822,13 @@ const PropertyInfo prop_info_size =3D { static ObjectProperty *create_link_property(ObjectClass *oc, const char *n= ame, Property *prop) { + /* + * NOTE: object_property_allow_set_link is unconditional, but + * ObjectProperty.allow_set may be set for the property too. + */ return object_class_property_add_link(oc, name, prop->link_type, prop->offset, - qdev_prop_allow_set_link_before_= realize, + object_property_allow_set_link, OBJ_PROP_LINK_STRONG); } =20 @@ -836,10 +839,12 @@ const PropertyInfo prop_info_link =3D { =20 ObjectProperty * object_property_add_field(Object *obj, const char *name, - Property *prop) + Property *prop, + ObjectPropertyAllowSet allow_set) { ObjectProperty *op; =20 + assert(allow_set); assert(!prop->info->create); =20 op =3D object_property_add(obj, name, prop->info->name, @@ -858,15 +863,19 @@ object_property_add_field(Object *obj, const char *na= me, } } =20 + op->allow_set =3D allow_set; return op; } =20 ObjectProperty * object_class_property_add_field_static(ObjectClass *oc, const char *name, - Property *prop) + Property *prop, + ObjectPropertyAllowSet allow_set) { ObjectProperty *op; =20 + assert(allow_set); + if (prop->info->create) { op =3D prop->info->create(oc, name, prop); } else { @@ -884,22 +893,26 @@ object_class_property_add_field_static(ObjectClass *o= c, const char *name, object_class_property_set_description(oc, name, prop->info->description); } + + op->allow_set =3D allow_set; return op; } =20 -void object_class_add_field_properties(ObjectClass *oc, Property *props) +void object_class_add_field_properties(ObjectClass *oc, Property *props, + ObjectPropertyAllowSet allow_set) { Property *prop; =20 for (prop =3D props; prop && prop->name; prop++) { - object_class_property_add_field_static(oc, prop->name, prop); + object_class_property_add_field_static(oc, prop->name, prop, allow= _set); } } =20 =20 void qdev_property_add_static(DeviceState *dev, Property *prop) { - object_property_add_field(OBJECT(dev), prop->name, prop); + object_property_add_field(OBJECT(dev), prop->name, prop, + qdev_prop_allow_set); } =20 /** @@ -958,7 +971,7 @@ void device_class_set_props(DeviceClass *dc, Property *= props) qdev_class_add_legacy_property(dc, prop); } =20 - object_class_add_field_properties(oc, props); + object_class_add_field_properties(oc, props, qdev_prop_allow_set); } =20 void qdev_alias_all_properties(DeviceState *target, Object *source) --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605218511; cv=none; d=zohomail.com; s=zohoarc; b=l2yaiNujcKBIYZfshjQaQ6lio2fu3CYxt4gEp8PTwfktg8QukXngRsEbZgI20JWd82L2Myr756yrUxoyCBOJayXY0eukIyfdqecldRB5gZycBdXVghQgb190gHorhV8R/Q9ov8OTkbcEASS5vehMMyN/mZWtw2Jal47RI1/+9Fg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218511; 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=o06R55ognNI3XqY7AQAxRz9X3TJ+kD+GHt0FxNbg4Qw=; b=OTU9enkIivyy0eYu4ciyLYCPxm+bjxN6U7PZJZqD/5FzJGn8ItTvOcmTZQlzazUDYcND4dPxT5OhZRQhzNtn9aEzfmSn4CXxs1iS1oFTtauj0x7pPBEG1X9x26FXSW/X13cTMNmOlultM3kPBui0rAX3YMyWI14Alm8ydkbVH04= 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 1605218511917331.96339611443113; Thu, 12 Nov 2020 14:01:51 -0800 (PST) Received: from localhost ([::1]:44800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKf8-00018Z-NN for importer@patchew.org; Thu, 12 Nov 2020 17:01:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQW-0007pp-RF for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQU-0003eg-Lx for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:44 -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-212-1Zd28WJXN9K8GafW45fp5A-1; Thu, 12 Nov 2020 16:46: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 873A51074643; Thu, 12 Nov 2020 21:46:35 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 181941002382; Thu, 12 Nov 2020 21:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217601; 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=o06R55ognNI3XqY7AQAxRz9X3TJ+kD+GHt0FxNbg4Qw=; b=OFCJWIh8MnYTYYI6SnQ+zsvQMqtW+buqkDq/tgG41IWdEbPnU1QtHcE0STOETW9+3DjMmG 7sFo8zYksA0voWOTDLzFjRDyJ/F5nnscL+yWuHtMw44f6Gj4pgpG3Kko8WDX29HyTMeVQt sL88sFisGfSrT9YK4kaLKWsjN7bhvnI= X-MC-Unique: 1Zd28WJXN9K8GafW45fp5A-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 35/53] qdev: Rename Property.name to Property.name_template Date: Thu, 12 Nov 2020 16:43:32 -0500 Message-Id: <20201112214350.872250-36-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 Property.name field won't always be set, but it is very easy to miss this detail when we see code using prop->name. Rename the field to "name_template", to indicate it is just a template used when creating new properties in some cases, but is not always set. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Change name from .qdev_prop_name to .name_template. The property won't be qdev-specific, but it won't be always set. This is a patch added in v2 of the series --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 11 +++++++++-- hw/core/qdev-properties.c | 23 ++++++++++++----------- softmmu/qdev-monitor.c | 8 ++++---- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 97bb9494ae..1208e12b9b 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -13,7 +13,14 @@ * is true. */ struct Property { - const char *name; + /** + * @name_template: Property name template + * + * This is a string containing the template to be used when + * creating the property. It can be NULL, and code shouldn't + * assume it will contain the actual property name. + */ + const char *name_template; const PropertyInfo *info; ptrdiff_t offset; uint8_t bitnr; @@ -62,7 +69,7 @@ extern const PropertyInfo prop_info_arraylen; extern const PropertyInfo prop_info_link; =20 #define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ - .name =3D (_name), \ + .name_template =3D (_name), \ .info =3D &(_prop), \ .offset =3D offsetof(_state, _field) \ + type_check(_type, typeof_field(_state, _field)), \ diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 638daf1ebf..03cfad1e74 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -593,7 +593,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, arrayprop->release =3D prop->arrayinfo->release; arrayprop->propname =3D propname; arrayprop->prop.info =3D prop->arrayinfo; - arrayprop->prop.name =3D propname; + arrayprop->prop.name_template =3D propname; /* This ugly piece of pointer arithmetic sets up the offset so * that when the underlying get/set hooks call qdev_get_prop_ptr * they get the right answer despite the array element not actually @@ -625,8 +625,8 @@ static Property *qdev_prop_walk(Property *props, const = char *name) if (!props) { return NULL; } - while (props->name) { - if (strcmp(props->name, name) =3D=3D 0) { + while (props->name_template) { + if (strcmp(props->name_template, name) =3D=3D 0) { return props; } props++; @@ -903,15 +903,16 @@ void object_class_add_field_properties(ObjectClass *o= c, Property *props, { Property *prop; =20 - for (prop =3D props; prop && prop->name; prop++) { - object_class_property_add_field_static(oc, prop->name, prop, allow= _set); + for (prop =3D props; prop && prop->name_template; prop++) { + object_class_property_add_field_static(oc, prop->name_template, pr= op, + allow_set); } } =20 =20 void qdev_property_add_static(DeviceState *dev, Property *prop) { - object_property_add_field(OBJECT(dev), prop->name, prop, + object_property_add_field(OBJECT(dev), prop->name_template, prop, qdev_prop_allow_set); } =20 @@ -955,7 +956,7 @@ static void qdev_class_add_legacy_property(DeviceClass = *dc, Property *prop) return; } =20 - name =3D g_strdup_printf("legacy-%s", prop->name); + name =3D g_strdup_printf("legacy-%s", prop->name_template); object_class_property_add(OBJECT_CLASS(dc), name, "str", prop->info->print ? qdev_get_legacy_property : prop->info->get, NULL, NULL, prop); @@ -967,7 +968,7 @@ void device_class_set_props(DeviceClass *dc, Property *= props) Property *prop; =20 dc->props_ =3D props; - for (prop =3D props; prop && prop->name; prop++) { + for (prop =3D props; prop && prop->name_template; prop++) { qdev_class_add_legacy_property(dc, prop); } =20 @@ -983,9 +984,9 @@ void qdev_alias_all_properties(DeviceState *target, Obj= ect *source) do { DeviceClass *dc =3D DEVICE_CLASS(class); =20 - for (prop =3D dc->props_; prop && prop->name; prop++) { - object_property_add_alias(source, prop->name, - OBJECT(target), prop->name); + for (prop =3D dc->props_; prop && prop->name_template; prop++) { + object_property_add_alias(source, prop->name_template, + OBJECT(target), prop->name_template); } class =3D object_class_get_parent(class); } while (class !=3D object_class_by_name(TYPE_DEVICE)); diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 79164e4a3f..0d196a169a 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -697,14 +697,14 @@ static void qdev_print_props(Monitor *mon, DeviceStat= e *dev, Property *props, { if (!props) return; - for (; props->name; props++) { + for (; props->name_template; props++) { char *value; - char *legacy_name =3D g_strdup_printf("legacy-%s", props->name); + char *legacy_name =3D g_strdup_printf("legacy-%s", props->name_tem= plate); =20 if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) { value =3D object_property_get_str(OBJECT(dev), legacy_name, NU= LL); } else { - value =3D object_property_print(OBJECT(dev), props->name, true, + value =3D object_property_print(OBJECT(dev), props->name_templ= ate, true, NULL); } g_free(legacy_name); @@ -712,7 +712,7 @@ static void qdev_print_props(Monitor *mon, DeviceState = *dev, Property *props, if (!value) { continue; } - qdev_printf("%s =3D %s\n", props->name, + qdev_printf("%s =3D %s\n", props->name_template, *value ? value : ""); g_free(value); } --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219278; cv=none; d=zohomail.com; s=zohoarc; b=DP/mrUHFOjgQushj8uNxOv8+1vPNCSqS947xLo+W6NTZgC/dS9B5iJ0wDgrH0RGdA0iXDtakvktaLR7y9peCKsYAK1Bmg4SThx9DSD2Lk9raH9L8ejQ4V0z8ovd6/94u/T8Sp/D5JjUtOL+muQNz2LIsd9HQwwaoFFVPYIuew1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219278; 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=w0qCG4MDYU+uW5GsVOjVNG4scvgUximXuHhDfoNAono=; b=IbCQkOgIi3IFSEmgOktBT/t7gTTyDFZLp51zH29MNfU7WifeWSm/oJIfXaQKELNOqNY6lFr+USfIMJnVPcxMsWkGAUK6kE/6WA09VsJeXi3zMa+WY/HLP09/4f0dUOZfH1P4gANSoKqEyGUdO9B46j2UWskUjrRefwVzz0He8OM= 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 1605219278249293.83811084137915; Thu, 12 Nov 2020 14:14:38 -0800 (PST) Received: from localhost ([::1]:50908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKrV-0007Wy-4d for importer@patchew.org; Thu, 12 Nov 2020 17:14:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQW-0007p4-IA for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQU-0003ee-M1 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:44 -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-UEZv9PokM96n6aVLXe-Qqw-1; Thu, 12 Nov 2020 16:46:38 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2EB1B803F41; Thu, 12 Nov 2020 21:46:37 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id B45E21C4; Thu, 12 Nov 2020 21:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217601; 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=w0qCG4MDYU+uW5GsVOjVNG4scvgUximXuHhDfoNAono=; b=XT6VLj0dPF+d10NANii6NLHMe6ldV0AY0d0yl0LACRXGnPGGVB7TJi1bf43+8U2F7F+FPf vk95jTTscoC002BnYCvT/mv0dBzNzrdCj8EEDi5r1szhxKZ1/8stQu0/WkqtXq0+N6KmrD ovrynTaxtbw5V53VwUyz7C1ii+TwK7k= X-MC-Unique: UEZv9PokM96n6aVLXe-Qqw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 36/53] qdev: Don't set .name_template for array elements Date: Thu, 12 Nov 2020 16:43:33 -0500 Message-Id: <20201112214350.872250-37-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 property code should be able to handle .name_template=3D=3DNULL without problems, so we don't need to set it for array elements. This simple change will allow us to simplify the array property registration code a lot in the next commits. Signed-off-by: Eduardo Habkost --- This is a patch added in v2 of the series --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 03cfad1e74..ad08c80e67 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -593,7 +593,6 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, arrayprop->release =3D prop->arrayinfo->release; arrayprop->propname =3D propname; arrayprop->prop.info =3D prop->arrayinfo; - arrayprop->prop.name_template =3D propname; /* This ugly piece of pointer arithmetic sets up the offset so * that when the underlying get/set hooks call qdev_get_prop_ptr * they get the right answer despite the array element not actually --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219245; cv=none; d=zohomail.com; s=zohoarc; b=AEVTZvCEG8lGmwnR3Lugcjc26juyNJn0gbRv/RaRmGHHl60Zk6EfNzg+cYtpcywxqgcWJgtgo/AYw+RLk5fKvkWfP7YEIIcwGfSMP6yBmmO8B2VWfcvT8dpFyRLDgxd4j4PH0aSW0vTYEieylHzLFUy+zXqfjKIXIsw+p7iO7NY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219245; 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=qi/zfVz1M40pnEprIV3M8fmvBwq9LUvwFczHJz+Xazo=; b=mtjLdYfbz8SRDsJxMNjcgDlLexRDj8MpAN/51LzNBifLijLanroLcfUvFovka2xEKtNCxbZyEAUpM5gFd89HvGSs0k21wezF5QHcvGvb5ORrCOPva3XnYROirHvQncZ/Ff8RIcKeHcwtNPBb4+aq2Oa8OpU9OkYijcoQPclPvak= 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 1605219245651565.3425613452157; Thu, 12 Nov 2020 14:14:05 -0800 (PST) Received: from localhost ([::1]:48716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKqy-0006dY-Di for importer@patchew.org; Thu, 12 Nov 2020 17:14:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQY-0007rp-U3 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQX-0003f2-2s for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46: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-530-Qq9Qzm0GNR-bs8XyseLi3Q-1; Thu, 12 Nov 2020 16:46:42 -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 8C8F94237F; Thu, 12 Nov 2020 21:46:41 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FF7C60C13; Thu, 12 Nov 2020 21:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217604; 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=qi/zfVz1M40pnEprIV3M8fmvBwq9LUvwFczHJz+Xazo=; b=QARq28wyxjFb/fT5i4XeA8j9JlrsQZ5Yu+cO8hrxcdmTud3IPsjYkpsvpPPfXK5VWZujLa 8k1is1gh85vbfEtqPR9Dg/GXY3RyqJN/ZL3yuw77bT2BG4NSVjtL6hDoHsWWrHdYFsIsnr Bslrjp0tq2gekyaS7JyXTxIf490FZ/I= X-MC-Unique: Qq9Qzm0GNR-bs8XyseLi3Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 37/53] qdev: Remove ArrayElementProperty.propname field Date: Thu, 12 Nov 2020 16:43:34 -0500 Message-Id: <20201112214350.872250-38-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now that we don't save the property name in Property.name anymore, we don't need the to keep the property name string alive after the property was registered. We can remove the ArrayElementProperty.propname field, and free the string immediately after registering the property. Signed-off-by: Eduardo Habkost --- This is a new patch added in v2 of the series --- 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, 1 insertion(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ad08c80e67..2ab1c9688a 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -529,7 +529,6 @@ const PropertyInfo prop_info_size32 =3D { */ typedef struct { struct Property prop; - char *propname; ObjectPropertyRelease *release; } ArrayElementProperty; =20 @@ -543,7 +542,6 @@ static void array_element_release(Object *obj, const ch= ar *name, void *opaque) if (p->release) { p->release(obj, name, opaque); } - g_free(p->propname); g_free(p); } =20 @@ -587,11 +585,10 @@ static void set_prop_arraylen(Object *obj, Visitor *v= , const char *name, */ *arrayptr =3D eltptr =3D g_malloc0(*alenptr * prop->arrayfieldsize); for (i =3D 0; i < *alenptr; i++, eltptr +=3D prop->arrayfieldsize) { - char *propname =3D g_strdup_printf("%s[%d]", arrayname, i); + g_autofree char *propname =3D g_strdup_printf("%s[%d]", arrayname,= i); ArrayElementProperty *arrayprop =3D g_new0(ArrayElementProperty, 1= ); ObjectProperty *elmop; arrayprop->release =3D prop->arrayinfo->release; - arrayprop->propname =3D propname; arrayprop->prop.info =3D prop->arrayinfo; /* This ugly piece of pointer arithmetic sets up the offset so * that when the underlying get/set hooks call qdev_get_prop_ptr --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219401; cv=none; d=zohomail.com; s=zohoarc; b=mDEcZrM5VtvV4ttzmwK7Iizdynhp0I3GQOIjudAcjr54ibEi7/XKMpA1Bj/vZrrypeaZ3xaBQ9vOnKkdbRNbUJH0WwInzNn2k2vw/sZjXu7RYjdow6LWsInhOtbs1AUT+lHRW1eq/+RXz0SurjlLFuSYU0gEzhmSbN2zmMeaH0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219401; 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=mmtOmLSs68LoD0iqo8eOZFsLb0WpwblOEKj6i/aa2vQ=; b=OZBuywcsEjzmNXh1bXnGSlq3OdJB98Xa+N/nPF2qTVfW6mpulI514NLYseLVG/UXzAqll8pyIHcKCDN8NUpaBGssxF73/I+fBzPfUoQBVt53oGmUfA4aOJpR6rwqWSRrGAmbFHjdyROiahTSiYzE5crMLa3kxaB9vl7qi2U5y8s= 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 16052194018596.852237080801956; Thu, 12 Nov 2020 14:16:41 -0800 (PST) Received: from localhost ([::1]:55064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKtU-0000y5-NM for importer@patchew.org; Thu, 12 Nov 2020 17:16:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQd-0007tQ-CT for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35481) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQY-0003fB-D1 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:49 -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-538-49mD4eIkNkiLJsQ6N_-42Q-1; Thu, 12 Nov 2020 16:46:43 -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 8AE3B1018F72; Thu, 12 Nov 2020 21:46:42 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4488560C13; Thu, 12 Nov 2020 21:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217605; 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=mmtOmLSs68LoD0iqo8eOZFsLb0WpwblOEKj6i/aa2vQ=; b=VDN5sggJcGm6rWK3grvsNGyd6l4tmRcI6tdZZPC5nSS8FuzzHntuIZ28Nslo1qqOwOl0jN zt21j9J86CD4pvxARAOqDZXp8NCJG4nacl+7ylUDjdUqVf6H319VTfrKgkvP8tJ0lxHkY8 GvovqYq3GVeiPiCAE0ENm7m5za48zj0= X-MC-Unique: 49mD4eIkNkiLJsQ6N_-42Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 38/53] qdev: Remove ArrayElementProperty.release field Date: Thu, 12 Nov 2020 16:43:35 -0500 Message-Id: <20201112214350.872250-39-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 don't need the extra field because we can find the release function for the property directly at ArrayElementProperty.info.release. 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 --- hw/core/qdev-properties.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 2ab1c9688a..9f60f3b44d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -529,7 +529,6 @@ const PropertyInfo prop_info_size32 =3D { */ typedef struct { struct Property prop; - ObjectPropertyRelease *release; } ArrayElementProperty; =20 /* object property release callback for array element properties: @@ -539,8 +538,8 @@ typedef struct { static void array_element_release(Object *obj, const char *name, void *opa= que) { ArrayElementProperty *p =3D opaque; - if (p->release) { - p->release(obj, name, opaque); + if (p->prop.info->release) { + p->prop.info->release(obj, name, opaque); } g_free(p); } @@ -588,7 +587,6 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, g_autofree char *propname =3D g_strdup_printf("%s[%d]", arrayname,= i); ArrayElementProperty *arrayprop =3D g_new0(ArrayElementProperty, 1= ); ObjectProperty *elmop; - arrayprop->release =3D prop->arrayinfo->release; arrayprop->prop.info =3D prop->arrayinfo; /* This ugly piece of pointer arithmetic sets up the offset so * that when the underlying get/set hooks call qdev_get_prop_ptr --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219577; cv=none; d=zohomail.com; s=zohoarc; b=gE7GpHhRnzs5apYZ701LtFfE8Cl5DDj+kb2CzXU2Gi2Bde8NBmC1Nrb9bH1VMcVVxosYVeebAVna7gqur/3yU65pzAAg7WDr6mkRW0JfIuqTekiHD1jFXK7nIBpkeChFHLlJWF0SCm9wk928h86KewQMqeFrlcmlul6+6uGUFZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219577; 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=4WmVTi9i6vnaHfYJW3cEaYH3q9RAFuZxzXrcPplStXc=; b=BtMQ0OviP0MrPvfqYkkGFJs83jICvmKEi1mGlYVcej9EoP3KgBZQKwzm7ZIafWT/5EjITklUhwAz3z63YcAQFfz8b5ywd28ufuCR7v+nbIU1j8DxCgILA4++aW2GusJ1wLGxpw5cPiqML1vuCe1z8EEffCLQRqJrorR/CO94y2w= 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 1605219577161481.78185300024575; Thu, 12 Nov 2020 14:19:37 -0800 (PST) Received: from localhost ([::1]:33218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKwJ-0003fE-OF for importer@patchew.org; Thu, 12 Nov 2020 17:19:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQo-0007ue-1r for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30722) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQd-0003fa-43 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:46:58 -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-305-Aabk5qYGOUafGwFWIsXe1Q-1; Thu, 12 Nov 2020 16:46:45 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3900190A3E0; Thu, 12 Nov 2020 21:46:43 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 923A96EF56; Thu, 12 Nov 2020 21:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217609; 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=4WmVTi9i6vnaHfYJW3cEaYH3q9RAFuZxzXrcPplStXc=; b=PVh00+1UeK+22W+4Ag5FeFFikAOrcw7L0ZLvsl5T8UQQtM6RgvXjtmsfPdF2CHBDQkROsK MaYqnJl1euxPYPVGvoAH2k9utaQIp80wvRnho9pOtehefH/zABvD4UzR7o3tk1fZ5+xFY9 Ln07lLloymVMV38i8zJBoR81aqfDgew= X-MC-Unique: Aabk5qYGOUafGwFWIsXe1Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 39/53] qdev: Get rid of ArrayElementProperty struct Date: Thu, 12 Nov 2020 16:43:36 -0500 Message-Id: <20201112214350.872250-40-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now that we don't store any additional data about the property in AraryElementStruct, we don't need it anymore. We can just allocate a Property struct directly. Signed-off-by: Eduardo Habkost --- Change v1 -> v2: * Get rid of the struct, but not of the release function (we still need it, or we will leak the Property struct we allocate) --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 9f60f3b44d..0ffef5ab4f 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -521,27 +521,17 @@ const PropertyInfo prop_info_size32 =3D { =20 /* --- support for array properties --- */ =20 -/* Used as an opaque for the object properties we add for each - * array element. Note that the struct Property must be first - * in the struct so that a pointer to this works as the opaque - * for the underlying element's property hooks as well as for - * our own release callback. - */ -typedef struct { - struct Property prop; -} ArrayElementProperty; - /* object property release callback for array element properties: * we call the underlying element's property release hook, and * then free the memory we allocated when we added the property. */ static void array_element_release(Object *obj, const char *name, void *opa= que) { - ArrayElementProperty *p =3D opaque; - if (p->prop.info->release) { - p->prop.info->release(obj, name, opaque); + Property *prop =3D opaque; + if (prop->info->release) { + prop->info->release(obj, name, opaque); } - g_free(p); + g_free(prop); } =20 static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, @@ -585,20 +575,20 @@ static void set_prop_arraylen(Object *obj, Visitor *v= , const char *name, *arrayptr =3D eltptr =3D g_malloc0(*alenptr * prop->arrayfieldsize); for (i =3D 0; i < *alenptr; i++, eltptr +=3D prop->arrayfieldsize) { g_autofree char *propname =3D g_strdup_printf("%s[%d]", arrayname,= i); - ArrayElementProperty *arrayprop =3D g_new0(ArrayElementProperty, 1= ); + Property *arrayprop =3D g_new0(Property, 1); ObjectProperty *elmop; - arrayprop->prop.info =3D prop->arrayinfo; + arrayprop->info =3D prop->arrayinfo; /* This ugly piece of pointer arithmetic sets up the offset so * that when the underlying get/set hooks call qdev_get_prop_ptr * they get the right answer despite the array element not actually * being inside the device struct. */ - arrayprop->prop.offset =3D eltptr - (void *)obj; - assert(object_field_prop_ptr(obj, &arrayprop->prop) =3D=3D eltptr); + arrayprop->offset =3D eltptr - (void *)obj; + assert(object_field_prop_ptr(obj, arrayprop) =3D=3D eltptr); elmop =3D object_property_add(obj, propname, - arrayprop->prop.info->name, - field_prop_getter(arrayprop->prop.info= ), - field_prop_setter(arrayprop->prop.info= ), + arrayprop->info->name, + field_prop_getter(arrayprop->info), + field_prop_setter(arrayprop->info), array_element_release, arrayprop); elmop->allow_set =3D op->allow_set; --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219711; cv=none; d=zohomail.com; s=zohoarc; b=KYX+NfwiXmM6gFYnnolZNiVFEdIkHj7R1au+URxkzm+0ndawBmbi7ZDyVNSuz4aeLm6EpAQ/A9axddtQQDPQlHxG4+ddSTL42KuIvCSxpTFU9kdKMgOVAkZIT/TqHa680Xguk/dumgMRdtXyq0sn20dD6mQRckSh3DX9l9BnVXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219711; 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=Gzl3NDJkQBC7o8ztf82VppDE9OiI4LYjsDox8IxZhFo=; b=VWwzgYd9oFtoDtnlEsxtEbPL0LYT+e8UOxN2ASpGCN1/naWbqrN+tg87nohv7kUHQHqy8t8g5IuWEZk9WpvNko2hmpyQg//Nw3ObFf/RjkN4U8lKjpdgr+WDYT52LNfk8shOBoZeAJ1OZa5pdV93IrUq+8EbfLUE0/CuIR5Fxjo= 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 1605219711548860.7432610150729; Thu, 12 Nov 2020 14:21:51 -0800 (PST) Received: from localhost ([::1]:40040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKyU-0006cx-E3 for importer@patchew.org; Thu, 12 Nov 2020 17:21:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQq-0007v2-4F for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25878) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQl-0003fq-TN for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47: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-239-1S41Z_q_P2eNlabUvspgxg-1; Thu, 12 Nov 2020 16:46:48 -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 E28C5804763; Thu, 12 Nov 2020 21:46:47 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 823CC19C59; Thu, 12 Nov 2020 21:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217611; 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=Gzl3NDJkQBC7o8ztf82VppDE9OiI4LYjsDox8IxZhFo=; b=AytklfK2YPJ1W420ir3/94QeAqjmK58hQtZ8Xx0EDNoCx9MVw71niVbvKDLsyyo1sD3BM5 eDm8lm7VdDOa47VWBoO4adxEShYal2srKAEU3SCP2zWej2R89XBYjEQBTC190ZnhnB3wS5 HIvSejaptM0mRvR4CCxGrDllEn7sgkI= X-MC-Unique: 1S41Z_q_P2eNlabUvspgxg-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 40/53] qdev: Rename array_element_release() to static_prop_release_dynamic_prop() Date: Thu, 12 Nov 2020 16:43:37 -0500 Message-Id: <20201112214350.872250-41-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 function is now generic and can be used by any property that had the Property struct allocated dynamically. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of the series. --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 0ffef5ab4f..d5773ffd8a 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -521,11 +521,12 @@ const PropertyInfo prop_info_size32 =3D { =20 /* --- support for array properties --- */ =20 -/* object property release callback for array element properties: +/* object property release callback for dynamically-created properties: * we call the underlying element's property release hook, and * then free the memory we allocated when we added the property. */ -static void array_element_release(Object *obj, const char *name, void *opa= que) +static void static_prop_release_dynamic_prop(Object *obj, const char *name, + void *opaque) { Property *prop =3D opaque; if (prop->info->release) { @@ -589,7 +590,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, arrayprop->info->name, field_prop_getter(arrayprop->info), field_prop_setter(arrayprop->info), - array_element_release, + static_prop_release_dynamic_prop, arrayprop); elmop->allow_set =3D op->allow_set; } --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219450; cv=none; d=zohomail.com; s=zohoarc; b=Ab/tml78bgMFhipZeVUOQikblrMDj2YB2sd7KsaZE7jXjmSjgHcWQFhrlGRXNdQ8m+YKI/w8Ow/5loZ2xaY0a4vi5e9IHcuh8zK9QZxAqyDkFWX6XhQWlT06BN9XvTNz9Na33MAcprShVySi7ktD9qeWWGrwPmnFpeD1iPejPws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219450; 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=r7TERLJpM+jpqFm63tOaEIhKSaxT38IN74gOJ5NgF+k=; b=IFU6t861iki6ujDNU82toD9ZFmK0w+2RuBgYs9t7xZvzJM7gpLa+Ga2KpNHbKpwp4m0zlOM5TYXhNUeMIOWOcVdnujIjGaI73axlP5gvP4w0HPaN4gGhKNx1bQa1z0GBnA5g46YiuQMnyqzsHVOlSwBs8QgMwSM02zE6ePRCIp0= 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 1605219450331751.3569780814223; Thu, 12 Nov 2020 14:17:30 -0800 (PST) Received: from localhost ([::1]:57280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKuH-0001tN-8I for importer@patchew.org; Thu, 12 Nov 2020 17:17:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQr-0007xW-TE for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:58987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQp-0003g5-Th for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:05 -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-326-rkA8YRNeNAOJQAsH3Ow5qA-1; Thu, 12 Nov 2020 16:46:53 -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 83E5C57210; Thu, 12 Nov 2020 21:46:52 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0797455763; Thu, 12 Nov 2020 21:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217615; 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=r7TERLJpM+jpqFm63tOaEIhKSaxT38IN74gOJ5NgF+k=; b=P+LfP1fesKE34BiAXQqZXthIk8F9mm0OucwpkT/n7yqaTInzEn6jB9giw9VDJH8f19OsyD iPzD+pJl5dNnn0CYIoKTHUGGoFncig6kPYFK6YxmnfzN2eNHrUVs7MKCezuxhVOq/MUk4R wl7/9dveU+bfkOOvDcg68ndqTGQjh7o= X-MC-Unique: rkA8YRNeNAOJQAsH3Ow5qA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 41/53] qdev: Make object_property_add_field() copy the Property struct Date: Thu, 12 Nov 2020 16:43:38 -0500 Message-Id: <20201112214350.872250-42-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 the function more convenient to use, and allow us to reuse it for array element properties. I'm not adding a version of this function that doesn't copy the struct, because this function isn't supposed to be used widely. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of the series. --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index d5773ffd8a..451bb54cf6 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -828,21 +828,23 @@ object_property_add_field(Object *obj, const char *na= me, ObjectPropertyAllowSet allow_set) { ObjectProperty *op; + Property *newprop =3D g_new0(Property, 1); =20 assert(allow_set); assert(!prop->info->create); =20 - op =3D object_property_add(obj, name, prop->info->name, - field_prop_getter(prop->info), - field_prop_setter(prop->info), - prop->info->release, - prop); + *newprop =3D *prop; + op =3D object_property_add(obj, name, newprop->info->name, + field_prop_getter(newprop->info), + field_prop_setter(newprop->info), + static_prop_release_dynamic_prop, + newprop); =20 object_property_set_description(obj, name, - prop->info->description); + newprop->info->description); =20 - if (prop->set_default) { - prop->info->set_default_value(op, prop); + if (newprop->set_default) { + newprop->info->set_default_value(op, newprop); if (op->init) { op->init(obj, op); } --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219862; cv=none; d=zohomail.com; s=zohoarc; b=OMJo3x8TE9VVyqWpw8mJbvcWreaFM1qOEOiVp4RT7P9BSyiWwiFbdWy0l4bhTHgqHiiXtKsGpEAWhPfDkiWCRUZKhHQMy1BS0doXH3AADDqmFeNvu90dJJOswcJc0H1jhwad0cV0wGAqIC8EnWOJwGUXaEK7CH4sKsNbZBzOiuc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219862; 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=9au0hMgoTwIgKsyhRrZeHVmN0cbfyd/tS2lds+OqHl0=; b=SUY5SLWwaUKNpXN1LtVXgLHeVg1E+bqkyHlg+GOP3tc8XcyzA24G9PR7zyPVRJ5U+4xzCdMasKp5ixCuYt7HytFNLT+DtUcV7VTH7MLocx4maEZfXsuphaRIVGOsOjwpe8Jeja2PPgsrmmNnMQu02W1QSbIU+fFpMH/Ph0Mh4WQ= 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 1605219862207474.35489593671343; Thu, 12 Nov 2020 14:24:22 -0800 (PST) Received: from localhost ([::1]:46322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdL0v-0000ty-3T for importer@patchew.org; Thu, 12 Nov 2020 17:24:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQt-00080q-Al for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:23727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQp-0003gK-To for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:06 -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-570-hl19j1bOO2SO7ic4fMzC0Q-1; Thu, 12 Nov 2020 16:46:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EC490805EF9; Thu, 12 Nov 2020 21:46:56 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 520005B4A7; Thu, 12 Nov 2020 21:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217620; 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=9au0hMgoTwIgKsyhRrZeHVmN0cbfyd/tS2lds+OqHl0=; b=iwNT0mtGicGGHALu5UFrQ2GkKYle8/bnBBY/oJVrWcw39xc7Nkz96Mv0tc1crY9GqKCeBI g3/+iqmiFMFFnDJR7Wr6KufwEsY+FJLgJhG2AmhqwjuBmnETP3fbPja3Xlo2dFT9+efGrs g+Dyj0jy2dGGJiAJzzGW3wzMEpVG5HU= X-MC-Unique: hl19j1bOO2SO7ic4fMzC0Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 42/53] qdev: Reuse object_property_add_field() when adding array elements Date: Thu, 12 Nov 2020 16:43:39 -0500 Message-Id: <20201112214350.872250-43-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now that we call object_property_add() with exactly the same arguments as object_property_add_field() does, we can just reuse the function. We can now use a stack variable for the new Property struct, because object_property_add_field() will copy the struct. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Fix memory leak from v2, after making object_property_add_field() copy the Property struct Changes v1 -> v2: * Now we don't need to hack ObjectProperty.release anymore, patch became trivial --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 451bb54cf6..83fd45add0 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -576,23 +576,17 @@ static void set_prop_arraylen(Object *obj, Visitor *v= , const char *name, *arrayptr =3D eltptr =3D g_malloc0(*alenptr * prop->arrayfieldsize); for (i =3D 0; i < *alenptr; i++, eltptr +=3D prop->arrayfieldsize) { g_autofree char *propname =3D g_strdup_printf("%s[%d]", arrayname,= i); - Property *arrayprop =3D g_new0(Property, 1); - ObjectProperty *elmop; - arrayprop->info =3D prop->arrayinfo; + Property arrayprop =3D { }; + arrayprop.info =3D prop->arrayinfo; /* This ugly piece of pointer arithmetic sets up the offset so * that when the underlying get/set hooks call qdev_get_prop_ptr * they get the right answer despite the array element not actually * being inside the device struct. */ - arrayprop->offset =3D eltptr - (void *)obj; - assert(object_field_prop_ptr(obj, arrayprop) =3D=3D eltptr); - elmop =3D object_property_add(obj, propname, - arrayprop->info->name, - field_prop_getter(arrayprop->info), - field_prop_setter(arrayprop->info), - static_prop_release_dynamic_prop, - arrayprop); - elmop->allow_set =3D op->allow_set; + arrayprop.offset =3D eltptr - (void *)obj; + assert(object_field_prop_ptr(obj, &arrayprop) =3D=3D eltptr); + object_property_add_field(obj, propname, &arrayprop, + op->allow_set); } } =20 --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219777; cv=none; d=zohomail.com; s=zohoarc; b=M6xalG57rO/LbjYqaVVWVBSjAW40aT6MtpVT7R0LpUEpdVcQfna3EGE7bXBZtWHCOP25ep1HAcvGzd/fofQRpyu/sRBGLUasDYHokah7g9YNHFRxD9ziVPMYXV76IQbgsr0D9d4WclubNxuuA7YPzsr22KZ1DuAnSgCm5ynAzDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219777; 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=Ja/YmWt/OMSFvhSVMA3UOQ10xojvR9RvVHDVddUDRaY=; b=IH15nJG4LS/jxtRJHNH3n0lAIShbq9F1BXMABjSOmGGwCZnL+0GFXFW/H9l9VuIJAlxqbRpRmluIJS3X9VSOq8+SGOj8zf3I/DqToA9AjhKDPstvxW3SrAlnk7Zv5wPCAOEA2HQ0GE89XzHCCSXqcEiD8mMGdvE3VvrGZKF//4I= 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 1605219777029245.2869252913638; Thu, 12 Nov 2020 14:22:57 -0800 (PST) Received: from localhost ([::1]:42118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKzX-0007VZ-TO for importer@patchew.org; Thu, 12 Nov 2020 17:22:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQr-0007wt-LY for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59084) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQp-0003gS-Ov for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:05 -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-68-NoCWWUqNOCWnU2OuJdpIXw-1; Thu, 12 Nov 2020 16:46:59 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 764B7184217D; Thu, 12 Nov 2020 21:46:58 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D2D85B4C2; Thu, 12 Nov 2020 21:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217621; 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=Ja/YmWt/OMSFvhSVMA3UOQ10xojvR9RvVHDVddUDRaY=; b=aHd30YwuJfPw4TuBuqsQeDIbFu/ZYmd5SR2f0bINOk9HIEFPoLktwRg3eAwtgQAR0FzsD5 svn9ojTLflsqV42u1psX192LYrnwpjCjWDdvoB95rBS48zXLn0uzQ7guSEU0Z0jmRLg9Po 46Jlfsmnm7aBnrpn8O0KjVRtKgWwnDs= X-MC-Unique: NoCWWUqNOCWnU2OuJdpIXw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 43/53] qdev: Move static_prop_release_dynamic_prop() closer to its usage Date: Thu, 12 Nov 2020 16:43:40 -0500 Message-Id: <20201112214350.872250-44-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 function closer to where it's used, to make refactor and review simpler. While doing it, reformat the comment at the top to follow coding style. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of the series. --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 83fd45add0..7aa5d2ff45 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -521,20 +521,6 @@ const PropertyInfo prop_info_size32 =3D { =20 /* --- support for array properties --- */ =20 -/* object property release callback for dynamically-created properties: - * we call the underlying element's property release hook, and - * then free the memory we allocated when we added the property. - */ -static void static_prop_release_dynamic_prop(Object *obj, const char *name, - void *opaque) -{ - Property *prop =3D opaque; - if (prop->info->release) { - prop->info->release(obj, name, opaque); - } - g_free(prop); -} - static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -816,6 +802,21 @@ const PropertyInfo prop_info_link =3D { .create =3D create_link_property, }; =20 +/* + * Property release callback for dynamically-created properties: + * We call the underlying element's property release hook, and + * then free the memory we allocated when we added the property. + */ +static void static_prop_release_dynamic_prop(Object *obj, const char *name, + void *opaque) +{ + Property *prop =3D opaque; + if (prop->info->release) { + prop->info->release(obj, name, opaque); + } + g_free(prop); +} + ObjectProperty * object_property_add_field(Object *obj, const char *name, Property *prop, --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219913; cv=none; d=zohomail.com; s=zohoarc; b=Ua8IznJz2a5bcobEvtDJE2KpyjW2JqsCipQGVvYnsIDOPKJ7Zi6ItPxbjsjbgrfDWTh/2EDr9ZXI42xBRO2o9W11boD1UAyJOwhPzNRehPTZqj4USg8XmpmUa9Um9oCks7PnBYODxZJxpCYR3wj6duS6o/n+741R4ACnk9rK3Ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219913; 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=+J/mZsm6WK/MiGHwwWJIz/McIC+pChsohiz1yjkiRF0=; b=bp2wvR3p4iWRLbgkPgVCR0i5HqL0tzHjh3U2/zN41xd+Rb0Wj9QpxtW6adjOqd9uvUTtCPc8AvKxfRp1LEZXsN1ttw/CZkQWu1GNrEVH7qgHr3m3dr3ENRnF0A7bo0KvKd5HnaBCavRwMu5FVuQm/xw2xjaSVq4pYwCKKfnBcuw= 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 1605219913699593.1557925321247; Thu, 12 Nov 2020 14:25:13 -0800 (PST) Received: from localhost ([::1]:48476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdL1k-0001oZ-JN for importer@patchew.org; Thu, 12 Nov 2020 17:25:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQt-000828-TF for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQp-0003gw-Ue for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47: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-89-IGentQ4uMfC2nSF0Bt4QPw-1; Thu, 12 Nov 2020 16:47:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B3F2184217D; Thu, 12 Nov 2020 21:47:00 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 766695B4A7; Thu, 12 Nov 2020 21:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217623; 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=+J/mZsm6WK/MiGHwwWJIz/McIC+pChsohiz1yjkiRF0=; b=gzTpylu0UjlGa1a8Xh68Kfvb5w1ItPeriaHdoXS5Hprq7hfVBn72P1VdGOlIfWGpNyZQjc cMR+XTEfSCoBKqkAhn1yHLIDkxiKYF6hRFsLV2lEoUEskQ11e9HATttHqKNQfBpefOlYSF BTiW0gvIda+kNuZAMlSp9TdUYjXJquU= X-MC-Unique: IGentQ4uMfC2nSF0Bt4QPw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 44/53] qom: Add new qom.h header Date: Thu, 12 Nov 2020 16:43:41 -0500 Message-Id: <20201112214350.872250-45-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Multiple QOM features will be provided by different headers. Add a qom/qom.h header to make it easier to include all of them at once. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of the series. --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/qom/qom.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 include/qom/qom.h diff --git a/include/qom/qom.h b/include/qom/qom.h new file mode 100644 index 0000000000..3286605083 --- /dev/null +++ b/include/qom/qom.h @@ -0,0 +1,10 @@ +/* + * QEMU Object Model convenience header + * + * This header is not supposed to be included by other headers + * but by .c files that use QOM. + */ + +#include "qom/object.h" +#include "qom/object_interfaces.h" +#include "qom/qom-qobject.h" --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605218703; cv=none; d=zohomail.com; s=zohoarc; b=A3KEUDNMgtyGS5shPiaLEYHK2ij00d5a7wkNKhqHrWnTChpjjHqP49a8Pr1EUZsPL3rm/msTsh9Y7KF2Rn5+fy7nHM96+Fiz0WA2J6tmEx8Kf5eX0VJ5B4dCfIKpsba9iZ7HS1lLilZC1nL2nZUfX48O+5JMGjd0x8G12tICJDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218703; 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=qtP7hkoUO/2D4UzMSq43kPT6M2wSx5R64H5fw4LILMg=; b=eRVjBRiFTwg4Bzhu8/8l4lYixislp6kaM03VCCW5HbU4IXtyRniI4wRn3W9oz3X1ouX+pojRREnSWbpTas2S/ElG7LU11AyxEEvSaraNrhlFMXt48HnZHUPmb2ue4Np7lw57UguM0rLFqHZOzj8p3sCCvBRe7NpYWU7hC7fdGUI= 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 1605218703170359.5660090515829; Thu, 12 Nov 2020 14:05:03 -0800 (PST) Received: from localhost ([::1]:52998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKiE-0004hy-2V for importer@patchew.org; Thu, 12 Nov 2020 17:05:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKQx-00088p-2K for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:27665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQu-0003jI-AY for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:10 -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-K3qrJUprNfmKISncVNeGWA-1; Thu, 12 Nov 2020 16:47: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 C986E1074657; Thu, 12 Nov 2020 21:47:04 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 179C810016DA; Thu, 12 Nov 2020 21:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217627; 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=qtP7hkoUO/2D4UzMSq43kPT6M2wSx5R64H5fw4LILMg=; b=OskzSXb/qa0HHJSk248eA0uAg7YLORs3OlTDF7h+o//9o3EtR43s6r0UtBPwj8zIwysdNL 8Fa+zPIWNoduNV+PeJfueQY+dFAx/hd1taSgTkvHW02bb2NT4vgvDcm97yLS6ZY5jG7c7P 91I5VtomzUel7mb5rQjgs2YMhT1qdzE= X-MC-Unique: K3qrJUprNfmKISncVNeGWA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 45/53] qdev: Move core field property code to QOM Date: Thu, 12 Nov 2020 16:43:42 -0500 Message-Id: <20201112214350.872250-46-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 core of the static property code to qom/field-property.c. The actual property type implementations are still in qdev-properties.c, they will be moved later. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Redone patch after changes in previous patches of this series * Reordered patch, tried to place it a bit earlier in the series Changes v1 -> v2: * Rename static-property.* to field-property.* --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 49 +------ .../qom/field-property-internal.h | 6 +- include/qom/field-property.h | 57 ++++++++ include/qom/qom.h | 1 + hw/core/qdev-properties-system.c | 2 +- hw/core/qdev-properties.c | 134 +---------------- qom/field-property.c | 137 ++++++++++++++++++ qom/meson.build | 1 + 8 files changed, 202 insertions(+), 185 deletions(-) rename hw/core/qdev-prop-internal.h =3D> include/qom/field-property-intern= al.h (95%) create mode 100644 include/qom/field-property.h create mode 100644 qom/field-property.c diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 1208e12b9b..6585a8e693 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -2,52 +2,7 @@ #define QEMU_QDEV_PROPERTIES_H =20 #include "hw/qdev-core.h" - -/** - * 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 { - /** - * @name_template: Property name template - * - * This is a string containing the template to be used when - * creating the property. It can be NULL, and code shouldn't - * assume it will contain the actual property name. - */ - const char *name_template; - 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)(Object *obj, Property *prop, char *dest, size_t len); - void (*set_default_value)(ObjectProperty *op, const Property *prop); - ObjectProperty *(*create)(ObjectClass *oc, const char *name, - Property *prop); - ObjectPropertyAccessor *get; - ObjectPropertyAccessor *set; - ObjectPropertyRelease *release; -}; - +#include "qom/field-property.h" =20 /*** qdev-properties.c ***/ =20 @@ -200,8 +155,6 @@ 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 *object_field_prop_ptr(Object *obj, Property *prop); - void qdev_prop_register_global(GlobalProperty *prop); const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name); diff --git a/hw/core/qdev-prop-internal.h b/include/qom/field-property-inte= rnal.h similarity index 95% rename from hw/core/qdev-prop-internal.h rename to include/qom/field-property-internal.h index 47bab46810..a7b7e2b69d 100644 --- a/hw/core/qdev-prop-internal.h +++ b/include/qom/field-property-internal.h @@ -1,12 +1,12 @@ /* - * qdev property parsing + * QOM field property internal API (for implementing custom types) * * This work is licensed under the terms of the GNU GPL, version 2 or late= r. * See the COPYING file in the top-level directory. */ =20 -#ifndef HW_CORE_QDEV_PROP_INTERNAL_H -#define HW_CORE_QDEV_PROP_INTERNAL_H +#ifndef QOM_STATIC_PROPERTY_INTERNAL_H +#define QOM_STATIC_PROPERTY_INTERNAL_H =20 void field_prop_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp); diff --git a/include/qom/field-property.h b/include/qom/field-property.h new file mode 100644 index 0000000000..91e7a43165 --- /dev/null +++ b/include/qom/field-property.h @@ -0,0 +1,57 @@ +/* + * QOM field property API + */ +#ifndef QOM_FIELD_PROPERTY_H +#define QOM_FIELD_PROPERTY_H + +#include "qom/object.h" +#include "qapi/util.h" + +/** + * 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 { + /** + * @name_template: Property name template + * + * This is a string containing the template to be used when + * creating the property. It can be NULL, and code shouldn't + * assume it will contain the actual property name. + */ + const char *name_template; + 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)(Object *obj, Property *prop, char *dest, size_t len); + void (*set_default_value)(ObjectProperty *op, const Property *prop); + ObjectProperty *(*create)(ObjectClass *oc, const char *name, + Property *prop); + ObjectPropertyAccessor *get; + ObjectPropertyAccessor *set; + ObjectPropertyRelease *release; +}; + +void *object_field_prop_ptr(Object *obj, Property *prop); + +#endif diff --git a/include/qom/qom.h b/include/qom/qom.h index 3286605083..9dbc88801d 100644 --- a/include/qom/qom.h +++ b/include/qom/qom.h @@ -8,3 +8,4 @@ #include "qom/object.h" #include "qom/object_interfaces.h" #include "qom/qom-qobject.h" +#include "qom/field-property.h" diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 8781b856d3..8da68f076c 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -24,7 +24,7 @@ #include "qemu/units.h" #include "qemu/uuid.h" #include "qemu/error-report.h" -#include "qdev-prop-internal.h" +#include "qom/field-property-internal.h" =20 #include "audio/audio.h" #include "chardev/char-fe.h" diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 7aa5d2ff45..c79cb9a89b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -8,7 +8,7 @@ #include "qapi/visitor.h" #include "qemu/units.h" #include "qemu/cutils.h" -#include "qdev-prop-internal.h" +#include "qom/field-property-internal.h" =20 void qdev_prop_set_after_realize(DeviceState *dev, const char *name, Error **errp) @@ -50,48 +50,6 @@ void qdev_prop_allow_set_link_before_realize(const Objec= t *obj, } } =20 -void *object_field_prop_ptr(Object *obj, Property *prop) -{ - void *ptr =3D obj; - ptr +=3D prop->offset; - return ptr; -} - -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 field_prop_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -802,96 +760,6 @@ const PropertyInfo prop_info_link =3D { .create =3D create_link_property, }; =20 -/* - * Property release callback for dynamically-created properties: - * We call the underlying element's property release hook, and - * then free the memory we allocated when we added the property. - */ -static void static_prop_release_dynamic_prop(Object *obj, const char *name, - void *opaque) -{ - Property *prop =3D opaque; - if (prop->info->release) { - prop->info->release(obj, name, opaque); - } - g_free(prop); -} - -ObjectProperty * -object_property_add_field(Object *obj, const char *name, - Property *prop, - ObjectPropertyAllowSet allow_set) -{ - ObjectProperty *op; - Property *newprop =3D g_new0(Property, 1); - - assert(allow_set); - assert(!prop->info->create); - - *newprop =3D *prop; - op =3D object_property_add(obj, name, newprop->info->name, - field_prop_getter(newprop->info), - field_prop_setter(newprop->info), - static_prop_release_dynamic_prop, - newprop); - - object_property_set_description(obj, name, - newprop->info->description); - - if (newprop->set_default) { - newprop->info->set_default_value(op, newprop); - if (op->init) { - op->init(obj, op); - } - } - - op->allow_set =3D allow_set; - return op; -} - -ObjectProperty * -object_class_property_add_field_static(ObjectClass *oc, const char *name, - Property *prop, - ObjectPropertyAllowSet allow_set) -{ - ObjectProperty *op; - - assert(allow_set); - - if (prop->info->create) { - op =3D prop->info->create(oc, name, prop); - } else { - 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); - } - if (prop->info->description) { - object_class_property_set_description(oc, name, - prop->info->description); - } - - op->allow_set =3D allow_set; - return op; -} - -void object_class_add_field_properties(ObjectClass *oc, Property *props, - ObjectPropertyAllowSet allow_set) -{ - Property *prop; - - for (prop =3D props; prop && prop->name_template; prop++) { - object_class_property_add_field_static(oc, prop->name_template, pr= op, - allow_set); - } -} - - void qdev_property_add_static(DeviceState *dev, Property *prop) { object_property_add_field(OBJECT(dev), prop->name_template, prop, diff --git a/qom/field-property.c b/qom/field-property.c new file mode 100644 index 0000000000..1fd11f2ad3 --- /dev/null +++ b/qom/field-property.c @@ -0,0 +1,137 @@ +/* + * QOM field property API implementation + */ +#include "qemu/osdep.h" +#include "qom/field-property.h" +#include "qom/field-property-internal.h" + +void *object_field_prop_ptr(Object *obj, Property *prop) +{ + void *ptr =3D obj; + ptr +=3D prop->offset; + return ptr; +} + +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; +} + +/* + * Property release callback for dynamically-created properties: + * We call the underlying element's property release hook, and + * then free the memory we allocated when we added the property. + */ +static void static_prop_release_dynamic_prop(Object *obj, const char *name, + void *opaque) +{ + Property *prop =3D opaque; + if (prop->info->release) { + prop->info->release(obj, name, opaque); + } + g_free(prop); +} + +ObjectProperty * +object_property_add_field(Object *obj, const char *name, + Property *prop, + ObjectPropertyAllowSet allow_set) +{ + ObjectProperty *op; + Property *newprop =3D g_new0(Property, 1); + + assert(allow_set); + assert(!prop->info->create); + + *newprop =3D *prop; + op =3D object_property_add(obj, name, newprop->info->name, + field_prop_getter(newprop->info), + field_prop_setter(newprop->info), + static_prop_release_dynamic_prop, + newprop); + + object_property_set_description(obj, name, + newprop->info->description); + + if (newprop->set_default) { + newprop->info->set_default_value(op, newprop); + if (op->init) { + op->init(obj, op); + } + } + + op->allow_set =3D allow_set; + return op; +} + +ObjectProperty * +object_class_property_add_field_static(ObjectClass *oc, const char *name, + Property *prop, + ObjectPropertyAllowSet allow_set) +{ + ObjectProperty *op; + + assert(allow_set); + + if (prop->info->create) { + op =3D prop->info->create(oc, name, prop); + } else { + 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); + } + if (prop->info->description) { + object_class_property_set_description(oc, name, + prop->info->description); + } + + op->allow_set =3D allow_set; + return op; +} + +void object_class_add_field_properties(ObjectClass *oc, Property *props, + ObjectPropertyAllowSet allow_set) +{ + Property *prop; + + for (prop =3D props; prop && prop->name_template; prop++) { + object_class_property_add_field_static(oc, prop->name_template, pr= op, + allow_set); + } +} diff --git a/qom/meson.build b/qom/meson.build index 062a3789d8..e83794454d 100644 --- a/qom/meson.build +++ b/qom/meson.build @@ -4,6 +4,7 @@ qom_ss.add(files( 'object.c', 'object_interfaces.c', 'qom-qobject.c', + 'field-property.c', )) =20 qmp_ss.add(files('qom-qmp-cmds.c')) --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605220101; cv=none; d=zohomail.com; s=zohoarc; b=nNxwxsKxtIFD5126UuuQSLKL0Rnt5nusOTpsRVixQpo0L9gunIw2VN9akvJmqyoFGoNX5FkpKLCD614eew4WKrux/mf3z+/lg2HFtpJ4OzmZKy2fPuBvvbb09dARuh/gv0I33LcmG8L6JQbd1OPvzZ6+LnHWyXanoDzfSfst9Cc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605220101; 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=ckHrdG7afHO+vYKYk5rCNQ2Za/jOvDXsKRnppkOWbgE=; b=Af2D3wT/KsuI1Use84RjDC9WK4zb81ayB96SmuiNfIA33SpDciINkwZf1gAn3Jsji/+M3cW+09Hkl59Bw4b+8i9DnTe2RYlU7KsSlzxwOUx85SJozkFZAbLQ67qhytrLYBh7VshCavv5+2VXb6rXGzsmmbDZNmQPK/eVh0LK9wA= 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 1605220101930120.64029475083123; Thu, 12 Nov 2020 14:28:21 -0800 (PST) Received: from localhost ([::1]:54882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdL4m-0004f9-IP for importer@patchew.org; Thu, 12 Nov 2020 17:28:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKR0-0008FU-FM for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47995) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKQv-0003jg-Up for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:14 -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-100-KhsZAAkkPVWl6GLsredfmw-1; Thu, 12 Nov 2020 16:47:07 -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 44651185A0C0; Thu, 12 Nov 2020 21:47:06 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE4C71002382; Thu, 12 Nov 2020 21:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217629; 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=ckHrdG7afHO+vYKYk5rCNQ2Za/jOvDXsKRnppkOWbgE=; b=UlGYS7DPrfgQKfHxlXMKwOsLpp4ryI8uc5AuWwRpGzUsaCajKAhs0V9/NjA/x/vl9EP4ar JmTGLNTLdpshW4IFGPxX6Ce8FYtb0T87q3mclQCWXTlH7Vl1VEBLoVVH52V0NsNC4AXZh2 txkV1JYcCp9ILzbwRTL+MQ4J+ZAj6Kc= X-MC-Unique: KhsZAAkkPVWl6GLsredfmw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 46/53] qdev: Move base property types to qom/property-types.c Date: Thu, 12 Nov 2020 16:43:43 -0500 Message-Id: <20201112214350.872250-47-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 all property types from qdev-properties.c to qom/property-types.c. Declarations are moved from hw/qdev-properties.h to qom/property-types.h. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Redone after changes in previous patches in this series * Reordered patch, tried to put it a bit earlier in the series Changes v1 -> v2: * Rebased after changes in previous patches in the series --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 125 +------- include/qom/property-types.h | 131 +++++++++ include/qom/qom.h | 1 + hw/core/qdev-properties.c | 538 ---------------------------------- qom/property-types.c | 546 +++++++++++++++++++++++++++++++++++ qom/meson.build | 1 + 6 files changed, 680 insertions(+), 662 deletions(-) create mode 100644 include/qom/property-types.h create mode 100644 qom/property-types.c diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 6585a8e693..939b6dbf4e 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -3,130 +3,7 @@ =20 #include "hw/qdev-core.h" #include "qom/field-property.h" - -/*** qdev-properties.c ***/ - -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; - -#define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ - .name_template =3D (_name), \ - .info =3D &(_prop), \ - .offset =3D offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - __VA_ARGS__ \ - } - -#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) - -#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \ - DEFINE_PROP(_name, _state, _field, _prop, _type) - -#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, prop_info_bit, uint32_t, \ - .bitnr =3D (_bit), \ - .set_default =3D true, \ - .defval.u =3D (bool)_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) - -#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type= ) \ - DEFINE_PROP(_name, _state, _field, _prop, _type) - -#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, prop_info_bit64, uint64_t, \ - .bitnr =3D (_bit), \ - .set_default =3D true, \ - .defval.u =3D (bool)_defval) - -#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \ - DEFINE_PROP(_name, _state, _field, prop_info_bool, bool, \ - .set_default =3D true, \ - .defval.u =3D (bool)_defval) - -#define PROP_ARRAY_LEN_PREFIX "len-" - -/** - * DEFINE_PROP_ARRAY: - * @_name: name of the array - * @_state: name of the device state structure type - * @_field: uint32_t field in @_state to hold the array length - * @_arrayfield: field in @_state (of type '@_arraytype *') which - * will point to the array - * @_arrayprop: PropertyInfo defining what property the array elements have - * @_arraytype: C type of the array elements - * - * Define device properties for a variable-length array _name. A - * static property "len-arrayname" is defined. When the device creator - * sets this property to the desired length of array, further dynamic - * properties "arrayname[0]", "arrayname[1]", ... are defined so the - * device creator can set the array element values. Setting the - * "len-arrayname" property more than once is an error. - * - * When the array length is set, the @_field member of the device - * struct is set to the array length, and @_arrayfield is set to point - * to (zero-initialised) memory allocated for the array. For a zero - * length array, @_field will be set to 0 and @_arrayfield to NULL. - * It is the responsibility of the device deinit code to free the - * @_arrayfield memory. - */ -#define DEFINE_PROP_ARRAY(_name, _state, _field, \ - _arrayfield, _arrayprop, _arraytype) \ - DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \ - _state, _field, prop_info_arraylen, uint32_t, \ - .set_default =3D true, \ - .defval.u =3D 0, \ - .arrayinfo =3D &(_arrayprop), \ - .arrayfieldsize =3D sizeof(_arraytype), \ - .arrayoffset =3D offsetof(_state, _arrayfield)) - -#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ - DEFINE_PROP(_name, _state, _field, prop_info_link, _ptr_type, \ - .link_type =3D _type) - -#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ - 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, prop_info_uint16, uint16_t) -#define DEFINE_PROP_UINT32(_n, _s, _f, _d) \ - 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, prop_info_int32, int32_t) -#define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ - 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, prop_info_int64, int64_t) -#define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size, uint64_t) -#define DEFINE_PROP_STRING(_n, _s, _f) \ - 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, prop_info_on_off_auto, OnOffAuto) -#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size32, uint32_t) - -#define DEFINE_PROP_END_OF_LIST() \ - {} +#include "qom/property-types.h" =20 /* * Set properties between creation and realization. diff --git a/include/qom/property-types.h b/include/qom/property-types.h new file mode 100644 index 0000000000..0aff0d9474 --- /dev/null +++ b/include/qom/property-types.h @@ -0,0 +1,131 @@ +/* + * QOM field property types + */ +#ifndef QOM_PROPERTY_TYPES_H +#define QOM_PROPERTY_TYPES_H + +#include "qom/field-property.h" + +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; + +#define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ + .name_template =3D (_name), \ + .info =3D &(_prop), \ + .offset =3D offsetof(_state, _field) \ + + type_check(_type, typeof_field(_state, _field)), \ + __VA_ARGS__ \ + } + +#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) + +#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \ + DEFINE_PROP(_name, _state, _field, _prop, _type) + +#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ + DEFINE_PROP(_name, _state, _field, prop_info_bit, uint32_t, \ + .bitnr =3D (_bit), \ + .set_default =3D true, \ + .defval.u =3D (bool)_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) + +#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type= ) \ + DEFINE_PROP(_name, _state, _field, _prop, _type) + +#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ + DEFINE_PROP(_name, _state, _field, prop_info_bit64, uint64_t, \ + .bitnr =3D (_bit), \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval) + +#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \ + DEFINE_PROP(_name, _state, _field, prop_info_bool, bool, \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval) + +#define PROP_ARRAY_LEN_PREFIX "len-" + +/** + * DEFINE_PROP_ARRAY: + * @_name: name of the array + * @_state: name of the device state structure type + * @_field: uint32_t field in @_state to hold the array length + * @_arrayfield: field in @_state (of type '@_arraytype *') which + * will point to the array + * @_arrayprop: PropertyInfo defining what property the array elements have + * @_arraytype: C type of the array elements + * + * Define device properties for a variable-length array _name. A + * static property "len-arrayname" is defined. When the device creator + * sets this property to the desired length of array, further dynamic + * properties "arrayname[0]", "arrayname[1]", ... are defined so the + * device creator can set the array element values. Setting the + * "len-arrayname" property more than once is an error. + * + * When the array length is set, the @_field member of the device + * struct is set to the array length, and @_arrayfield is set to point + * to (zero-initialised) memory allocated for the array. For a zero + * length array, @_field will be set to 0 and @_arrayfield to NULL. + * It is the responsibility of the device deinit code to free the + * @_arrayfield memory. + */ +#define DEFINE_PROP_ARRAY(_name, _state, _field, \ + _arrayfield, _arrayprop, _arraytype) \ + DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \ + _state, _field, prop_info_arraylen, uint32_t, \ + .set_default =3D true, \ + .defval.u =3D 0, \ + .arrayinfo =3D &(_arrayprop), \ + .arrayfieldsize =3D sizeof(_arraytype), \ + .arrayoffset =3D offsetof(_state, _arrayfield)) + +#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ + DEFINE_PROP(_name, _state, _field, prop_info_link, _ptr_type, \ + .link_type =3D _type) + +#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ + 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, prop_info_uint16, uint16_t) +#define DEFINE_PROP_UINT32(_n, _s, _f, _d) \ + 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, prop_info_int32, int32_t) +#define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ + 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, prop_info_int64, int64_t) +#define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size, uint64_t) +#define DEFINE_PROP_STRING(_n, _s, _f) \ + 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, prop_info_on_off_auto, OnOffAuto) +#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size32, uint32_t) + +#define DEFINE_PROP_END_OF_LIST() \ + {} + +#endif diff --git a/include/qom/qom.h b/include/qom/qom.h index 9dbc88801d..ef37a317c3 100644 --- a/include/qom/qom.h +++ b/include/qom/qom.h @@ -9,3 +9,4 @@ #include "qom/object_interfaces.h" #include "qom/qom-qobject.h" #include "qom/field-property.h" +#include "qom/property-types.h" diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c79cb9a89b..8979c40486 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -50,497 +50,6 @@ void qdev_prop_allow_set_link_before_realize(const Obje= ct *obj, } } =20 -void field_prop_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - int *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_enum(v, name, ptr, prop->info->enum_table, errp); -} - -void field_prop_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - int *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_enum(v, name, ptr, prop->info->enum_table, errp); -} - -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)); -} - -const PropertyInfo prop_info_enum =3D { - .name =3D "enum", - .get =3D field_prop_get_enum, - .set =3D field_prop_set_enum, - .set_default_value =3D field_prop_set_default_value_enum, -}; - -/* Bit */ - -static uint32_t qdev_get_prop_mask(Property *prop) -{ - assert(prop->info =3D=3D &prop_info_bit); - return 0x1 << prop->bitnr; -} - -static void bit_prop_set(Object *obj, Property *props, bool val) -{ - uint32_t *p =3D object_field_prop_ptr(obj, props); - uint32_t mask =3D qdev_get_prop_mask(props); - if (val) { - *p |=3D mask; - } else { - *p &=3D ~mask; - } -} - -static void prop_get_bit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint32_t *p =3D object_field_prop_ptr(obj, prop); - bool value =3D (*p & qdev_get_prop_mask(prop)) !=3D 0; - - visit_type_bool(v, name, &value, errp); -} - -static void prop_set_bit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - bool value; - - if (!visit_type_bool(v, name, &value, errp)) { - return; - } - bit_prop_set(obj, prop, value); -} - -static void set_default_value_bool(ObjectProperty *op, const Property *pro= p) -{ - object_property_set_default_bool(op, prop->defval.u); -} - -const PropertyInfo prop_info_bit =3D { - .name =3D "bool", - .description =3D "on/off", - .get =3D prop_get_bit, - .set =3D prop_set_bit, - .set_default_value =3D set_default_value_bool, -}; - -/* Bit64 */ - -static uint64_t qdev_get_prop_mask64(Property *prop) -{ - assert(prop->info =3D=3D &prop_info_bit64); - return 0x1ull << prop->bitnr; -} - -static void bit64_prop_set(Object *obj, Property *props, bool val) -{ - uint64_t *p =3D object_field_prop_ptr(obj, props); - uint64_t mask =3D qdev_get_prop_mask64(props); - if (val) { - *p |=3D mask; - } else { - *p &=3D ~mask; - } -} - -static void prop_get_bit64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint64_t *p =3D object_field_prop_ptr(obj, prop); - bool value =3D (*p & qdev_get_prop_mask64(prop)) !=3D 0; - - visit_type_bool(v, name, &value, errp); -} - -static void prop_set_bit64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - bool value; - - if (!visit_type_bool(v, name, &value, errp)) { - return; - } - bit64_prop_set(obj, prop, value); -} - -const PropertyInfo prop_info_bit64 =3D { - .name =3D "bool", - .description =3D "on/off", - .get =3D prop_get_bit64, - .set =3D prop_set_bit64, - .set_default_value =3D set_default_value_bool, -}; - -/* --- bool --- */ - -static void get_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - Property *prop =3D opaque; - bool *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_bool(v, name, ptr, errp); -} - -static void set_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - Property *prop =3D opaque; - bool *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_bool(v, name, ptr, errp); -} - -const PropertyInfo prop_info_bool =3D { - .name =3D "bool", - .get =3D get_bool, - .set =3D set_bool, - .set_default_value =3D set_default_value_bool, -}; - -/* --- 8bit integer --- */ - -static void get_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) -{ - Property *prop =3D opaque; - uint8_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint8(v, name, ptr, errp); -} - -static void set_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) -{ - Property *prop =3D opaque; - uint8_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint8(v, name, ptr, errp); -} - -void field_prop_set_default_value_int(ObjectProperty *op, - const Property *prop) -{ - object_property_set_default_int(op, prop->defval.i); -} - -void field_prop_set_default_value_uint(ObjectProperty *op, - const Property *prop) -{ - object_property_set_default_uint(op, prop->defval.u); -} - -const PropertyInfo prop_info_uint8 =3D { - .name =3D "uint8", - .get =3D get_uint8, - .set =3D set_uint8, - .set_default_value =3D field_prop_set_default_value_uint, -}; - -/* --- 16bit integer --- */ - -static void get_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint16_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint16(v, name, ptr, errp); -} - -static void set_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint16_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint16(v, name, ptr, errp); -} - -const PropertyInfo prop_info_uint16 =3D { - .name =3D "uint16", - .get =3D get_uint16, - .set =3D set_uint16, - .set_default_value =3D field_prop_set_default_value_uint, -}; - -/* --- 32bit integer --- */ - -static void get_uint32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint32_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint32(v, name, ptr, errp); -} - -static void set_uint32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint32_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint32(v, name, ptr, 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 object_field_prop_ptr(obj, prop); - - visit_type_int32(v, name, ptr, errp); -} - -static void set_int32(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) -{ - Property *prop =3D opaque; - int32_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_int32(v, name, ptr, errp); -} - -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, -}; - -const PropertyInfo prop_info_int32 =3D { - .name =3D "int32", - .get =3D field_prop_get_int32, - .set =3D set_int32, - .set_default_value =3D field_prop_set_default_value_int, -}; - -/* --- 64bit integer --- */ - -static void get_uint64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint64_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint64(v, name, ptr, errp); -} - -static void set_uint64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint64_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_uint64(v, name, ptr, errp); -} - -static void get_int64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - int64_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_int64(v, name, ptr, errp); -} - -static void set_int64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - int64_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_int64(v, name, ptr, errp); -} - -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, -}; - -const PropertyInfo prop_info_int64 =3D { - .name =3D "int64", - .get =3D get_int64, - .set =3D set_int64, - .set_default_value =3D field_prop_set_default_value_int, -}; - -/* --- string --- */ - -static void release_string(Object *obj, const char *name, void *opaque) -{ - Property *prop =3D opaque; - g_free(*(char **)object_field_prop_ptr(obj, prop)); -} - -static void get_string(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - char **ptr =3D object_field_prop_ptr(obj, prop); - - if (!*ptr) { - char *str =3D (char *)""; - visit_type_str(v, name, &str, errp); - } else { - visit_type_str(v, name, ptr, errp); - } -} - -static void set_string(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - char **ptr =3D object_field_prop_ptr(obj, prop); - char *str; - - if (!visit_type_str(v, name, &str, errp)) { - return; - } - g_free(*ptr); - *ptr =3D str; -} - -const PropertyInfo prop_info_string =3D { - .name =3D "str", - .release =3D release_string, - .get =3D get_string, - .set =3D set_string, -}; - -/* --- on/off/auto --- */ - -const PropertyInfo prop_info_on_off_auto =3D { - .name =3D "OnOffAuto", - .description =3D "on/off/auto", - .enum_table =3D &OnOffAuto_lookup, - .get =3D field_prop_get_enum, - .set =3D field_prop_set_enum, - .set_default_value =3D field_prop_set_default_value_enum, -}; - -/* --- 32bit unsigned int 'size' type --- */ - -void field_prop_get_size32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - Property *prop =3D opaque; - uint32_t *ptr =3D object_field_prop_ptr(obj, prop); - uint64_t value =3D *ptr; - - visit_type_size(v, name, &value, errp); -} - -static void set_size32(Object *obj, Visitor *v, const char *name, void *op= aque, - Error **errp) -{ - Property *prop =3D opaque; - uint32_t *ptr =3D object_field_prop_ptr(obj, prop); - uint64_t value; - - if (!visit_type_size(v, name, &value, errp)) { - return; - } - - if (value > UINT32_MAX) { - error_setg(errp, - "Property %s.%s doesn't take value %" PRIu64 - " (maximum: %u)", - object_get_typename(obj), name, value, UINT32_MAX); - return; - } - - *ptr =3D value; -} - -const PropertyInfo prop_info_size32 =3D { - .name =3D "size", - .get =3D field_prop_get_size32, - .set =3D set_size32, - .set_default_value =3D field_prop_set_default_value_uint, -}; - -/* --- support for array properties --- */ - -static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - /* Setter for the property which defines the length of a - * variable-sized property array. As well as actually setting the - * array-length field in the device struct, we have to create the - * array itself and dynamically add the corresponding properties. - */ - Property *prop =3D opaque; - ObjectProperty *op =3D object_property_find_err(obj, name, &error_abor= t); - uint32_t *alenptr =3D object_field_prop_ptr(obj, prop); - void **arrayptr =3D (void *)obj + prop->arrayoffset; - void *eltptr; - const char *arrayname; - int i; - - if (*alenptr) { - error_setg(errp, "array size property %s may not be set more than = once", - name); - return; - } - if (!visit_type_uint32(v, name, alenptr, errp)) { - return; - } - if (!*alenptr) { - return; - } - - /* DEFINE_PROP_ARRAY guarantees that name should start with this prefi= x; - * strip it off so we can get the name of the array itself. - */ - assert(strncmp(name, PROP_ARRAY_LEN_PREFIX, - strlen(PROP_ARRAY_LEN_PREFIX)) =3D=3D 0); - arrayname =3D name + strlen(PROP_ARRAY_LEN_PREFIX); - - /* Note that it is the responsibility of the individual device's deinit - * to free the array proper. - */ - *arrayptr =3D eltptr =3D g_malloc0(*alenptr * prop->arrayfieldsize); - for (i =3D 0; i < *alenptr; i++, eltptr +=3D prop->arrayfieldsize) { - g_autofree char *propname =3D g_strdup_printf("%s[%d]", arrayname,= i); - Property arrayprop =3D { }; - arrayprop.info =3D prop->arrayinfo; - /* This ugly piece of pointer arithmetic sets up the offset so - * that when the underlying get/set hooks call qdev_get_prop_ptr - * they get the right answer despite the array element not actually - * being inside the device struct. - */ - arrayprop.offset =3D eltptr - (void *)obj; - assert(object_field_prop_ptr(obj, &arrayprop) =3D=3D eltptr); - object_property_add_field(obj, propname, &arrayprop, - op->allow_set); - } -} - -const PropertyInfo prop_info_arraylen =3D { - .name =3D "uint32", - .get =3D get_uint32, - .set =3D set_prop_arraylen, - .set_default_value =3D field_prop_set_default_value_uint, -}; - /* --- public helpers --- */ =20 static Property *qdev_prop_walk(Property *props, const char *name) @@ -713,53 +222,6 @@ void qdev_prop_set_globals(DeviceState *dev) dev->hotplugged ? NULL : &error_fatal); } =20 -/* --- 64bit unsigned int 'size' type --- */ - -static void get_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - Property *prop =3D opaque; - uint64_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_size(v, name, ptr, errp); -} - -static void set_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - Property *prop =3D opaque; - uint64_t *ptr =3D object_field_prop_ptr(obj, prop); - - visit_type_size(v, name, ptr, errp); -} - -const PropertyInfo prop_info_size =3D { - .name =3D "size", - .get =3D get_size, - .set =3D set_size, - .set_default_value =3D field_prop_set_default_value_uint, -}; - -/* --- object link property --- */ - -static ObjectProperty *create_link_property(ObjectClass *oc, const char *n= ame, - Property *prop) -{ - /* - * NOTE: object_property_allow_set_link is unconditional, but - * ObjectProperty.allow_set may be set for the property too. - */ - return object_class_property_add_link(oc, name, prop->link_type, - prop->offset, - object_property_allow_set_link, - OBJ_PROP_LINK_STRONG); -} - -const PropertyInfo prop_info_link =3D { - .name =3D "link", - .create =3D create_link_property, -}; - void qdev_property_add_static(DeviceState *dev, Property *prop) { object_property_add_field(OBJECT(dev), prop->name_template, prop, diff --git a/qom/property-types.c b/qom/property-types.c new file mode 100644 index 0000000000..4b3fe15b6a --- /dev/null +++ b/qom/property-types.c @@ -0,0 +1,546 @@ +#include "qemu/osdep.h" +#include "qom/field-property.h" +#include "qom/property-types.h" +#include "qom/field-property-internal.h" +#include "qapi/qapi-types-common.h" +#include "qapi/visitor.h" +#include "qapi/error.h" +#include "qemu/uuid.h" + +void field_prop_get_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + int *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_enum(v, name, ptr, prop->info->enum_table, errp); +} + +void field_prop_set_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + int *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_enum(v, name, ptr, prop->info->enum_table, errp); +} + +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)); +} + +const PropertyInfo prop_info_enum =3D { + .name =3D "enum", + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, +}; + +/* Bit */ + +static uint32_t qdev_get_prop_mask(Property *prop) +{ + assert(prop->info =3D=3D &prop_info_bit); + return 0x1 << prop->bitnr; +} + +static void bit_prop_set(Object *obj, Property *props, bool val) +{ + uint32_t *p =3D object_field_prop_ptr(obj, props); + uint32_t mask =3D qdev_get_prop_mask(props); + if (val) { + *p |=3D mask; + } else { + *p &=3D ~mask; + } +} + +static void prop_get_bit(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint32_t *p =3D object_field_prop_ptr(obj, prop); + bool value =3D (*p & qdev_get_prop_mask(prop)) !=3D 0; + + visit_type_bool(v, name, &value, errp); +} + +static void prop_set_bit(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + bool value; + + if (!visit_type_bool(v, name, &value, errp)) { + return; + } + bit_prop_set(obj, prop, value); +} + +static void set_default_value_bool(ObjectProperty *op, const Property *pro= p) +{ + object_property_set_default_bool(op, prop->defval.u); +} + +const PropertyInfo prop_info_bit =3D { + .name =3D "bool", + .description =3D "on/off", + .get =3D prop_get_bit, + .set =3D prop_set_bit, + .set_default_value =3D set_default_value_bool, +}; + +/* Bit64 */ + +static uint64_t qdev_get_prop_mask64(Property *prop) +{ + assert(prop->info =3D=3D &prop_info_bit64); + return 0x1ull << prop->bitnr; +} + +static void bit64_prop_set(Object *obj, Property *props, bool val) +{ + uint64_t *p =3D object_field_prop_ptr(obj, props); + uint64_t mask =3D qdev_get_prop_mask64(props); + if (val) { + *p |=3D mask; + } else { + *p &=3D ~mask; + } +} + +static void prop_get_bit64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint64_t *p =3D object_field_prop_ptr(obj, prop); + bool value =3D (*p & qdev_get_prop_mask64(prop)) !=3D 0; + + visit_type_bool(v, name, &value, errp); +} + +static void prop_set_bit64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + bool value; + + if (!visit_type_bool(v, name, &value, errp)) { + return; + } + bit64_prop_set(obj, prop, value); +} + +const PropertyInfo prop_info_bit64 =3D { + .name =3D "bool", + .description =3D "on/off", + .get =3D prop_get_bit64, + .set =3D prop_set_bit64, + .set_default_value =3D set_default_value_bool, +}; + +/* --- bool --- */ + +static void get_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, + Error **errp) +{ + Property *prop =3D opaque; + bool *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_bool(v, name, ptr, errp); +} + +static void set_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, + Error **errp) +{ + Property *prop =3D opaque; + bool *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_bool(v, name, ptr, errp); +} + +const PropertyInfo prop_info_bool =3D { + .name =3D "bool", + .get =3D get_bool, + .set =3D set_bool, + .set_default_value =3D set_default_value_bool, +}; + +/* --- 8bit integer --- */ + +static void get_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, + Error **errp) +{ + Property *prop =3D opaque; + uint8_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint8(v, name, ptr, errp); +} + +static void set_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, + Error **errp) +{ + Property *prop =3D opaque; + uint8_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint8(v, name, ptr, errp); +} + +void field_prop_set_default_value_int(ObjectProperty *op, + const Property *prop) +{ + object_property_set_default_int(op, prop->defval.i); +} + +void field_prop_set_default_value_uint(ObjectProperty *op, + const Property *prop) +{ + object_property_set_default_uint(op, prop->defval.u); +} + +const PropertyInfo prop_info_uint8 =3D { + .name =3D "uint8", + .get =3D get_uint8, + .set =3D set_uint8, + .set_default_value =3D field_prop_set_default_value_uint, +}; + +/* --- 16bit integer --- */ + +static void get_uint16(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint16_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint16(v, name, ptr, errp); +} + +static void set_uint16(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint16_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint16(v, name, ptr, errp); +} + +const PropertyInfo prop_info_uint16 =3D { + .name =3D "uint16", + .get =3D get_uint16, + .set =3D set_uint16, + .set_default_value =3D field_prop_set_default_value_uint, +}; + +/* --- 32bit integer --- */ + +static void get_uint32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint32(v, name, ptr, errp); +} + +static void set_uint32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint32(v, name, ptr, 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 object_field_prop_ptr(obj, prop); + + visit_type_int32(v, name, ptr, errp); +} + +static void set_int32(Object *obj, Visitor *v, const char *name, void *opa= que, + Error **errp) +{ + Property *prop =3D opaque; + int32_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_int32(v, name, ptr, errp); +} + +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, +}; + +const PropertyInfo prop_info_int32 =3D { + .name =3D "int32", + .get =3D field_prop_get_int32, + .set =3D set_int32, + .set_default_value =3D field_prop_set_default_value_int, +}; + +/* --- 64bit integer --- */ + +static void get_uint64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint64(v, name, ptr, errp); +} + +static void set_uint64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_uint64(v, name, ptr, errp); +} + +static void get_int64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + int64_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_int64(v, name, ptr, errp); +} + +static void set_int64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + int64_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_int64(v, name, ptr, errp); +} + +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, +}; + +const PropertyInfo prop_info_int64 =3D { + .name =3D "int64", + .get =3D get_int64, + .set =3D set_int64, + .set_default_value =3D field_prop_set_default_value_int, +}; + +/* --- string --- */ + +static void release_string(Object *obj, const char *name, void *opaque) +{ + Property *prop =3D opaque; + g_free(*(char **)object_field_prop_ptr(obj, prop)); +} + +static void get_string(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + char **ptr =3D object_field_prop_ptr(obj, prop); + + if (!*ptr) { + char *str =3D (char *)""; + visit_type_str(v, name, &str, errp); + } else { + visit_type_str(v, name, ptr, errp); + } +} + +static void set_string(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + char **ptr =3D object_field_prop_ptr(obj, prop); + char *str; + + if (!visit_type_str(v, name, &str, errp)) { + return; + } + g_free(*ptr); + *ptr =3D str; +} + +const PropertyInfo prop_info_string =3D { + .name =3D "str", + .release =3D release_string, + .get =3D get_string, + .set =3D set_string, +}; + +/* --- on/off/auto --- */ + +const PropertyInfo prop_info_on_off_auto =3D { + .name =3D "OnOffAuto", + .description =3D "on/off/auto", + .enum_table =3D &OnOffAuto_lookup, + .get =3D field_prop_get_enum, + .set =3D field_prop_set_enum, + .set_default_value =3D field_prop_set_default_value_enum, +}; + +/* --- 32bit unsigned int 'size' type --- */ + +void field_prop_get_size32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); + uint64_t value =3D *ptr; + + visit_type_size(v, name, &value, errp); +} + +static void set_size32(Object *obj, Visitor *v, const char *name, void *op= aque, + Error **errp) +{ + Property *prop =3D opaque; + uint32_t *ptr =3D object_field_prop_ptr(obj, prop); + uint64_t value; + + if (!visit_type_size(v, name, &value, errp)) { + return; + } + + if (value > UINT32_MAX) { + error_setg(errp, + "Property %s.%s doesn't take value %" PRIu64 + " (maximum: %u)", + object_get_typename(obj), name, value, UINT32_MAX); + return; + } + + *ptr =3D value; +} + +const PropertyInfo prop_info_size32 =3D { + .name =3D "size", + .get =3D field_prop_get_size32, + .set =3D set_size32, + .set_default_value =3D field_prop_set_default_value_uint, +}; + +/* --- support for array properties --- */ + +static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + /* Setter for the property which defines the length of a + * variable-sized property array. As well as actually setting the + * array-length field in the device struct, we have to create the + * array itself and dynamically add the corresponding properties. + */ + Property *prop =3D opaque; + ObjectProperty *op =3D object_property_find_err(obj, name, &error_abor= t); + uint32_t *alenptr =3D object_field_prop_ptr(obj, prop); + void **arrayptr =3D (void *)obj + prop->arrayoffset; + void *eltptr; + const char *arrayname; + int i; + + if (*alenptr) { + error_setg(errp, "array size property %s may not be set more than = once", + name); + return; + } + if (!visit_type_uint32(v, name, alenptr, errp)) { + return; + } + if (!*alenptr) { + return; + } + + /* DEFINE_PROP_ARRAY guarantees that name should start with this prefi= x; + * strip it off so we can get the name of the array itself. + */ + assert(strncmp(name, PROP_ARRAY_LEN_PREFIX, + strlen(PROP_ARRAY_LEN_PREFIX)) =3D=3D 0); + arrayname =3D name + strlen(PROP_ARRAY_LEN_PREFIX); + + /* Note that it is the responsibility of the individual device's deinit + * to free the array proper. + */ + *arrayptr =3D eltptr =3D g_malloc0(*alenptr * prop->arrayfieldsize); + for (i =3D 0; i < *alenptr; i++, eltptr +=3D prop->arrayfieldsize) { + g_autofree char *propname =3D g_strdup_printf("%s[%d]", arrayname,= i); + Property arrayprop =3D { }; + arrayprop.info =3D prop->arrayinfo; + /* This ugly piece of pointer arithmetic sets up the offset so + * that when the underlying get/set hooks call qdev_get_prop_ptr + * they get the right answer despite the array element not actually + * being inside the device struct. + */ + arrayprop.offset =3D eltptr - (void *)obj; + assert(object_field_prop_ptr(obj, &arrayprop) =3D=3D eltptr); + object_property_add_field(obj, propname, &arrayprop, + op->allow_set); + } +} + +const PropertyInfo prop_info_arraylen =3D { + .name =3D "uint32", + .get =3D get_uint32, + .set =3D set_prop_arraylen, + .set_default_value =3D field_prop_set_default_value_uint, +}; + +/* --- 64bit unsigned int 'size' type --- */ + +static void get_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, + Error **errp) +{ + Property *prop =3D opaque; + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_size(v, name, ptr, errp); +} + +static void set_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, + Error **errp) +{ + Property *prop =3D opaque; + uint64_t *ptr =3D object_field_prop_ptr(obj, prop); + + visit_type_size(v, name, ptr, errp); +} + +const PropertyInfo prop_info_size =3D { + .name =3D "size", + .get =3D get_size, + .set =3D set_size, + .set_default_value =3D field_prop_set_default_value_uint, +}; + +/* --- object link property --- */ + +static ObjectProperty *create_link_property(ObjectClass *oc, const char *n= ame, + Property *prop) +{ + /* + * NOTE: object_property_allow_set_link is unconditional, but + * ObjectProperty.allow_set may be set for the property too. + */ + return object_class_property_add_link(oc, name, prop->link_type, + prop->offset, + object_property_allow_set_link, + OBJ_PROP_LINK_STRONG); +} + +const PropertyInfo prop_info_link =3D { + .name =3D "link", + .create =3D create_link_property, +}; diff --git a/qom/meson.build b/qom/meson.build index e83794454d..7fdfd6fe7b 100644 --- a/qom/meson.build +++ b/qom/meson.build @@ -5,6 +5,7 @@ qom_ss.add(files( 'object_interfaces.c', 'qom-qobject.c', 'field-property.c', + 'property-types.c', )) =20 qmp_ss.add(files('qom-qmp-cmds.c')) --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219644; cv=none; d=zohomail.com; s=zohoarc; b=P7/9jmZHlRrpsxVuJKKsrGfXCUTTk6VysQ5U3XlcxfVQHbrt9SlizYU+fl/FGciljJcTQEI2uEdOly3qhgVYSZKd3/oDeSIQBrOhqO/Zwe0U+rUEQDkgX6ZJNPDNS5aJWTWUm4dM9A4WRI1SYoS9/yPO088oR17syy/f8rQO7q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219644; 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=VQz84vMvQIIjiq4ifmE0IMvZDS24LI1ngCKhfV5ooUA=; b=cO7kU9F6I0+PsZKWgeg+SESUHCCvzDrtB3qq95ck69DzApnN8HMuO6WClHu+5fwJWTgBqigj8IpDcy44ST/pBIzx20+wc3F+4KVgRR1X/Su3aHomr2HVRg9ejuQNQVGrwNLg9iiQw226VlauAhHA3qmEU7McXYoCLkZ+8bZwnGY= 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 1605219644559886.2586309853954; Thu, 12 Nov 2020 14:20:44 -0800 (PST) Received: from localhost ([::1]:36048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKxP-0004rp-Ep for importer@patchew.org; Thu, 12 Nov 2020 17:20:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKR8-0008NZ-9u for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:22 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40499) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKR1-0003kW-NS for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:21 -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-107-JlNz9ZXtPx6KH2P1xpe6uQ-1; Thu, 12 Nov 2020 16:47:13 -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 0A17C107464A; Thu, 12 Nov 2020 21:47:12 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CAAE5C1C2; Thu, 12 Nov 2020 21:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217635; 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=VQz84vMvQIIjiq4ifmE0IMvZDS24LI1ngCKhfV5ooUA=; b=hmmIEG+F1GXaM3BuAaueVImAyoSmEJ0WKG0m5lMXQxWBW8hmL9BJ+w9fi60B8BtyTxa23y GqeUojPN4vt5P5cGItff4KeyarAZ50lD1RObnxqEIoagKW992ED3Zv1gHSxbPqLNxv9ca7 ism/4l9+CgsVK1FXwxrBbCm5fQGJJnI= X-MC-Unique: JlNz9ZXtPx6KH2P1xpe6uQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 47/53] qom: Include static property API reference in documentation Date: Thu, 12 Nov 2020 16:43:44 -0500 Message-Id: <20201112214350.872250-48-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Include the static-properties.h API reference in docs/devel/qom.rst. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Redone patch after changes in previous patches in the series * Split into separate patches. This one only adds the file to qom.rst and Property/PropertyInfo doc comments. Another patch will add the documentation for DEFINE_PROP_* and PROP_*. Changes v1 -> v2: * Redone patch after changes in previous patches in the series --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- docs/devel/qom.rst | 17 +++++++++++++- include/qom/field-property.h | 45 ++++++++++++++++++++++++++++++------ include/qom/property-types.h | 2 +- 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index 42d0dc4f4d..9e43aa46f2 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -376,6 +376,21 @@ the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used in= stead: =20 =20 API Reference -------------- +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Core QOM API Reference +---------------------- =20 .. kernel-doc:: include/qom/object.h + + +Field Property API Reference +---------------------------- + +.. kernel-doc:: include/qom/field-property.h + + +Property Types Reference +------------------------ + +.. kernel-doc:: include/qom/property-types.h diff --git a/include/qom/field-property.h b/include/qom/field-property.h index 91e7a43165..419e5eef75 100644 --- a/include/qom/field-property.h +++ b/include/qom/field-property.h @@ -8,15 +8,14 @@ #include "qapi/util.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: definition of a field property + * + * Field properties are used to read and write fields in object + * instance structs. Field properties are defined using + * ``PROP_`` or ``DEFINE_PROP_``. */ struct Property { + /* private: */ /** * @name_template: Property name template * @@ -28,27 +27,59 @@ struct Property { const PropertyInfo *info; ptrdiff_t offset; uint8_t bitnr; + /** + * @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_i= nit). + */ bool set_default; + /** + * @defval: default value for the property. This is used only if @set_= default + * is true. + */ union { int64_t i; uint64_t u; } defval; + /* private: */ int arrayoffset; const PropertyInfo *arrayinfo; int arrayfieldsize; const char *link_type; }; =20 +/** + * struct PropertyInfo: information on a specific QOM property type + */ struct PropertyInfo { + /** @name: property type name */ const char *name; + /** @description: Description for help text */ const char *description; + /** @enum_table: Used by field_prop_get_enum() and field_prop_set_enum= () */ const QEnumLookup *enum_table; + /** @print: String formatting function, for the human monitor */ int (*print)(Object *obj, Property *prop, char *dest, size_t len); + /** @set_default_value: Callback for initializing the default value */ void (*set_default_value)(ObjectProperty *op, const Property *prop); + /** @create: Optional callback for creation of property */ ObjectProperty *(*create)(ObjectClass *oc, const char *name, Property *prop); + /** + * @get: Property getter. The opaque parameter will point to + * the &Property struct for the property. + */ ObjectPropertyAccessor *get; + /** + * @set: Property setter. The opaque parameter will point to + * the &Property struct for the property. + */ ObjectPropertyAccessor *set; + /** + * @release: Optional release function, called when the object + * is destroyed + */ ObjectPropertyRelease *release; }; =20 diff --git a/include/qom/property-types.h b/include/qom/property-types.h index 0aff0d9474..46c82da4e3 100644 --- a/include/qom/property-types.h +++ b/include/qom/property-types.h @@ -71,7 +71,7 @@ extern const PropertyInfo prop_info_link; * @_name: name of the array * @_state: name of the device state structure type * @_field: uint32_t field in @_state to hold the array length - * @_arrayfield: field in @_state (of type '@_arraytype *') which + * @_arrayfield: field in @_state (of type ``_arraytype *``) which * will point to the array * @_arrayprop: PropertyInfo defining what property the array elements have * @_arraytype: C type of the array elements --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605218871; cv=none; d=zohomail.com; s=zohoarc; b=akGqlKTgg1YN5GPuYr9C21tIbSj5Yh/zLRWzi+DuiN8ME4Lm3B1RjIkoUtOjrbLn/KY4ljOQX+Ad/qnJpg739BKIDiliXZIKxVfEyyi1tkfdy+6DPUC5K3viVXQRdL24DS3TfbsAMxFl1sltQD50aGef76hmbdUGmDu/wLi13ss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605218871; 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=Jr2c+hFD8dhsPQVQpHdxJpajRfP2ukTaXihihYrX088=; b=kp3ho+99/8048leWsjyGRklPkvGIU1SJ+m53114X7Wum6PwtopAdvlA++ISaT9tWkoZkFY+4qvu73vOgWuf+cGi2HtvfWLj5NEekAFB7x08WQu1n6FJUZFj/bLBahSkMncOXkCW8Pr42xqT/p54o2vJRs20m+7ciURWePJzsZuY= 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 16052188716701023.1404225463485; Thu, 12 Nov 2020 14:07:51 -0800 (PST) Received: from localhost ([::1]:32950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKkw-0008H0-HK for importer@patchew.org; Thu, 12 Nov 2020 17:07:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKR9-0008QW-UC for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKR7-0003lp-S6 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:23 -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-589-UNppuZPkMRWCgPqYSAXcUw-1; Thu, 12 Nov 2020 16:47:17 -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 BA9461006CBB; Thu, 12 Nov 2020 21:47:16 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4548860C13; Thu, 12 Nov 2020 21:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217639; 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=Jr2c+hFD8dhsPQVQpHdxJpajRfP2ukTaXihihYrX088=; b=c2n/MnZ4WtpNpjIo4z3S2Vdt4bZ7WsPQR5vb0TIN5Ab1JngrPIcrSbCngPYoPUp6Jnrq6Z Kq+DEHwZwxGxVhYWzaxW+xdRPskVl+N5m0X5HF3Ictm4K2sVFobIOk0KCygWEEOLG1P7R5 hZ1PiETAR7CzdxxpCpNAZzU6FmKbiFY= X-MC-Unique: UNppuZPkMRWCgPqYSAXcUw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 48/53] qom: object_class_property_add_field() function Date: Thu, 12 Nov 2020 16:43:45 -0500 Message-Id: <20201112214350.872250-49-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It is similar to object_class_property_add_field_static(), but gets a copy of a Property struct so we don't need static variables. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of this series, but v2 had a object_class_property_add_field() function too. This version of object_class_property_add_field() is slightly different from the one in v2, as it gets a copy of the Property struct (so it won't require static variables anymore). --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/qom/field-property.h | 23 +++++++++++++++++++++++ qom/field-property.c | 14 ++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/include/qom/field-property.h b/include/qom/field-property.h index 419e5eef75..a904f98609 100644 --- a/include/qom/field-property.h +++ b/include/qom/field-property.h @@ -83,6 +83,29 @@ struct PropertyInfo { ObjectPropertyRelease *release; }; =20 +/** + * object_class_property_add_field: Add a field property to object class + * @oc: object class + * @name: property name + * @prop: property definition + * @allow_set: check function called when property is set + * + * 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. + * + * Note that data pointed by @prop (like strings or pointers to + * other structs) are not copied and must have static life time. + * + * @allow_set should not be NULL. If the property can always be + * set, `prop_allow_set_always` can be used. If the property can + * never be set, `prop_allow_set_never` can be used. + */ +ObjectProperty * +object_class_property_add_field(ObjectClass *oc, const char *name, + Property prop, + ObjectPropertyAllowSet allow_set); + void *object_field_prop_ptr(Object *obj, Property *prop); =20 #endif diff --git a/qom/field-property.c b/qom/field-property.c index 1fd11f2ad3..cb729626ce 100644 --- a/qom/field-property.c +++ b/qom/field-property.c @@ -125,6 +125,20 @@ object_class_property_add_field_static(ObjectClass *oc= , const char *name, return op; } =20 +ObjectProperty * +object_class_property_add_field(ObjectClass *oc, const char *name, + Property prop, + ObjectPropertyAllowSet allow_set) +{ + /* + * QOM classes and class properties are never deallocated, so we don't + * have a corresponding release function that will free newprop. + */ + Property *newprop =3D g_new0(Property, 1); + *newprop =3D prop; + return object_class_property_add_field_static(oc, name, newprop, allow= _set); +} + void object_class_add_field_properties(ObjectClass *oc, Property *props, ObjectPropertyAllowSet allow_set) { --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605219781; cv=none; d=zohomail.com; s=zohoarc; b=XXBwr9h+55fBrmBem1L/hS45WXawo2lpHTTlerZ1fD9yjTyRPSDCIEVtM5GeHZYUcFinj30cpR/JXdT3Dn6ibY3uBiRBvl/0gX2vNVdJR/d0P+gckBTEIbLhw9+B6EXiP1HnSrSuRqcojWzv54KzrEtj4ZwnZhEva+ZxyCntS9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605219781; 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=0515GEVNq/EtBK0e9C2VJclhRHGVHipxK5dgMOIhNoA=; b=K3zrOrauSIColh7i0QGvEvgl47ZF65fezr777hNNRk+Y7RFtD0AD7TjEUz/dfs6urFcxYqii4dK9R1QuxteItPCiDRsxi0DkoVRBsJBuUn/myVdhruwuB4bZyHjnSYwR3xS5PWCTqWO2kwb+nTJkqFC/4tN4UpGoc7A5QnXVN0Q= 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 1605219781381232.5150965188559; Thu, 12 Nov 2020 14:23:01 -0800 (PST) Received: from localhost ([::1]:42392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdKzc-0007cL-8x for importer@patchew.org; Thu, 12 Nov 2020 17:23:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKRE-00006u-5e for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKRC-0003nG-82 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:27 -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-105-pc4ua6X1MwymxfChUOHSTQ-1; Thu, 12 Nov 2020 16:47:19 -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 63854805EF7; Thu, 12 Nov 2020 21:47:18 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1E2910016DA; Thu, 12 Nov 2020 21:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217645; 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=0515GEVNq/EtBK0e9C2VJclhRHGVHipxK5dgMOIhNoA=; b=GTzhHUISiwApRCgcH2eA4lV9ZElN2sZRxedQIIZaQaf4q4wrCBEBolJvdzWF84WwcEYjCf V1u16Gx6NuLMMCJkW3DLemDI5XgYWRy6daFLh1g+ewc9B2x0G3vfJgSOxX5GSXDB8034qM DkRNhHg97swQdYqO9Ruk4ard2cDi4go= X-MC-Unique: pc4ua6X1MwymxfChUOHSTQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 49/53] qom: FIELD_PROP macro Date: Thu, 12 Nov 2020 16:43:46 -0500 Message-Id: <20201112214350.872250-50-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 FIELD_PROP macro can be used to define a Property struct when initializing static variables, or as a function parameter (e.g. as a paramter to object_class_property_add_field()). The qdev-specific DEFINE_PROP macro can be defined using the new macro. The only difference is that DEFINE_PROP gets the property name as the first argument. 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 --- include/qom/field-property.h | 17 +++++++++++++++++ include/qom/property-types.h | 26 +++++++++++++++++++------- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/include/qom/field-property.h b/include/qom/field-property.h index a904f98609..0cb1fe2217 100644 --- a/include/qom/field-property.h +++ b/include/qom/field-property.h @@ -108,4 +108,21 @@ object_class_property_add_field(ObjectClass *oc, const= char *name, =20 void *object_field_prop_ptr(Object *obj, Property *prop); =20 +/** + * FIELD_PROP: Expands to a compound literal for a #Property struct + * + * @_state: name of the object state structure type + * @_field: name of field in @_state + * @_prop: name of #PropertyInfo variable with type information + * @_type: expected type of field @_field in struct @_state + * @...: additional initializers for #Property struct fields + */ +#define FIELD_PROP(_state, _field, _prop, _type, ...) \ + (Property) { \ + .info =3D &(_prop), \ + .offset =3D offsetof(_state, _field) \ + + type_check(_type, typeof_field(_state, _field)), \ + __VA_ARGS__ \ + } + #endif diff --git a/include/qom/property-types.h b/include/qom/property-types.h index 46c82da4e3..62551c77e0 100644 --- a/include/qom/property-types.h +++ b/include/qom/property-types.h @@ -23,13 +23,25 @@ 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_template =3D (_name), \ - .info =3D &(_prop), \ - .offset =3D offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - __VA_ARGS__ \ - } +/** + * DEFINE_PROP: Define a #Property struct, including a property name + * + * @_name: name of the property + * @_state: name of the object state structure type + * @_field: name of field in @_state + * @_prop: name of #PropertyInfo variable with type information + * @_type: expected type of field @_field in struct @_state + * @...: additional initializers for #Property struct fields + * + * `DEFINE_PROP` or other ``DEFINE_PROP_*`` macros are normally + * used when initialiing static const #Property arrays, to be + * used with object_class_add_field_properties() or + * device_class_set_props(). + */ +#define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) \ + FIELD_PROP(_state, _field, _prop, _type, \ + .name_template =3D (_name), \ + __VA_ARGS__) =20 #define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) \ DEFINE_PROP(_name, _state, _field, _prop, _type, \ --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605220352; cv=none; d=zohomail.com; s=zohoarc; b=CdKtmbetO6z+3e+R+1Q/+t/OKIndMd9uD4j4FmSWwf9ds68sqOP6KenoQOeQq0cDAnzXZy+YKOGHgGFckIUq/LaVp1LOXQPF9BD2W5AgrZdxmSn8d+ZPGz39YofQHDZy538ORX1OD8j+0MDYWDLzTjOAkn4t8bnmAHCrfJQDUns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605220352; 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=ZjrEp/03Ea7DJhLoDY4D+Ygo5iZLhvkFFezlkMhPFMs=; b=b053YibX84LhAeDL99qnN94NSNLR9Hi/koSphSC5ORPcp4n+YldJ/mTFr8UsMioH1FMOI99l4njtJ62SfTOQS4ev9myvGpM1LllkeedDlxZKH1KbkKpMXFLTweu44Wa/84fx7JNzhh+qvvllEb+Bb1woWk36JHd9Ti+++F613Cw= 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 1605220352677349.7523649847717; Thu, 12 Nov 2020 14:32:32 -0800 (PST) Received: from localhost ([::1]:34362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdL8p-0000Oe-H1 for importer@patchew.org; Thu, 12 Nov 2020 17:32:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKRG-00009z-74 for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKRE-0003nW-Ar for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:29 -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-153--KODvs5fPoCOwqkmsgaXKw-1; Thu, 12 Nov 2020 16:47:23 -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 960FC1074643; Thu, 12 Nov 2020 21:47:22 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10F1E60C13; Thu, 12 Nov 2020 21:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217647; 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=ZjrEp/03Ea7DJhLoDY4D+Ygo5iZLhvkFFezlkMhPFMs=; b=OXMqNoFYNAj0uNWCQA+oUGPTq9+Sev2238xQo/trJlKyfkBKDXv6V0CgMSmFFsPVXciR7e Tito212AqSy4YteZOhRKDnLiDrLA95QOg/WE2atwqkFM2cmdKmVXbFTxhb+bA7qdAbnjJa t2zG0V/eovI71tmB+qdBNXh3+X2+NQQ= X-MC-Unique: -KODvs5fPoCOwqkmsgaXKw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 50/53] qom: Delete DEFINE_PROP_*SIGNED_NODEFAULT macro Date: Thu, 12 Nov 2020 16:43:47 -0500 Message-Id: <20201112214350.872250-51-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , Peter Maydell , "Daniel P. Berrange" , John Snow , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Alex Williamson , qemu-arm@nongnu.org, Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Those macros are exactly the same as DEFINE_PROP, we can use DEFINE_PROP directly. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of this series. --- Cc: Alex Williamson Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: Peter Maydell Cc: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org --- include/qom/property-types.h | 6 ------ hw/vfio/pci.c | 6 +++--- target/arm/cpu.c | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/include/qom/property-types.h b/include/qom/property-types.h index 62551c77e0..91b166badf 100644 --- a/include/qom/property-types.h +++ b/include/qom/property-types.h @@ -48,9 +48,6 @@ extern const PropertyInfo prop_info_link; .set_default =3D true, = \ .defval.i =3D (_type)_defval) =20 -#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \ - DEFINE_PROP(_name, _state, _field, _prop, _type) - #define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ DEFINE_PROP(_name, _state, _field, prop_info_bit, uint32_t, \ .bitnr =3D (_bit), \ @@ -62,9 +59,6 @@ extern const PropertyInfo prop_info_link; .set_default =3D true, = \ .defval.u =3D (_type)_defval) =20 -#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type= ) \ - DEFINE_PROP(_name, _state, _field, _prop, _type) - #define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ DEFINE_PROP(_name, _state, _field, prop_info_bit64, uint64_t, \ .bitnr =3D (_bit), \ diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index edfaed8c9a..f15abacbdf 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3214,9 +3214,9 @@ static Property vfio_pci_dev_properties[] =3D { DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice, sub_device_id, PCI_ANY_ID), DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 0), - DEFINE_PROP_UNSIGNED_NODEFAULT("x-nv-gpudirect-clique", VFIOPCIDevice, - nv_gpudirect_clique, - qdev_prop_nv_gpudirect_clique, uint8_t), + DEFINE_PROP("x-nv-gpudirect-clique", VFIOPCIDevice, + nv_gpudirect_clique, + qdev_prop_nv_gpudirect_clique, uint8_t), DEFINE_PROP_OFF_AUTO_PCIBAR("x-msix-relocation", VFIOPCIDevice, msix_r= elo, OFF_AUTOPCIBAR_OFF), /* diff --git a/target/arm/cpu.c b/target/arm/cpu.c index cef92879b0..7cf2078622 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1106,9 +1106,9 @@ static Property arm_cpu_has_mpu_property =3D * to override that with an incorrect constant value. */ static Property arm_cpu_pmsav7_dregion_property =3D - DEFINE_PROP_UNSIGNED_NODEFAULT("pmsav7-dregion", ARMCPU, - pmsav7_dregion, - prop_info_uint32, uint32_t); + DEFINE_PROP("pmsav7-dregion", ARMCPU, + pmsav7_dregion, + prop_info_uint32, uint32_t); =20 static bool arm_get_pmu(Object *obj, Error **errp) { --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605220454; cv=none; d=zohomail.com; s=zohoarc; b=QSR+xH0lJqCIFWwI24MnZrIF/fZ1jrwPNxqkoIIFu3hY1taocBs4to7XC2VawyA/w5RUu9cbyJO+yad67ZzybEFicC7AafFhB4i9bUeFQvsG2mdwKZQqljHJUkp53gC6QmMhgYFIT+hr6v0LHvRk+lLbjAnXeVj2+bBWoV2Fkxo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605220454; 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=fWzmX4QSxGjzUC1rfBAMCIuzvaMvttd7vGWA8RCJy10=; b=jTEs9IXLEgY+oizDHHW5pIIjVlWa+Ut2j8Oa24T9tv3Vg9blIW41mwFrvABDDdZdGcbykE9WqH+CT23r+QDZCBj0fEYfy6dMhwVzHVdGsOXpVYB4K+Fe2oG6z851lH44Q+kca6hB44pSvXzZpLlaiqs2+TzEYlSRbJyLijabvg8= 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 1605220454988680.1138859466499; Thu, 12 Nov 2020 14:34:14 -0800 (PST) Received: from localhost ([::1]:37222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdLAT-0001nk-Pg for importer@patchew.org; Thu, 12 Nov 2020 17:34:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKRQ-0000Jc-Na for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:26190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKRM-0003o3-3w for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:40 -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-YNuptHFHO1Ot2FW-3PmgQQ-1; Thu, 12 Nov 2020 16:47:27 -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 B4450807325; Thu, 12 Nov 2020 21:47:26 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 806E81002382; Thu, 12 Nov 2020 21:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217651; 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=fWzmX4QSxGjzUC1rfBAMCIuzvaMvttd7vGWA8RCJy10=; b=YPcBkwyBbYo+Z5GAVYx2EllVhOfdE3g8jl7qeVQzS/kFu44GHzAroCU7lnwjKW/Vgqut5p 5wvCbfZALDkc/N9cm4ithBAsdB+HetpZlGhgcYWXL+Av07mGqsJbAfKxUe4a4yZh45Hm0Q x35/g1gP2g4NfQV94lQ/iSMBBMA98Oo= X-MC-Unique: YNuptHFHO1Ot2FW-3PmgQQ-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 51/53] qom: PROP_* macros Date: Thu, 12 Nov 2020 16:43:48 -0500 Message-Id: <20201112214350.872250-52-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 16:09:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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_H5=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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , 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 new helper macros are similar to the old DEFINE_PROP_* macros, but don't take a name argument. They can be used directly as argument to object_class_property_add_field(). The DEFINE_PROP_* macros were redefined to just be wrappers to PROP_*. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Now the DEFINE_PROP_* macros are defined using PROP_*, not the other way around * Remove unused macros (PROP_UNSIGNED*, PROP_SIGNED*, PROP_UUID) * Removed PROP_ARRAY because it isn't as trivial as the others * Now PROP_* won't return a pointer to a static variable anymore, but just a compound literal for a Property struct. This is a new patch added in v2 of the series --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/qom/property-types.h | 141 ++++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 51 deletions(-) diff --git a/include/qom/property-types.h b/include/qom/property-types.h index 91b166badf..3132ddafd9 100644 --- a/include/qom/property-types.h +++ b/include/qom/property-types.h @@ -23,6 +23,64 @@ extern const PropertyInfo prop_info_size32; extern const PropertyInfo prop_info_arraylen; extern const PropertyInfo prop_info_link; =20 +#define PROP_SIGNED(_state, _field, _defval, _prop, _type, ...) \ + FIELD_PROP(_state, _field, _prop, _type, \ + .set_default =3D true, \ + .defval.i =3D (_type)_defval, \ + __VA_ARGS__) + +#define PROP_UNSIGNED(_state, _field, _defval, _prop, _type, ...) \ + FIELD_PROP(_state, _field, _prop, _type, \ + .set_default =3D true, \ + .defval.u =3D (_type)_defval, \ + __VA_ARGS__) + +#define PROP_BIT(_state, _field, _bit, _defval, ...) \ + FIELD_PROP(_state, _field, prop_info_bit, uint32_t, \ + .bitnr =3D (_bit), \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval, \ + __VA_ARGS__) + +#define PROP_BIT64(_state, _field, _bit, _defval, ...) \ + FIELD_PROP(_state, _field, prop_info_bit64, uint64_t, \ + .bitnr =3D (_bit), \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval, \ + __VA_ARGS__) + +#define PROP_BOOL(_state, _field, _defval, ...) \ + FIELD_PROP(_state, _field, prop_info_bool, bool, \ + .set_default =3D true, \ + .defval.u =3D (bool)_defval, \ + __VA_ARGS__) + +#define PROP_LINK(_state, _field, _type, _ptr_type, ...) \ + FIELD_PROP(_state, _field, prop_info_link, _ptr_type, \ + .link_type =3D _type, \ + __VA_ARGS__) + +#define PROP_UINT8(_s, _f, _d, ...) \ + PROP_UNSIGNED(_s, _f, _d, prop_info_uint8, uint8_t, __VA_ARGS__) +#define PROP_UINT16(_s, _f, _d, ...) \ + PROP_UNSIGNED(_s, _f, _d, prop_info_uint16, uint16_t, __VA_ARGS__) +#define PROP_UINT32(_s, _f, _d, ...) \ + PROP_UNSIGNED(_s, _f, _d, prop_info_uint32, uint32_t, __VA_ARGS__) +#define PROP_INT32(_s, _f, _d, ...) \ + PROP_SIGNED(_s, _f, _d, prop_info_int32, int32_t, __VA_ARGS__) +#define PROP_UINT64(_s, _f, _d, ...) \ + PROP_UNSIGNED(_s, _f, _d, prop_info_uint64, uint64_t, __VA_ARGS__) +#define PROP_INT64(_s, _f, _d, ...) \ + PROP_SIGNED(_s, _f, _d, prop_info_int64, int64_t, __VA_ARGS__) +#define PROP_SIZE(_s, _f, _d, ...) \ + PROP_UNSIGNED(_s, _f, _d, prop_info_size, uint64_t, __VA_ARGS__) +#define PROP_STRING(_s, _f, ...) \ + FIELD_PROP(_s, _f, prop_info_string, char*, __VA_ARGS__) +#define PROP_ON_OFF_AUTO(_s, _f, _d, ...) \ + PROP_SIGNED(_s, _f, _d, prop_info_on_off_auto, OnOffAuto, __VA_ARGS__) +#define PROP_SIZE32(_s, _f, _d, ...) \ + PROP_UNSIGNED(_s, _f, _d, prop_info_size32, uint32_t, __VA_ARGS__) + /** * DEFINE_PROP: Define a #Property struct, including a property name * @@ -43,33 +101,6 @@ extern const PropertyInfo prop_info_link; .name_template =3D (_name), \ __VA_ARGS__) =20 -#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) - -#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, prop_info_bit, uint32_t, \ - .bitnr =3D (_bit), \ - .set_default =3D true, \ - .defval.u =3D (bool)_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) - -#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, prop_info_bit64, uint64_t, \ - .bitnr =3D (_bit), \ - .set_default =3D true, \ - .defval.u =3D (bool)_defval) - -#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \ - DEFINE_PROP(_name, _state, _field, prop_info_bool, bool, \ - .set_default =3D true, \ - .defval.u =3D (bool)_defval) - #define PROP_ARRAY_LEN_PREFIX "len-" =20 /** @@ -106,30 +137,38 @@ extern const PropertyInfo prop_info_link; .arrayfieldsize =3D sizeof(_arraytype), \ .arrayoffset =3D offsetof(_state, _arrayfield)) =20 -#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ - DEFINE_PROP(_name, _state, _field, prop_info_link, _ptr_type, \ - .link_type =3D _type) - -#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ - 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, prop_info_uint16, uint16_t) -#define DEFINE_PROP_UINT32(_n, _s, _f, _d) \ - 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, prop_info_int32, int32_t) -#define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ - 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, prop_info_int64, int64_t) -#define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size, uint64_t) -#define DEFINE_PROP_STRING(_n, _s, _f) \ - 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, prop_info_on_off_auto, OnOffAuto) -#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size32, uint32_t) +#define DEFINE_PROP_SIGNED(_n, ...) \ + PROP_SIGNED(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_BIT(_n, ...) \ + PROP_BIT(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_UNSIGNED(_n, ...) \ + PROP_UNSIGNED(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_BIT64(_n, ...) \ + PROP_BIT64(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_BOOL(_n, ...) \ + PROP_BOOL(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_LINK(_n, ...) \ + PROP_LINK(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_UINT8(_n, ...) \ + PROP_UINT8(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_UINT16(_n, ...) \ + PROP_UINT16(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_UINT32(_n, ...) \ + PROP_UINT32(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_INT32(_n, ...) \ + PROP_INT32(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_UINT64(_n, ...) \ + PROP_UINT64(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_INT64(_n, ...) \ + PROP_INT64(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_SIZE(_n, ...) \ + PROP_SIZE(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_STRING(_n, ...) \ + PROP_STRING(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_ON_OFF_AUTO(_n, ...) \ + PROP_ON_OFF_AUTO(__VA_ARGS__, .name_template =3D (_n)) +#define DEFINE_PROP_SIZE32(_n, ...) \ + PROP_SIZE32(__VA_ARGS__, .name_template =3D (_n)) =20 #define DEFINE_PROP_END_OF_LIST() \ {} --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605220103; cv=none; d=zohomail.com; s=zohoarc; b=SM0rrjjN3gX1QYgVcF3/1iCHlGtVoo/JpqUSFD7bM3yfhfH+6UvgrB2yh0NDyoX1BEJ8y0cOGiYLkKzmwJLpZFwofkpPCyUyJYpsqna0GHO62Hc054mksq6BpNXZFJcTx6Tws5KijUfZFZAjX3RdoyIUGcire7+4VowgnfOjK+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605220103; 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=zKAMxkAZdWtHz59/oN5KECOch+qKM8v3q6+WMT/2vtU=; b=jiHgqMyqqu791ksTztjN2jnU0h2XkirV7Svt0j/RRrE1sLEUz2Fhyux+xDUAesou7ZfYlAVKe3YDhoisKYC5P5hQNho5Z7ENyAge6mFLV+HlCyY6HXdCO3xsvziU1XP7Hdy5L4quGImW18ykdIQG2oRsU/K2M2agtACWuO1sCCY= 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 1605220103549788.1660359045546; Thu, 12 Nov 2020 14:28:23 -0800 (PST) Received: from localhost ([::1]:55146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdL4o-0004ls-BZ for importer@patchew.org; Thu, 12 Nov 2020 17:28:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKRP-0000HB-EN for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKRM-0003oH-6r for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:39 -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-221-634AWudtOtKAp4o1Uz1sQA-1; Thu, 12 Nov 2020 16:47:32 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B534186DD3A; Thu, 12 Nov 2020 21:47:31 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 821606EF62; Thu, 12 Nov 2020 21:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217653; 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=zKAMxkAZdWtHz59/oN5KECOch+qKM8v3q6+WMT/2vtU=; b=V6G1ooSO25Vrk/+j0dJiLONWNLCttHfnN2LwZi52JHPKGtd3fzH30HQf71xTiJojmqCSzo iVN8DJRJm7xrxIjmmz0kixY1ZG9lBqjmIsSUEH13wXAOHsxdiNKLMcCf3JFus9D361kK4N tY30JwhMRPDb/P5d1olbPDeMNdA98Bk= X-MC-Unique: 634AWudtOtKAp4o1Uz1sQA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 52/53] tests: Use field property at check-qom-proplist test case Date: Thu, 12 Nov 2020 16:43:49 -0500 Message-Id: <20201112214350.872250-53-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Use the field property system for the "sv" property used at check-qom-proplist. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Don't register a instance field property, as object_property_add_field() is an internal API Changes v1 -> v2: * Use PROP_* and object_class_property_add_field() interface --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- tests/check-qom-proplist.c | 39 ++++---------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index 1b76581980..2ded6203fb 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -25,7 +25,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "qemu/config-file.h" -#include "qom/object_interfaces.h" +#include "qom/qom.h" =20 =20 #define TYPE_DUMMY "qemu-dummy" @@ -103,26 +103,6 @@ static int dummy_get_av(Object *obj, return dobj->av; } =20 - -static void dummy_set_sv(Object *obj, - const char *value, - Error **errp) -{ - DummyObject *dobj =3D DUMMY_OBJECT(obj); - - g_free(dobj->sv); - dobj->sv =3D g_strdup(value); -} - -static char *dummy_get_sv(Object *obj, - Error **errp) -{ - DummyObject *dobj =3D DUMMY_OBJECT(obj); - - return g_strdup(dobj->sv); -} - - static void dummy_init(Object *obj) { object_property_add_bool(obj, "bv", @@ -130,12 +110,11 @@ static void dummy_init(Object *obj) dummy_set_bv); } =20 - static void dummy_class_init(ObjectClass *cls, void *data) { - object_class_property_add_str(cls, "sv", - dummy_get_sv, - dummy_set_sv); + object_class_property_add_field(cls, "sv", + PROP_STRING(DummyObject, sv), + prop_allow_set_always); object_class_property_add_enum(cls, "av", "DummyAnimal", &dummy_animal_map, @@ -143,21 +122,11 @@ static void dummy_class_init(ObjectClass *cls, void *= data) dummy_set_av); } =20 - -static void dummy_finalize(Object *obj) -{ - DummyObject *dobj =3D DUMMY_OBJECT(obj); - - g_free(dobj->sv); -} - - static const TypeInfo dummy_info =3D { .name =3D TYPE_DUMMY, .parent =3D TYPE_OBJECT, .instance_size =3D sizeof(DummyObject), .instance_init =3D dummy_init, - .instance_finalize =3D dummy_finalize, .class_size =3D sizeof(DummyObjectClass), .class_init =3D dummy_class_init, .interfaces =3D (InterfaceInfo[]) { --=20 2.28.0 From nobody Sat May 4 16:51:48 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=1605220557; cv=none; d=zohomail.com; s=zohoarc; b=R3w6sDURnyK3awKLj6W52ZZOw+ndg9YrhipK1NuMF7uUu6wCxpjy4K2WDpdfKOXKooEO6sW3LPkE26JI2GNcyrp4auWAD8AYH7ck7sawdh1KqhRmOmf+v+H6m762jxb6lvw1KmTJesqe62RPazNtB547BSl9PaGI5AOOOTUMBgw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605220557; 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=ZC8v3nw6M/39zLtwdBsNZBKTWrqglReMuloTDUMmWww=; b=gtWMuPr4TEJ6lgfXNkVcRtvE6W+jQsJuUyn/yUlaLTtU+WNOnWjwZyqAY4R1sjle4sX5l75+gLkDCVlIqgPB0hhxBuvGe35Um54AeuUEOC/35HyqnnbLCoT/63rfj/GqLQ5M0pV/tvH+VDkuPM9LdqRjFf385pXV+APUs1WFtm8= 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 1605220557006904.7105553816625; Thu, 12 Nov 2020 14:35:57 -0800 (PST) Received: from localhost ([::1]:39624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdLC5-0002yH-Nw for importer@patchew.org; Thu, 12 Nov 2020 17:35:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdKRS-0000N5-Bp for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kdKRP-0003pF-UI for qemu-devel@nongnu.org; Thu, 12 Nov 2020 16:47:42 -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-563-lWu3jwoyPFqKt-sqOqowVw-1; Thu, 12 Nov 2020 16:47:36 -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 89C5C1074661; Thu, 12 Nov 2020 21:47:35 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C15455763; Thu, 12 Nov 2020 21:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605217659; 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=ZC8v3nw6M/39zLtwdBsNZBKTWrqglReMuloTDUMmWww=; b=LTiYuzYo59sroeyKJttgjY5kJTlayleFPp0yVNJsmrFgHrr4IXrNJug4e1SYcXKMdOsDMp RUaGPdFJL4iSOZCXmIwkJ7aN7XYdJ7Ye7890/S517nGuW9JnEj9tN6B9O4VFDHIyuuTlAi 40fptT5k2/twXSJgtPUPrKYop9diOMI= X-MC-Unique: lWu3jwoyPFqKt-sqOqowVw-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v3 53/53] sev: Use class properties Date: Thu, 12 Nov 2020 16:43:50 -0500 Message-Id: <20201112214350.872250-54-ehabkost@redhat.com> In-Reply-To: <20201112214350.872250-1-ehabkost@redhat.com> References: <20201112214350.872250-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-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Igor Mammedov , Richard Henderson , 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" Instance properties make introspection hard and are not shown by "-object ...,help". Convert them to class properties. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of this series. There was another version of this patch inside series: Subject: [PATCH 00/12] qom: Make all -object types use only class propert= ies Message-Id: <20201009160122.1662082-1-ehabkost@redhat.com> https://lore.kernel.org/qemu-devel/20201009160122.1662082-1-ehabkost@redh= at.com Changes from v1 of the patch: * Use new object_class_property_add_field() API to replace object_property_add_uint32_ptr(). (v1 used object_class_property_add_uint32_ptr(), which won't exist anymore) --- Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- target/i386/sev.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 93c4d60b82..264ea5a7fb 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -28,7 +28,7 @@ #include "sysemu/runstate.h" #include "trace.h" #include "migration/blocker.h" -#include "qom/object.h" +#include "qom/qom.h" =20 #define TYPE_SEV_GUEST "sev-guest" OBJECT_DECLARE_SIMPLE_TYPE(SevGuestState, SEV_GUEST) @@ -298,6 +298,19 @@ sev_guest_class_init(ObjectClass *oc, void *data) sev_guest_set_session_file); object_class_property_set_description(oc, "session-file", "guest owners session parameters (encoded with base64)"); + + object_class_property_add_field(oc, "policy", + PROP_UINT32(SevGuestState, policy, DEFAULT_GUEST_POLICY), + prop_allow_set_always); + object_class_property_add_field(oc, "handle", + PROP_UINT32(SevGuestState, handle, 0), + prop_allow_set_always); + object_class_property_add_field(oc, "cbitpos", + PROP_UINT32(SevGuestState, cbitpos, 0), + prop_allow_set_always); + object_class_property_add_field(oc, "reduced-phys-bits", + PROP_UINT32(SevGuestState, reduced_phys_bits, 0), + prop_allow_set_always); } =20 static void @@ -306,16 +319,6 @@ sev_guest_instance_init(Object *obj) SevGuestState *sev =3D SEV_GUEST(obj); =20 sev->sev_device =3D g_strdup(DEFAULT_SEV_DEVICE); - sev->policy =3D DEFAULT_GUEST_POLICY; - object_property_add_uint32_ptr(obj, "policy", &sev->policy, - OBJ_PROP_FLAG_READWRITE); - object_property_add_uint32_ptr(obj, "handle", &sev->handle, - OBJ_PROP_FLAG_READWRITE); - object_property_add_uint32_ptr(obj, "cbitpos", &sev->cbitpos, - OBJ_PROP_FLAG_READWRITE); - object_property_add_uint32_ptr(obj, "reduced-phys-bits", - &sev->reduced_phys_bits, - OBJ_PROP_FLAG_READWRITE); } =20 /* sev guest info */ --=20 2.28.0