From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732216992; cv=none; d=zohomail.com; s=zohoarc; b=RVJngyYckwMPKMRZ3wnP2Z6NpA8+G9ZinDKu/K495w37QVdQwQ64ZjgtNGl61v7CAoJ94yZoUO19Jkn45ufvO0SHMYoKrSiyrI1ChCkNmlvYlOa8posgDrkvNx1PDylIQL9evYGfhsqLmoasYoll8AS74sUHPpylf/Xik6aOrAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732216992; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Q5jUbQ+yr7D30yRp58pGypHuu7/mFZdfnjPhz1jbr+M=; b=oJrKWQ9qCuyVbjS3BOoPZRgvfXB+SgW00S1uU4t1gDkFy6M/IuulDM5U14ia7yV1Xl/9oGeT1JFDf/i7bQL26g/pc2R+xdCIubaZmvknbwDA1P6ZoUraQ+3CgVeh1acun/iVTDjbbMy1vz/OBjFGsEoZqgj7hcWofWukgo166lg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732216992340176.57508713295817; Thu, 21 Nov 2024 11:23:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECks-0006Ly-Vz; Thu, 21 Nov 2024 14:22:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkm-0006Jr-0U for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkk-0002Vf-6D for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:11 -0500 Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-Ds2dCPNmOGigCVueNBGksQ-1; Thu, 21 Nov 2024 14:22:07 -0500 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-83ac354a75fso136797239f.0 for ; Thu, 21 Nov 2024 11:22:07 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216928; 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=Q5jUbQ+yr7D30yRp58pGypHuu7/mFZdfnjPhz1jbr+M=; b=DGY1o+FpFQTe+0T4dOBMhGlWa8JR9/JTKclaECRqcGIuTqMv9TaPvXNZ+R3lvnr/d4EcCW QmtHRX4mmbdWQQ6F1XMkiQTOirmpGr7cQ33vP0D/X3iW/KXBvJI1k0Nn5Y+9zwN3IjugMg Q/1bRQYdfdRV4gOzcwEd0d7pLLblk98= X-MC-Unique: Ds2dCPNmOGigCVueNBGksQ-1 X-Mimecast-MFC-AGG-ID: Ds2dCPNmOGigCVueNBGksQ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216926; x=1732821726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q5jUbQ+yr7D30yRp58pGypHuu7/mFZdfnjPhz1jbr+M=; b=EydCXb+BXBrXulFiTaqWufN7+yKz9Rrqf62Cw18Yb+r9qw21qWZbA/CfaqGVdG8UHe O7SCkblLOH3GGQi5uuDJRNLtj5Sadn5br7jDRj2ndfu/NEQAG4xoULdd+LFSRi/5Ebtl LbW1CQ59D4+h3lGpbpmX4WCu8tlNF9btnM3u6ClMUlS19/KYEYfCMc6bvmx7shDyvDg2 qJSGEHcAtxIKZg2QY8YUdvWeUAapq61Tb0vUgzdkl0L5vip2HOBDOLGKYDXkvKb32HVE 9lq0fB+VKLhkkkoUgnpuyfXzJv4xYNJerLETj14oMFaNcHfgOYhBgGF57UnxgI5FNf+W u31g== X-Gm-Message-State: AOJu0YwxGwA3PzftrEq7zevxfBMDcprkiydiKA4Cnlhn2ppbQ9ghBpi/ Ezv1y/Pu4Q4xNRfGJpSldiFh1c3teBeEgDPqSflYjXaYSNKUy4Mtwbfdg7bALVXqhmM+UM+xhRT LSerfr+BTIbwAxl9VUGZ/I2yRWatnfxTqfqacdDV+IlEVp7QmXPKUp+ukyATNzUXO0JEsIMd5rP ADHUAdh76JUGiqR5IuVNZIRDLjnEfdbGjsWA== X-Gm-Gg: ASbGncuXTF701o/5uKy1oLhZEDIGc4z7ZvXwuT9/e+r1sSO7+fp2iYUxFREiXJVeMGm Ij4bG4k1IhPp06qg375SVZzvnlBQuAamIs21K0CCW7p4ChySHoZz0j1mPhyAa0bUYS6bvirGmpC SCcfzWp3YJQHPmQWdjV4BHGUM8BhhdPxiURfvWM8lDVGFlsgf/6icFDNQpifGApnjwcEXb1CL73 blnczjqZ06Vjy4IOoJ6AtWmL9k8hkqToUuxMx/vblrfTZDm7Z64bnDHmB+OSp0cvAVrrBMcH1cP KXWZij2WKoJ8ZtvCQ7jTDguFKg== X-Received: by 2002:a05:6602:6010:b0:83a:a96b:8825 with SMTP id ca18e2360f4ac-83ecdb2f0e2mr17085439f.0.1732216926508; Thu, 21 Nov 2024 11:22:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXildkvXhpAGQK8aQuCiKNMlcM4vAJ2ggFaEQ8aeXQ9r2Wr7h7q8d7Z7os/XWtWCjc1sF7WA== X-Received: by 2002:a05:6602:6010:b0:83a:a96b:8825 with SMTP id ca18e2360f4ac-83ecdb2f0e2mr17082839f.0.1732216926216; Thu, 21 Nov 2024 11:22:06 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 01/13] qom: Add TYPE_CONTAINER macro Date: Thu, 21 Nov 2024 14:21:50 -0500 Message-ID: <20241121192202.4155849-2-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, 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_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732216992882116600 Provide a macro for the container type across QEMU source tree, rather than hard code it every time. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Peter Xu --- include/qom/object.h | 1 + hw/arm/stellaris.c | 2 +- qom/container.c | 4 ++-- qom/object.c | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 43c135984a..3ba370ce9b 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -26,6 +26,7 @@ typedef struct InterfaceClass InterfaceClass; typedef struct InterfaceInfo InterfaceInfo; =20 #define TYPE_OBJECT "object" +#define TYPE_CONTAINER "container" =20 typedef struct ObjectProperty ObjectProperty; =20 diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 376746251e..6d518b9cde 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1053,7 +1053,7 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) flash_size =3D (((board->dc0 & 0xffff) + 1) << 1) * 1024; sram_size =3D ((board->dc0 >> 18) + 1) * 1024; =20 - soc_container =3D object_new("container"); + soc_container =3D object_new(TYPE_CONTAINER); object_property_add_child(OBJECT(ms), "soc", soc_container); =20 /* Flash programming is done via the SCU, so pretend it is ROM. */ diff --git a/qom/container.c b/qom/container.c index 455e8410c6..cfec92a944 100644 --- a/qom/container.c +++ b/qom/container.c @@ -15,7 +15,7 @@ #include "qemu/module.h" =20 static const TypeInfo container_info =3D { - .name =3D "container", + .name =3D TYPE_CONTAINER, .parent =3D TYPE_OBJECT, }; =20 @@ -37,7 +37,7 @@ Object *container_get(Object *root, const char *path) for (i =3D 1; parts[i] !=3D NULL; i++, obj =3D child) { child =3D object_resolve_path_component(obj, parts[i]); if (!child) { - child =3D object_new("container"); + child =3D object_new(TYPE_CONTAINER); object_property_add_child(obj, parts[i], child); object_unref(child); } diff --git a/qom/object.c b/qom/object.c index 9edc06d391..214d6eb4c1 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1739,7 +1739,7 @@ Object *object_get_root(void) static Object *root; =20 if (!root) { - root =3D object_new("container"); + root =3D object_new(TYPE_CONTAINER); } =20 return root; @@ -1755,7 +1755,7 @@ Object *object_get_internal_root(void) static Object *internal_root; =20 if (!internal_root) { - internal_root =3D object_new("container"); + internal_root =3D object_new(TYPE_CONTAINER); } =20 return internal_root; --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217095; cv=none; d=zohomail.com; s=zohoarc; b=P6uOKxtnHBrkHUuTW6UG7GiUSMo2H8Gn4UsQ/I27E7BGrrbNADiL6/gMkqCH6d3H1X5wb7Jb1tqNb8cPsygNzgbN+vTNckkiG4fvtViw/GJRBHQVWiASWLXnT4+yPF4TcsdJO3h+Pw2RJ3jET2VBIDt3i6JngQhNZWfmAK/9/68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217095; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=arcBPmf8wzRlgW3nU1LndcjIfMFJuvboEpJ64NoZeIM=; b=V6N9MsDKCYA9mrV1qGRZ9Kv7n6sUpYAAIejt9e9sn8yZ/1wUhex6F3Uqkd+hbi26dLht+BwPqas5FFLsnuo8rMG17znTgAo8om7jPrvPPFDlnLbEWlwZegkYdQLH8AP1AzTk8Pfv7/g36K73n8XTrnejje4SAIb2VkiXAjUrtvI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217095135831.0661687713704; Thu, 21 Nov 2024 11:24:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECku-0006Mc-48; Thu, 21 Nov 2024 14:22:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkn-0006KF-5N for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkl-0002Vo-PS for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:12 -0500 Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-386-UE9zdm2jO9akU6Mfp3TYPg-1; Thu, 21 Nov 2024 14:22:09 -0500 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-83abe8804a5so125091539f.2 for ; Thu, 21 Nov 2024 11:22:09 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=arcBPmf8wzRlgW3nU1LndcjIfMFJuvboEpJ64NoZeIM=; b=CjV99JgjH0nZKoGC9bWmbAmSODVRyKEWkRav32eg5T1uVZoXXzNmXKWMeJBvKb1SdNEDmT F8kKow+i6oYyKR96AqGUgjI0DAFApwHkqiQ+91oXo6UQ+AcRYeeKOfjxFG9EX7bPqjGb3G FjMy51gXLfutWrtGlvyE/0LX5KpngUA= X-MC-Unique: UE9zdm2jO9akU6Mfp3TYPg-1 X-Mimecast-MFC-AGG-ID: UE9zdm2jO9akU6Mfp3TYPg X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216928; x=1732821728; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=arcBPmf8wzRlgW3nU1LndcjIfMFJuvboEpJ64NoZeIM=; b=pkuYgoMmNCpTeXdL4/TII3UB6wxvaBoDNs6H5UHcCfNqhKrsWWHnaZqxTG0aE1ZOXt QPpbsz0Bgged+zoBYlclCdtWbV7xIdElArKVs/+BkRR2NOtptVEpXcx8mb2iGiBP17ZP tXDK3YEfseh151/WvkOq94a7zkUNbAoNHIDsOerild72gaBEbGoidqAY4o1W1y0Huf9W WWmSBuFjFD+3EGvost1M4Ok2mP9cOO6tjjU6SacDhrp2/IPTJcLfjTJZDzJ6I17kZtcA /moDRmzGC7TgdIYk23bc/tPLzJVVmNnEGBXh8zm+Y5u/zNMJG4Xs4laXZomLVJJpEYBK 4d7g== X-Gm-Message-State: AOJu0YyMfPRWWkxYAmDCspe9OzrqRVwV7gLfmgHiUeUr8WqVjyv6ja/S 0LhAM5CHDHLeIJb0EjRA8Tea21gv9N3+KqDnh4iBHt27r3RbI2kDNYy+Fhw23MAkydEJwtH4rt9 NzvWKQ+CJF9LGtLIH5/dnGWkppevunm37yVdzOWqM1MErU8stDT3uXg2flEsY8/yEDAdiE/7C/N aK+qYGT20vtCr561GP5Jmite4PQovyTHP9rw== X-Gm-Gg: ASbGnctkXO292ZHoEqBfKE91gp/Duvq2NGChwoGIWlh455+do+qKUdMrZ485jV97MeR wp3V3L3uVp1nVZXP6AmA4nDwk4HlFfelu7hcYxmgogjUao5HSLAoZnfwvDXXsJQyuk7XkAsNJvc fl5P2KIhvnoPCEbM3ypJXtcYUKJ8jOTvcEHRB4slh2HAbQiaE5k4ZSpUnSJtv1ZnX9o6OCsirjI kwug6d56U+X+QnSGU0/hRhyizfShzVJiGE6oFGvpiy5RHAYiX3/VuovhCefOj99IuUAz7VuNj6d hwy4LnyuQfwsi4LpM8SLgORwlQ== X-Received: by 2002:a05:6602:608b:b0:83a:9f64:6c75 with SMTP id ca18e2360f4ac-83ecdc515famr12124639f.3.1732216928079; Thu, 21 Nov 2024 11:22:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGm2roxzJg58laCb6r40bwkfzwJFUWdbEinhTY1AluIOOVeX80rme6EypEEPceq5GomYZ9SMw== X-Received: by 2002:a05:6602:608b:b0:83a:9f64:6c75 with SMTP id ca18e2360f4ac-83ecdc515famr12120239f.3.1732216927609; Thu, 21 Nov 2024 11:22:07 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 02/13] qom: New object_property_add_new_container() Date: Thu, 21 Nov 2024 14:21:51 -0500 Message-ID: <20241121192202.4155849-3-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217097346116600 Content-Type: text/plain; charset="utf-8" To move towards explicit creations of containers, starting that by providing a helper for creating container objects. Signed-off-by: Peter Xu Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qom/object.h | 12 ++++++++++++ qom/container.c | 14 +++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 3ba370ce9b..597e961b8c 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -2033,6 +2033,18 @@ int object_child_foreach_recursive(Object *obj, */ Object *container_get(Object *root, const char *path); =20 +/** + * object_property_add_new_container: + * @obj: the parent object + * @name: the name of the parent object's property to add + * + * Add a newly created container object to a parent object. + * + * Returns: the newly created container object. Its reference count is 1, + * and the reference is owned by the parent object. + */ +Object *object_property_add_new_container(Object *obj, const char *name); + /** * object_property_help: * @name: the name of the property diff --git a/qom/container.c b/qom/container.c index cfec92a944..20ab74b0e8 100644 --- a/qom/container.c +++ b/qom/container.c @@ -24,6 +24,16 @@ static void container_register_types(void) type_register_static(&container_info); } =20 +Object *object_property_add_new_container(Object *obj, const char *name) +{ + Object *child =3D object_new(TYPE_CONTAINER); + + object_property_add_child(obj, name, child); + object_unref(child); + + return child; +} + Object *container_get(Object *root, const char *path) { Object *obj, *child; @@ -37,9 +47,7 @@ Object *container_get(Object *root, const char *path) for (i =3D 1; parts[i] !=3D NULL; i++, obj =3D child) { child =3D object_resolve_path_component(obj, parts[i]); if (!child) { - child =3D object_new(TYPE_CONTAINER); - object_property_add_child(obj, parts[i], child); - object_unref(child); + child =3D object_property_add_new_container(obj, parts[i]); } } =20 --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217007; cv=none; d=zohomail.com; s=zohoarc; b=OgDcmvgO00r5CILsXnAn9viKnE1lETkYpmzPwI8VBWP31DEFJNi1ExLQNjpwj2rX5Z3MUEPLAJt9PdFDwDH7m3bjKhR5HS3EAqHZpX2ZvSe7Bspxayrq9wDK6dbD4zmLu8eHbfYIOqVc7lUTY3Lnd5MjGMJ1xe4skznWULt3Nrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217007; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Rw/GClsfR9o9I7KixsNs9zzzzwG0HdX9+W2Tp8XS1Ew=; b=RSpCwM2SJ5eLY2Y0jOJABnCIFBU4Bnib/b900E35W3xk/oP5KnE5DCryM5pTiHrpd4m3CIwqGriCCWbY8jK7sY5QyhclYXRLGgaBPfhUgZA66WHArfNJCwTwiSltaql+dBrDMpyy3l64Mmw6NSwnB9dI7MDt5qPV9cbwCziMmnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217007314327.09939615085773; Thu, 21 Nov 2024 11:23:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECks-0006Lp-Nz; Thu, 21 Nov 2024 14:22:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECko-0006KN-W7 for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkn-0002WC-HU for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:14 -0500 Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-464-8FuYqdvlOBqG4CVSz19RSA-1; Thu, 21 Nov 2024 14:22:11 -0500 Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-83ac354a75fso136802839f.0 for ; Thu, 21 Nov 2024 11:22:11 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216932; 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=Rw/GClsfR9o9I7KixsNs9zzzzwG0HdX9+W2Tp8XS1Ew=; b=AHkY66WxeELjD0Y5zc/OVZdtwtMhnfAX6FzdoMy0I4yHNxs3n3oPAp0vx8Slc7EsKYIwq+ 0DmWvXzfjapVTQNlBcHUweuTtCI1q34ASAy5nmXASwfsPZkwKjvuICxdt/TiJQu6SaBYPv svQFky4zUGnnoJBarPwzWn2wDwVixbI= X-MC-Unique: 8FuYqdvlOBqG4CVSz19RSA-1 X-Mimecast-MFC-AGG-ID: 8FuYqdvlOBqG4CVSz19RSA X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216930; x=1732821730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rw/GClsfR9o9I7KixsNs9zzzzwG0HdX9+W2Tp8XS1Ew=; b=SIbWmsGOwAoeBUjVYGfPOO8CuhbN6CcEdjR8urzrCMcKX/gecsF608ot9dJGGGHTOH X/cyVMsL5bO8G7PaOsCsl1uac5Xk46guLIhBzD7pOOEvkeQr4fproKbPe1Xo9fnqMCzf ReuptgSOgP0wJ8bn4djtDnAcrUNmguQ3q544QC3nrmsvD+eqgH4mTbdffUtfGETmrQTV dJI5yr27le2+J4w64qYXpbpLa49hdTlAgPccyZVV9NWwrdtZ6l2JOMaVkbegLHdgRFb5 SwKXjNreo3CkmxrYBupowYdbDsz5cSg7IMC0J8uoLalS3KQpVAjunNdZoCoRqc8dEbqG Wrkg== X-Gm-Message-State: AOJu0Yx4h+JFwmal+m1QN0pdIgPyfkjhnk0Wc4U6tBJM7FW53f2fINyX WGxiLSVQjYKk/Shw7pM7vYmMaSbCRskedbqX3Em7Fl0kYcDHkf2ydUuIofj/5iF1Y6fJtLGPGx6 LP08sSH8ASnsO8T3LDmQnOihg4coeJhrZvFB7sE/OlLTTEWNrHIU0eJ8SpXYQNuiFDAyYVS93lA ztGTk+INM+MeMfbAThut5h+46dDemOTi0l3g== X-Gm-Gg: ASbGncspCb2JaXFFvNSATVXKji4DCXh2hNWyWI/FEV8Rk/bS02Wp7zsl0TWYctmpP+T 01snQzTLyhyYWULSloXPrxpCFb+zVXmL+Qslv4j/W42m593h9QZVGscb/GE0eSSRdGNxOawqFip PrYEYiimiEgarMY1jrvBQavtAS4289xRV0TGsoHGUif0EDZvm5wMn1jq0XYNoecdgrJd7F777sq LNtXjusjUI9981p7qv83DHdMKxt6oJekcyVOgFeT97FuvhVhr4afAzDDGkd7uerIDBpoPiGLWN4 N4hMkMx4BN+87O0ThaZP/L/0VQ== X-Received: by 2002:a05:6602:6406:b0:83b:2c8e:c4 with SMTP id ca18e2360f4ac-83ecdccd02amr9561639f.9.1732216929865; Thu, 21 Nov 2024 11:22:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/7FmvnXr6M6psjVVPSnYMPInMPRY2OdxuTteVJo/OryGFXGMO/kGrmpXhr5dMti43tMx0Wg== X-Received: by 2002:a05:6602:6406:b0:83b:2c8e:c4 with SMTP id ca18e2360f4ac-83ecdccd02amr9558539f.9.1732216929525; Thu, 21 Nov 2024 11:22:09 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 03/13] tests: Fix test-qdev-global-props on anonymous qdev realize() Date: Thu, 21 Nov 2024 14:21:52 -0500 Message-ID: <20241121192202.4155849-4-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217009049116600 test-qdev-global-props creates a few subprocesses and test things based on qdev realize(). One thing was overlooked since the start, that anonymous creations of qdev (then realize() the device) requires the machine object's presence, as all these devices need to be attached to QOM tree, by default to path "/machine/unattached". The test didn't crash simply because container_get() has an implicit semantic to silently create any missing container, hence what happened here is container_get() (when running these tests) will try to create containers at QOM path "/machine" on the fly. That's probably unexpected by the test, but worked like charm before. We're going to fix device_set_realized() soon, but before that make the test case prepared, by creating the machine object on its own. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Peter Xu --- tests/unit/test-qdev-global-props.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/unit/test-qdev-global-props.c b/tests/unit/test-qdev-glo= bal-props.c index c8862cac5f..85756d39ce 100644 --- a/tests/unit/test-qdev-global-props.c +++ b/tests/unit/test-qdev-global-props.c @@ -72,6 +72,26 @@ static const TypeInfo subclass_type =3D { .parent =3D TYPE_STATIC_PROPS, }; =20 +/* + * Initialize a fake machine, being prepared for future tests. + * + * All the tests later (even if to be run in subprocesses.. which will + * inherit the global states of the parent process) will try to create qdev + * and realize the device. + * + * Realization of such anonymous qdev (with no parent object) requires both + * the machine object and its "unattached" container to be at least presen= t. + */ +static void test_init_machine(void) +{ + /* This is a fake machine - it doesn't need to be a machine object */ + Object *machine =3D object_property_add_new_container( + object_get_root(), "machine"); + + /* This container must exist for anonymous qdevs to realize() */ + object_property_add_new_container(machine, "unattached"); +} + /* Test simple static property setting to default value */ static void test_static_prop_subprocess(void) { @@ -295,6 +315,8 @@ int main(int argc, char **argv) type_register_static(&nohotplug_type); type_register_static(&nondevice_type); =20 + test_init_machine(); + g_test_add_func("/qdev/properties/static/default/subprocess", test_static_prop_subprocess); g_test_add_func("/qdev/properties/static/default", --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217022; cv=none; d=zohomail.com; s=zohoarc; b=TrcBfciezzB5YWuE3obCA8amHp6bkFKSfu7JU5tyZu0CVnez4VQD0M94nL9pbQWN+5yGD9SDT/MBG9eLbICGVqSlK+HCDSce/+1SgEoBAT9eCC5CyzjXAeud+GXJi6hxw6vZt3cQ6ZswU5MJ5cTuT9rCu2YSlY7UyxfPTw6E7fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217022; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RXA6V54Db51w/r+lVndlovYUw8qq+lukW3/9OKGx92Y=; b=FYgDVFZRJyfv5mjPl58wz8ezOHd3ox7x5pjm98VNCppA1/Tb8D2ZtJqbD0droQhC48qeFTtGwQzyfeFDrpwXAVxsIQPQTdGxkJKTVTpEuZpaZE9DgSpNd0PkTrQaxHQolSSq6MHss7UVfPpqX94H04uNWJdHPxFLrO2E1rmFAAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217022751832.1810306730484; Thu, 21 Nov 2024 11:23:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECku-0006N3-KQ; Thu, 21 Nov 2024 14:22:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECks-0006L7-5n for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkp-0002WT-1o for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:17 -0500 Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-336-8YSHDf6WPzOtlfuOmanNzg-1; Thu, 21 Nov 2024 14:22:12 -0500 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-83aba93c01bso138019839f.2 for ; Thu, 21 Nov 2024 11:22:12 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216934; 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=RXA6V54Db51w/r+lVndlovYUw8qq+lukW3/9OKGx92Y=; b=Xxj7ZgDQEuIHOL7hZcJAMSNBMT1lzUW4kMrU+3raBIcUStypqRL3HDPtezUqF8GZtDpxob RIL3XodkRcXoQVwKmRtoXsf+b/CLchJ6cMjp2RFRSo/kx3A8NUA43uRF53FPpjpvAaVeWy 4Dgd4V1vkeVb/GcBuLnyu4pmLnU8pQE= X-MC-Unique: 8YSHDf6WPzOtlfuOmanNzg-1 X-Mimecast-MFC-AGG-ID: 8YSHDf6WPzOtlfuOmanNzg X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216931; x=1732821731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RXA6V54Db51w/r+lVndlovYUw8qq+lukW3/9OKGx92Y=; b=Yz/tDRi42JDtNu5E+TYkaUbheyIw7B+ABDGdJqoAj7RcbRmv0RPX8qHuCEx6J0yEZp 81C2BzVQnJKeAaTg5xjwKA4V27IgBvBicaig808VVzx21y8+YqzwUuAeI4YUb+YTjLmR BVTSqGW3e/w4LQZVIwP0Ew65FP7zR9aALHLOJwUTcrVmr1uGre+JvX536uMNbPTMlhTO NiaW3rD1BKPp1U5BC0ISGkV+LkxV3I4rdSOJpmFh+Y27nZZOpYamTmf8re4ticZe1M+6 xL52jWZdpk4wDlPqJ+Htz2pQ8DKlfGywK8Xau8Y6A9rs0Gdai3p2XGUXOUETfZ6bQzd+ uFlA== X-Gm-Message-State: AOJu0Yyv+0UV/MpmtNAz7GBGQT6GW2rvZ5aHvpeosA/EsOrIn/xBGPau L/KAnkNM6YuKhhg379xYsWLxqP6MYgmY9L4mpZxZrQDPuAn/njxdjC/KArga2LdLg3wkeiX5yrF g2FjgouCE4n+Jwh+76l1Hi23RlgrDpQ9HpV6fEgYi0TobUd1nmA+mZKufV5G2RE55z21qxJ9tGk q3NthjZtOozf6J0KhstbIYbmv2fWsv2XeqxA== X-Gm-Gg: ASbGncuiFrvoU4t62fxsNRY2miAqZfxkKt2mSpiFUgX11FJSh0GQmG/bmcHhGGW7DgH bfN7KOoZ0JTWvlPE6OK6UrBK/YsTEWCxT3OfCBV5ZUzaclq1gxfB5bYnjaQt7oqEEzowCXO6Iv/ SsKAUYsEtXx0VYTvNLMeoZyiSre0zmfoiWjZETHRaZVi0k1sx5g0A7gNRqppqM/MIyenqXFPYVZ TGKg79r1i3DpC3fGebUinmHnBdaSPBHY9Xitlwx3WacqOdSstrl1SxoI/QSaMCzrURsCeXCNExz 1/mge71bp9s/ENGkvwJVQePetg== X-Received: by 2002:a05:6602:1345:b0:83a:db84:41a8 with SMTP id ca18e2360f4ac-83ecdcf3ca6mr9246539f.10.1732216931476; Thu, 21 Nov 2024 11:22:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGLuW7O6ZSc8vUMk82eQ+C2nbxh6XjT2Ifaiu9QDIvfAtvCwxQgglH/X3KVTBphwZZw7AuYQ== X-Received: by 2002:a05:6602:1345:b0:83a:db84:41a8 with SMTP id ca18e2360f4ac-83ecdcf3ca6mr9243339f.10.1732216931104; Thu, 21 Nov 2024 11:22:11 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 04/13] tests: Explicitly create containers in test_qom_partial_path() Date: Thu, 21 Nov 2024 14:21:53 -0500 Message-ID: <20241121192202.4155849-5-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217022955116600 Drop one use of container_get(), instead switch to the explicit function to create a container. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Peter Xu --- tests/unit/check-qom-proplist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/check-qom-proplist.c b/tests/unit/check-qom-proplis= t.c index 79d4a8b89d..b48e890577 100644 --- a/tests/unit/check-qom-proplist.c +++ b/tests/unit/check-qom-proplist.c @@ -610,7 +610,7 @@ static void test_dummy_delchild(void) static void test_qom_partial_path(void) { Object *root =3D object_get_objects_root(); - Object *cont1 =3D container_get(root, "/cont1"); + Object *cont1 =3D object_property_add_new_container(root, "cont1"); Object *obj1 =3D object_new(TYPE_DUMMY); Object *obj2a =3D object_new(TYPE_DUMMY); Object *obj2b =3D object_new(TYPE_DUMMY); --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217061; cv=none; d=zohomail.com; s=zohoarc; b=D0gDWzHt9npeN0VGZxCr5R1Bv3zVnG2Eaj7XSyycv4nF57aXOomu+kiC19fuKvhxrmWByT003a6iH4d23GyKcuiq2xVfr4xyw6BGwVr1uguc5NwYAdU3RagzlGaoKKny26h+nXtoRV4zX0Gz+JjMAZ4AYwcubwEn2BytGqNSSJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217061; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kkrNtEOYB9vQPtXuGEIbWtqzeqn9cY991precDyec5c=; b=d44+y4wr4YqtQcdxY66sEx71pcuq1mMHcUnXL6xNu4Ueq20W4XErdrY70WQaYsXbMIKCAoO2smJ8w58aHctUa7Td+LCqcvzU3bydIXENX1vqQgXtQ/dCOEozL6oWrujlWz5nBh3qIK52mOlcMEGYtdahAxkCvAvQzPGWcz+lhrg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217061271160.6257402320482; Thu, 21 Nov 2024 11:24:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECkx-0006Ot-Hk; Thu, 21 Nov 2024 14:22:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECks-0006LH-F6 for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkq-0002Wh-ML for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:18 -0500 Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-pzMR_R0IMcqpwjzS2prpTw-1; Thu, 21 Nov 2024 14:22:14 -0500 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-83ab434c629so136219339f.1 for ; Thu, 21 Nov 2024 11:22:14 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216935; 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=kkrNtEOYB9vQPtXuGEIbWtqzeqn9cY991precDyec5c=; b=AxTBonpeMb8bgS7hKbeQadlUpR2Yx+OjL6lT9Nj3WOHRo7a0226zYUJjydd+cQBa5eYoCX c2YbkUeMnfRdkKXX4Zg4lXrk4umPF1BqwoHSablDz8ynrXkJJIR5rTmTe38q8Cdq25Otc7 n0XaJTxwqUCdV5XE1iPPcFd3Fox57XQ= X-MC-Unique: pzMR_R0IMcqpwjzS2prpTw-1 X-Mimecast-MFC-AGG-ID: pzMR_R0IMcqpwjzS2prpTw X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216933; x=1732821733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kkrNtEOYB9vQPtXuGEIbWtqzeqn9cY991precDyec5c=; b=rJNHwpla9lgdfun5v4MdKU1QODoapnmNsxsGEnl/m1A0Hy9iR6u2YU/tD5HTUt76t3 U8VnkJh/QdAUQjKReuJC20tqSW/NspOv/op4ZqO1J8RcvrwzLd2UawqZ9M0St0GJGN41 Dt8EBxoulP/coGuuXnygBUTzHXbCphbueQrmZK4CC+HjWzPh9qROYK5CHaNXp4sbLVXi TMhAxMdAhWBmwThJdK1r03A7t7wpBwv90190D7ZzyFFq3gesnpriAqTXMElmZEE/OoE1 K9tkG1iBMH+oQDMNy2cj7tE78DATy8NMGHCt8pUQny4gRHVHEKxkPMaYXfXojcHIpQC4 YKgw== X-Gm-Message-State: AOJu0YxxwzqdZWX0hPQ+sTbjts5sMPYMTsYjGTQ8AA4rgjp0SxwbDoMX t48UVbTUxUUEdD7RnH6dMAruIIsRDAEw0knC6ni2pTB+EJYiP8Qj/Kqv9vUOzZ/IMt4oSJ+o6Jx esj+2vdtzNBanA5iML0sH/Vv134m8RJWdJ746HywJNapTscYl+TiLQg5Zhl0cHoCfPlJ4B/IPRy oOSco0kEfK5gvmRnGz9MkA9FswHLeIXfyI6A== X-Gm-Gg: ASbGncv4t9joMeCSwN5KUbWU3vVXS/dgoQFhCh1KUupV2gl7TI+hkuMdXALAZNn7ZZH ucYAFwrMHk/EdxYxy4gnsBDp5lVxrxK0L+UW7v5F6g3qKvSg/Ps2Hhk2KayKfl5/J5r8LUG3OCF rk0fXcNNPjm1lFkjZ9UV9dEmptvY2+5AQI4Z5fuiwPKKKU94CTRyHAIioDgrBtNqyvQUXq7iy9S 5HxnIVbPUNzMIPFVEa+QRyELKo79ykUQFad1cEB/3xD3fGf/96KPRdCLi9TB/zixNBHZiBzLYtm c+c2a6scDzHx1uJuJ/WDf+5P6A== X-Received: by 2002:a05:6602:3c6:b0:83b:47:8d5 with SMTP id ca18e2360f4ac-83ecdc538d9mr11787039f.3.1732216933385; Thu, 21 Nov 2024 11:22:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjMykOUz9PAzhQC1OwN48Ig7nFDis8CFFPoMKffuWBhPNdlUn4KwZScK+t0ejysBafrnKkXQ== X-Received: by 2002:a05:6602:3c6:b0:83b:47:8d5 with SMTP id ca18e2360f4ac-83ecdc538d9mr11783739f.3.1732216932957; Thu, 21 Nov 2024 11:22:12 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost , Bharat Bhushan , qemu-ppc@nongnu.org Subject: [PATCH v2 05/13] ppc/e500: Avoid abuse of container_get() Date: Thu, 21 Nov 2024 14:21:54 -0500 Message-ID: <20241121192202.4155849-6-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, 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_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217063399116600 container_get() is going to become strict on not allowing to return a non-container. Switch the e500 user to use object_resolve_path_component() explicitly. Cc: Bharat Bhushan Cc: qemu-ppc@nongnu.org Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Peter Xu --- hw/pci-host/ppce500.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c index b70631045a..65233b9e3f 100644 --- a/hw/pci-host/ppce500.c +++ b/hw/pci-host/ppce500.c @@ -418,8 +418,8 @@ static const VMStateDescription vmstate_ppce500_pci =3D= { static void e500_pcihost_bridge_realize(PCIDevice *d, Error **errp) { PPCE500PCIBridgeState *b =3D PPC_E500_PCI_BRIDGE(d); - PPCE500CCSRState *ccsr =3D CCSR(container_get(qdev_get_machine(), - "/e500-ccsr")); + PPCE500CCSRState *ccsr =3D CCSR( + object_resolve_path_component(qdev_get_machine(), "e500-ccsr")); =20 memory_region_init_alias(&b->bar0, OBJECT(ccsr), "e500-pci-bar0", &ccs= r->ccsr_space, 0, int128_get64(ccsr->ccsr_space.size)); --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217095; cv=none; d=zohomail.com; s=zohoarc; b=hcOraDAcwwjMvcMMRKaUGf9EhcWS7WflpyWYBcxcbI4zIXydmuwi9CB+RhxavmAurkxU+kyc1tPD1GyRSTXM6xLXX4AXQj5peP74A+tUQoLeQgttnBrV1YQKTFLtf5ZsiNPzTlBfnBRdZIwDhBspbnE7Hx7Rq/7rtm6K/vfLZR8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217095; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9vhWk96oVKVLtN21I7pTVsck1ZbkLXW6bkcDAjMNBC0=; b=GxwXhrVwkie85pgXhSwXEeY/B7xzTNBrOtgqJMjy7TgaRbXx0DeMaurzr/UYf2Ll3PRotZZYcUDI47uT3pzcWgaClZ7pqXxboLnO6vlqfeyB8emu+aPq/OzxBbAPWQ9L7WXT3IpX2rqbpTVroGBDfvarYfIsfqv33/2/XMHFTN0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217095173851.971149554065; Thu, 21 Nov 2024 11:24:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECkx-0006Oo-BY; Thu, 21 Nov 2024 14:22:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkv-0006NI-1x for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkt-0002XI-Gq for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:20 -0500 Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-FyAXN09TM9SWyACrcugbJQ-1; Thu, 21 Nov 2024 14:22:15 -0500 Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-83ab4cadf05so130035339f.1 for ; Thu, 21 Nov 2024 11:22:15 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9vhWk96oVKVLtN21I7pTVsck1ZbkLXW6bkcDAjMNBC0=; b=QRYbE35zzNcYIRSfSJnvCbvDN5CPxrRmsE08ud4T838sQYkuiZrDfKv+EPMKM8wK1gkhbr gZUZs+U7G+YZt6rnisInun8F3BH65viWnWE82c3crDhM+F2VG1tskAujXZv1fNjSKPhS5C J8wB185H2kCKZ5t4zXlaHawveoYj5So= X-MC-Unique: FyAXN09TM9SWyACrcugbJQ-1 X-Mimecast-MFC-AGG-ID: FyAXN09TM9SWyACrcugbJQ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216935; x=1732821735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9vhWk96oVKVLtN21I7pTVsck1ZbkLXW6bkcDAjMNBC0=; b=K86e9sSovi8tUrWOoj2u7mzGkhHyeuKRhOOnRoShv8lqOlRSDxY3+iuYEpART8HJsJ /pXkXhgMqtT+pEZ0EUDJzVh8L2HfiEvhL0lgInIHPmpSn0eMccButFPPmz+oRa67WmY2 uIB/0kY0/wdwN0On7+wWHAeCGGQH2OBmGViem+XxQ6m2RVJuU8Z8eMGZMwRkMIicmNza 6oNa2DidCp0fevOTa+TGd6vYqtE1xzz3WsBcdey4SzFWwUk9jUNw4CeKhM8ilsoO0NWj IOrynPXN3yWDlO1rs7yQSBhqHKaJyutN2JwrD2hqL6IoMHf1iyc7MDokQm/IAGRDnbpO SEZw== X-Gm-Message-State: AOJu0YyZd4rKovsTfXM5dE+CFLB2dTGTprc0L7qGMyfQ72J+KjuDBId0 Q+LuXclzaau9rUI4hwVv3r2o0bnWeLBkxQKgl91aWzCZ0kKq6WTnLxw5FH11AhmW/ZmcZ+g2DqM yivTwI6GbWQ3lhvF2ApdBKngezL4lVgvueNo6uJTRQeRpTmTZ5lQqp3RAdzPecsW7vCcCXmvQNP NSoFzuJ3qeW15K2NzEUwPaEu5xJeBBCKs8Xw== X-Gm-Gg: ASbGnctr6JluL71VOUBnBCYgfG7mrQniBfptHHtD7q2JULOva63xOQ/PlAeqlXutaKv 7uais8ruaj+7um+dDEwuen99e56cH6NlqS7N9OJiZa4x1YHSXSZ6SMBH8L1OIhTzMTv6r6JpUIr DPqGu80nPt1ok9yzazJ26vIx0BQ+OwIml+kwNsC9w5msseiSXocyIzGpk+dd+iEvFpN1YZtprEm pcIS1sqYMsx4b8GWQMbhm3PAtLb6fx8FAtYYfgulRDRutwKVDy9sh8yWFmfe25myJzz8MrXe2pH F/QkbZAoHu6IGHnNS39mVgDtzw== X-Received: by 2002:a05:6e02:b43:b0:3a7:9347:544c with SMTP id e9e14a558f8ab-3a79acf1328mr3232015ab.5.1732216934890; Thu, 21 Nov 2024 11:22:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ35yTgMJ2Y/HqLTkFsuIdcK9Sy9folVM7pfXDE+0nCsBsv2BPf84/5/OfDOW35cS9Kbd6Pg== X-Received: by 2002:a05:6e02:b43:b0:3a7:9347:544c with SMTP id e9e14a558f8ab-3a79acf1328mr3231755ab.5.1732216934567; Thu, 21 Nov 2024 11:22:14 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost , Nicholas Piggin , Daniel Henrique Barboza , Harsh Prateek Bora , qemu-ppc@nongnu.org Subject: [PATCH v2 06/13] hw/ppc: Explicitly create the drc container Date: Thu, 21 Nov 2024 14:21:55 -0500 Message-ID: <20241121192202.4155849-7-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217097424116600 Content-Type: text/plain; charset="utf-8" QEMU will start to not rely on implicit creations of containers soon. Make PPC drc devices follow by explicitly create the container whenever a drc device is realized, dropping container_get() calls. No functional change intended. Cc: Nicholas Piggin Cc: Daniel Henrique Barboza Cc: Harsh Prateek Bora Cc: qemu-ppc@nongnu.org Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/ppc/spapr_drc.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 1484e3209d..7868048bb9 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -27,7 +27,7 @@ #include "sysemu/reset.h" #include "trace.h" =20 -#define DRC_CONTAINER_PATH "/dr-connector" +#define DRC_CONTAINER_PATH "dr-connector" #define DRC_INDEX_TYPE_SHIFT 28 #define DRC_INDEX_ID_MASK ((1ULL << DRC_INDEX_TYPE_SHIFT) - 1) =20 @@ -514,6 +514,16 @@ static const VMStateDescription vmstate_spapr_drc =3D { } }; =20 +static void drc_container_create(void) +{ + object_property_add_new_container(object_get_root(), DRC_CONTAINER_PAT= H); +} + +static Object *drc_container_get(void) +{ + return object_resolve_path_component(object_get_root(), DRC_CONTAINER_= PATH); +} + static void drc_realize(DeviceState *d, Error **errp) { SpaprDrc *drc =3D SPAPR_DR_CONNECTOR(d); @@ -529,7 +539,7 @@ static void drc_realize(DeviceState *d, Error **errp) * inaccessible by the guest, since lookups rely on this path * existing in the composition tree */ - root_container =3D container_get(object_get_root(), DRC_CONTAINER_PATH= ); + root_container =3D drc_container_get(); child_name =3D object_get_canonical_path_component(OBJECT(drc)); trace_spapr_drc_realize_child(spapr_drc_index(drc), child_name); object_property_add_alias(root_container, link_name, @@ -543,12 +553,10 @@ static void drc_unrealize(DeviceState *d) { SpaprDrc *drc =3D SPAPR_DR_CONNECTOR(d); g_autofree gchar *name =3D g_strdup_printf("%x", spapr_drc_index(drc)); - Object *root_container; =20 trace_spapr_drc_unrealize(spapr_drc_index(drc)); vmstate_unregister(VMSTATE_IF(drc), &vmstate_spapr_drc, drc); - root_container =3D container_get(object_get_root(), DRC_CONTAINER_PATH= ); - object_property_del(root_container, name); + object_property_del(drc_container_get(), name); } =20 SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, @@ -585,6 +593,8 @@ static void spapr_dr_connector_class_init(ObjectClass *= k, void *data) { DeviceClass *dk =3D DEVICE_CLASS(k); =20 + drc_container_create(); + dk->realize =3D drc_realize; dk->unrealize =3D drc_unrealize; /* @@ -796,9 +806,8 @@ static const TypeInfo spapr_drc_pmem_info =3D { SpaprDrc *spapr_drc_by_index(uint32_t index) { Object *obj; - g_autofree gchar *name =3D g_strdup_printf("%s/%x", DRC_CONTAINER_PATH, - index); - obj =3D object_resolve_path(name, NULL); + g_autofree gchar *name =3D g_strdup_printf("%x", index); + obj =3D object_resolve_path_component(drc_container_get(), name); =20 return !obj ? NULL : SPAPR_DR_CONNECTOR(obj); } @@ -860,7 +869,7 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, = uint32_t drc_type_mask) /* aliases for all DRConnector objects will be rooted in QOM * composition tree at DRC_CONTAINER_PATH */ - root_container =3D container_get(object_get_root(), DRC_CONTAINER_PATH= ); + root_container =3D drc_container_get(); =20 object_property_iter_init(&iter, root_container); while ((prop =3D object_property_iter_next(&iter))) { @@ -953,7 +962,7 @@ void spapr_drc_reset_all(SpaprMachineState *spapr) ObjectProperty *prop; ObjectPropertyIterator iter; =20 - drc_container =3D container_get(object_get_root(), DRC_CONTAINER_PATH); + drc_container =3D drc_container_get(); restart: object_property_iter_init(&iter, drc_container); while ((prop =3D object_property_iter_next(&iter))) { --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217022; cv=none; d=zohomail.com; s=zohoarc; b=kt6+o3UBd6nb8svgKC8dsaVZkCSZQM7pNq/mWFQjxFgogw3OBcNa/+kN1+7uOxNschWq7in39sh58PZoMjLj1fgE+u+rzQdgOk+Ww1warhRYzPVTBhy/a3A2VlLxmCo1pYZ0J1Re/z/RR8IAcrLoBogXK6XHwQYkWx6jDOfhr68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217022; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6wi3a24EwlWSm8KKlUNodK3qOGR7+qV5BdxljVXUq0A=; b=aWN79ZOyDSmgmWWNEURU0h6ncPWgvhSaIubvAiM1lEehMIm0ilEh9NcZ7da2y4SU66EuWPMDPmfq58TN9rk/5A4xtkj5Oi+/hStH/9OJ1poWUHogbcFKzjWrTJ2YlvU7TUsur8IKNxw1bL+dRqF3dzRAoSNIca8Mhbkq4daVB6g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217022201252.4844110169122; Thu, 21 Nov 2024 11:23:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECkw-0006Nl-C0; Thu, 21 Nov 2024 14:22:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECku-0006N7-Td for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkt-0002XF-GE for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:20 -0500 Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-6G1CYKsPPYWa_qnNXqmg4A-1; Thu, 21 Nov 2024 14:22:17 -0500 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-83ab369a523so126960439f.3 for ; Thu, 21 Nov 2024 11:22:17 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6wi3a24EwlWSm8KKlUNodK3qOGR7+qV5BdxljVXUq0A=; b=JXelRqa7qtpmbtKU6KcCNyh/EPz4TEf3akaZbtjAUZCOzgHk7F05IOR1isKNgQEEcMTGXE aWwh6gk0TU4N3Ac1XNtCmCt7KI6BhKAtbGRwiS8a+I9gTh9LyvV9ySet6WKMUI/c5hxxgN dAYFaY+WYG4MijHpeSiZOO14fYkKqbk= X-MC-Unique: 6G1CYKsPPYWa_qnNXqmg4A-1 X-Mimecast-MFC-AGG-ID: 6G1CYKsPPYWa_qnNXqmg4A X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216936; x=1732821736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6wi3a24EwlWSm8KKlUNodK3qOGR7+qV5BdxljVXUq0A=; b=ceAFLYe8dyoV4/MER1DXyN54BjNe1xdQqbrL/fL2P6kRJ6HUJxSDME8YbnLVozjQa0 wDwF64uZak5zusRGjdx3Ad/8mUBVYYGza4ez6WIx8j8Lifiue3mR+wWqewO9rUSEhlUh sXZW1YiTxVwlVfgOqXIbNIwluysof7SbHCIiLSgk8kDHQDCQM0BJMlgoClyskDZZoyiu fhg/oN2R054lGtUpgrPBLVXazHj73ar/3oJdmMlzOGPc4mCEYvHHcrYkrRsNwg2uMn4t GptZt0tZmO2oXObpAcLDKJx8NauPHypSrmAzPyvfOYzwWjtw4QItt5Ay9mvnFTUipmas kCSw== X-Gm-Message-State: AOJu0Yzhg+5ZdGaUnqbDt+GS+QaWMSAE9jA1Y8ClR96UackmWn8ptUpZ XXkHJ8uvWVytkJQgZ3TN43BvQUrOERI8VK621KC/lLk3iB9fnt/f73JuIR6eUtfNRQlCxD2zQMP BFu1s+fVIHAFuWnx2vTKbe1DkwIewRpF6Z4d0XKPkVyzHn4FyfGMtrAYxYFm2igwjXzmOF1OaHo RespSLtVcASOmItiq8LWW57KrA6o0YtHassQ== X-Gm-Gg: ASbGncvwjgcAuiaCtXTj2tfZ4c6AAH698NZ+QHTLJLg3x/cZ9vAuopgLLrqUYzF9seF MytPxtFcNJ3cH6vstSpxvybkoR++KGLD8I/hlR1tlaoYVl/3l+v2728yZKZLa6gYnq2Ov97BAMn wLKzH/wAnSiiUydj1Sfxtekss3f5AN0jQ64Yszygj8IMW+YQkU0tqQHjBL0pP+qPbkMzYO8SqX2 DtPVlN5XMEM35Dsc7j6HD6iznOu2Bsi9fxmtobgKr47e6XVGoLnK5N0YAzeDHYdcqan+WMs+I/q iLX4Rk+hvtj6B/ap1hoGs8ClMA== X-Received: by 2002:a05:6602:164d:b0:83a:b98e:9240 with SMTP id ca18e2360f4ac-83ecdd0751bmr6807339f.10.1732216936482; Thu, 21 Nov 2024 11:22:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJ2nr+VQz8EEpvGGMyts+ZkYQGr3pmeRUDUDSvsyNCf9o4CqS30t7FCPl8FyT1JWnu5ol00g== X-Received: by 2002:a05:6602:164d:b0:83a:b98e:9240 with SMTP id ca18e2360f4ac-83ecdd0751bmr6804739f.10.1732216936148; Thu, 21 Nov 2024 11:22:16 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 07/13] qom: Create system containers explicitly Date: Thu, 21 Nov 2024 14:21:56 -0500 Message-ID: <20241121192202.4155849-8-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, 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_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217023037116600 Content-Type: text/plain; charset="utf-8" Always explicitly create QEMU system containers upfront. Root containers will be created when trying to fetch the root object the 1st time. They are: /objects /chardevs /backend Machine sub-containers will be created only until machine is being initialized. They are: /machine/unattached /machine/peripheral /machine/peripheral-anon Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/machine.c | 3 --- qom/object.c | 24 +++++++++++++++++++++++- system/vl.c | 16 ++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index a35c4a8fae..a72c001c3d 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1198,9 +1198,6 @@ static void machine_initfn(Object *obj) MachineState *ms =3D MACHINE(obj); MachineClass *mc =3D MACHINE_GET_CLASS(obj); =20 - container_get(obj, "/peripheral"); - container_get(obj, "/peripheral-anon"); - ms->dump_guest_core =3D true; ms->mem_merge =3D (QEMU_MADV_MERGEABLE !=3D QEMU_MADV_INVALID); ms->enable_graphics =3D true; diff --git a/qom/object.c b/qom/object.c index 214d6eb4c1..2fb0b8418e 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1734,12 +1734,34 @@ const char *object_property_get_type(Object *obj, c= onst char *name, Error **errp return prop->type; } =20 +static const char *const root_containers[] =3D { + "chardevs", + "objects", + "backend" +}; + +static Object *object_root_initialize(void) +{ + Object *root =3D object_new(TYPE_CONTAINER); + int i; + + /* + * Create all QEMU system containers. "machine" and its sub-containers + * are only created when machine initializes (qemu_create_machine()). + */ + for (i =3D 0; i < ARRAY_SIZE(root_containers); i++) { + object_property_add_new_container(root, root_containers[i]); + } + + return root; +} + Object *object_get_root(void) { static Object *root; =20 if (!root) { - root =3D object_new(TYPE_CONTAINER); + root =3D object_root_initialize(); } =20 return root; diff --git a/system/vl.c b/system/vl.c index 3bb8f2db9a..15e35162c6 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2112,6 +2112,21 @@ static void parse_memory_options(void) loc_pop(&loc); } =20 +static const char *const machine_containers[] =3D { + "unattached", + "peripheral", + "peripheral-anon" +}; + +static void qemu_create_machine_containers(Object *machine) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(machine_containers); i++) { + object_property_add_new_container(machine, machine_containers[i]); + } +} + static void qemu_create_machine(QDict *qdict) { MachineClass *machine_class =3D select_machine(qdict, &error_fatal); @@ -2120,6 +2135,7 @@ static void qemu_create_machine(QDict *qdict) current_machine =3D MACHINE(object_new_with_class(OBJECT_CLASS(machine= _class))); object_property_add_child(object_get_root(), "machine", OBJECT(current_machine)); + qemu_create_machine_containers(OBJECT(current_machine)); object_property_add_child(container_get(OBJECT(current_machine), "/unattached"), "sysbus", OBJECT(sysbus_get_default())); --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217123; cv=none; d=zohomail.com; s=zohoarc; b=CqBlVF7bDZ/ydXZDfdwa/0xWKJXLF9aexCmqw+oVEa2RzcVKv4g+GvPUgemQ4xO9w1eVazJLInI7SSxeiDXY8MHvFM7Xm+3l/SxNqvqFxh5yHYHOv+jiFy1Ghu0Ki+E/yunwFO41hLp2pxUDTE7i2lotPLm8APVy011t3rKZsmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217123; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NNGi4ej7Fg7tteZhHhZhqwNjB+z3TQfwwETPIXYXWJc=; b=JwCgVe0cu4f1T4d3mt2IAeHYC8CGjMjkPWmeLVmfITnYeF4vUnWjHlOHrikuPrRxx2a+l5qgJe1M9ybwJZIuaOjn3vIbaAcXE8sBX5Ab6nweuBlhm9rRj4z7/KCzHfnxrUsQu1FYJ0xo0/sfg7piJz2rfaZCDdsMgMXfvVjqU5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173221712370814.22790518862405; Thu, 21 Nov 2024 11:25:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECkx-0006Ou-MR; Thu, 21 Nov 2024 14:22:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkw-0006Nd-7D for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:22 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECku-0002XV-Qg for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:21 -0500 Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-ymKFAnaQOB2JH-T_x_bVfQ-1; Thu, 21 Nov 2024 14:22:19 -0500 Received: by mail-il1-f200.google.com with SMTP id e9e14a558f8ab-3a6b9f3239dso15371455ab.0 for ; Thu, 21 Nov 2024 11:22:19 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NNGi4ej7Fg7tteZhHhZhqwNjB+z3TQfwwETPIXYXWJc=; b=cIYRuquorjffOkKxoSseRZRjFK7IvsweeTmUUfVcEY+Ea3te2ddXSVLTv3db6a2QCZWYAE 7OlmkoxC/oh4krfFywvLlYCm9R9yiXiJkk7h7YyxMLrqwGwyjj5JDo/DuE4MZKyp+SFefU yhq//u6BorzjevkVEXIgoyqZHulIVJc= X-MC-Unique: ymKFAnaQOB2JH-T_x_bVfQ-1 X-Mimecast-MFC-AGG-ID: ymKFAnaQOB2JH-T_x_bVfQ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216938; x=1732821738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NNGi4ej7Fg7tteZhHhZhqwNjB+z3TQfwwETPIXYXWJc=; b=Ekwn3vJhEk6VdmR9eA8vbPZBpFODiY2fkJNaX9XYT8LMaF8qQEnzzVcparU/kqWJNW EuasaAFBykNW5G+1PJZGQc9EaFrQXP/YJZUuo/TPk+U1hrHG88lpTEMNZecXMbAQ75O1 tmSTQY2LO+n6WFdQt6NTfOJ9SlKkesOCUv1L317yU3xLKkJZuV9KA6tW4/ON4wRZikZF lLgX/NtwnhA8GZn2hEKEqMJkP/dBkNoBAf8vRn034Yo6eg/FZb/n8Ar2L+GfaFTA3vcb bxzX6hRNI7aJTrqPsww4Afd/Z6kBxpWOmlt3cuk1N+5Efr9dob64BXQbbDsPjW+kEejI 0I5w== X-Gm-Message-State: AOJu0YzJWgEgpP6OMP0kqm4ShJqK0cVXTfp+nXhuh/uvyZ/9R7Xr3dQE GFhLbIx4GmXi7WxCRdiXusAxMYJHtTEf6hPBouY+3PGZNd23SLtPaa7nvqvTumMstRq/kvbWa8P lgiIPjbNM2kw+eGscxwqH0BbBLYE05KKmNEdMEFlcRGowNmkj6AOiWEGMWa6ExdxrMeTztDP5Te eAq1HmfLhl9TVVKPempii64aUvOerhLwz9vA== X-Gm-Gg: ASbGnctOEa2RKLoY3SVbIkLahqz+61jyMdUOlBVRCC7aQtYkrkhymBGfPeu7QMZoftj D28kKi6qmS1S4EJD9yB5bhlA21js7cukv9+U840hPp38BbT97AiGYFftxryhC2TWd7R/kbsjsRH Uvg7KsBFhhtreByYC3jgsdqgg+LcaIq1ehDYUDZ5k9wwI1lyQv0ngZWtHszuLc6Z6by1Ltg6uAm NWdictGgYv22HYHnTzol8ubBr81kr5zQCjvPRARVBIO31z4sHD6G096P5eJJtD5IcjPYfKgO12e QUNiU5CwGtB0+m8GBlR82hTK1g== X-Received: by 2002:a92:cd8a:0:b0:3a3:b45b:fb92 with SMTP id e9e14a558f8ab-3a79af36205mr2876675ab.23.1732216938009; Thu, 21 Nov 2024 11:22:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCi+Pj7dPKfs3PacewTfRe6i2e4IKQWd9yM8AWlvX1od0kORirM6HVAIy/baI5mfV1pnEQdA== X-Received: by 2002:a92:cd8a:0:b0:3a3:b45b:fb92 with SMTP id e9e14a558f8ab-3a79af36205mr2876115ab.23.1732216937538; Thu, 21 Nov 2024 11:22:17 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 08/13] qdev: Make qdev_get_machine() not use container_get() Date: Thu, 21 Nov 2024 14:21:57 -0500 Message-ID: <20241121192202.4155849-9-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217125584116600 Content-Type: text/plain; charset="utf-8" Currently, qdev_get_machine() has a slight misuse on container_get(), as the helper says "get a container" but in reality the goal is to get the machine object. It is still a "container" but not strictly. Note that it _may_ get a container (at "/machine") in our current unit test of test-qdev-global-props.c before all these changes, but it's probably unexpected and worked by accident. Switch to an explicit object_resolve_path_component(), with a side benefit that qdev_get_machine() can happen a lot, and we don't need to split the string ("/machine") every time. This also paves way for making the helper container_get() never try to return a non-container at all. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/qdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 5f13111b77..b622be15ee 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -817,7 +817,12 @@ Object *qdev_get_machine(void) static Object *dev; =20 if (dev =3D=3D NULL) { - dev =3D container_get(object_get_root(), "/machine"); + dev =3D object_resolve_path_component(object_get_root(), "machine"= ); + /* + * Any call to this function before machine is created is treated + * as a programming error as of now. + */ + assert(dev); } =20 return dev; --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217060; cv=none; d=zohomail.com; s=zohoarc; b=PpKR6gwLdRC/6iUamSfqvKV+3A6XpP0CY/ih6gKgpuKX0DOqKuruHoX3D2+SM3rWWm4zCcf0pdmPjYugWwtjQYnmIMsLfvbKN6dU5m+biXFWBaf8lZKQGk7k+A9paUpEAHjQRWAjCHXcJXUrryOF8rvTLPV3p0JhlAU8OeXdc0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217060; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EuGehJbgv141qLUXVKsNXVVCCq2wAofdQ+Smc8OM5Tc=; b=VhZ/zKiOGxZcaAYonbb4UbctLvOYTBkLjwv/6cxBkd/v80ChxI0LZIP99nMr1InRJJ1Km7jjVYCMDc+NkMdvKUPF9gW7tHeT/YfvgkJaMSdEZTEgJ7DDmcZVoSmD2PmY+p3nlJFY3kBhxNKZt2E43BjRgfYG09WQKkAwGYbQxFk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217060897878.0057175545508; Thu, 21 Nov 2024 11:24:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECl4-0006Rq-Dg; Thu, 21 Nov 2024 14:22:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl1-0006Q7-Dg for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkz-0002Y3-UM for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:27 -0500 Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-55-STuK16_OMeuexs0eqo49ag-1; Thu, 21 Nov 2024 14:22:21 -0500 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-83ac354a75fso136820539f.0 for ; Thu, 21 Nov 2024 11:22:21 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216945; 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=EuGehJbgv141qLUXVKsNXVVCCq2wAofdQ+Smc8OM5Tc=; b=NWNZGsdO21QRXN6eTWVrznTTVvSTfwLZjWeEj7Ak9UiHdGKwUMHfTIydU85KpYmwiENvun 8ExUNCe4YLtMA5D7K0UgFqwhJIOdKBT9CcPRDEbxOEBidAheahIqHbMc159lW9z4eUyrn4 R8NbfFX8/7Xlmg/Zopj/XUxSgZpW53Q= X-MC-Unique: STuK16_OMeuexs0eqo49ag-1 X-Mimecast-MFC-AGG-ID: STuK16_OMeuexs0eqo49ag X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216940; x=1732821740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EuGehJbgv141qLUXVKsNXVVCCq2wAofdQ+Smc8OM5Tc=; b=ezlCfj7xGReSXIXAZkrfwjB6JCstv6JdTMeryNr7UwoaL1TCQs8BRCKDmabG2kmbKB YCr0eASjitxhlx8+lnixTbFCPiHR2jdlxOAizMuOY2P3Wbr7pzF+a4FtgPlNozXyFUyi PJ6NyD58sRrSBtZUEhxC8ECpblolD9fyh3gI9oyeoy2VZ9aXlP+ICcWqj9RBfQNPDoVV hcl+IOERob6ylgad15ptoDJOYTnn3VXeFSCuI5D4lrIJOB8u5HXOhUt12VsyVX1SVxL7 h30QQfWF3P2Vyfr6+2P5kZplAFDYoi/73T4CXVJ83uDMGcOtecA+nMbuMTsWVeLM7Dq2 g58w== X-Gm-Message-State: AOJu0Ywpv4uW+6e4snVog0zC2I0IwTXki2rC9+AXpM1zWGLP6Q9+TYTG Lk9XMZLuqPGKLPCU2ccaZJ2qt3zfKVFXayleT2O/UnOH96oaR1N2t0iUkAIDw86ZEmANKDa3Ysz 4FnSUnRBGS9sPFFpVFb6+ETyG9jLjJPz4m5W4cWpLH03bOQ+zqAwjTyYd9Kh5p0252HOMUZJI2w FISLCoenPHOKvtISEKNqhEdTHUvrh0z92tgw== X-Gm-Gg: ASbGncvpOV4MF2TaI7Dq1PTPo1iyniw7mv1TSYwALZqHRbtgNjW9BsoWavo6Cn1DwTM otQYJ9c0OfXL5udcpyp+xUfaW4/t3z9M/8UuFHU4oAWXI16KNnzSurGwKsqXIWFKfYh/9TNOPmc +uuumdFCfqtmZQs+wIJQTXMWsImpe8owimpVVCerwQLjt6r59/y5sbvTDmJu6ekC5b1yfh5lCkF kQOssBBfae/virO8UggK3e7G5RPQldRDc5q28eyscLdd3p/f7p0ruz/oFnABCrx50upv24gYW8l DpgPwvDroP7NqBZJ2RfAplidZA== X-Received: by 2002:a05:6602:29d4:b0:83a:a746:68a6 with SMTP id ca18e2360f4ac-83ecdc611d1mr13102439f.5.1732216940256; Thu, 21 Nov 2024 11:22:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWO7+68ekArDszaWSulrWY2ZxtmZ3Hlm0inaZJbNq63vsipazd5paMUDLaMzCUeV65K9Ze4w== X-Received: by 2002:a05:6602:29d4:b0:83a:a746:68a6 with SMTP id ca18e2360f4ac-83ecdc611d1mr13095939f.5.1732216939493; Thu, 21 Nov 2024 11:22:19 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 09/13] qdev: Add machine_get_container() Date: Thu, 21 Nov 2024 14:21:58 -0500 Message-ID: <20241121192202.4155849-10-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, 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_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217061119116600 Add a helper to fetch machine containers. Add some sanity check around. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Xu --- include/hw/qdev-core.h | 10 ++++++++++ hw/core/qdev.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 5be9844412..dc6cd951fa 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -996,6 +996,16 @@ const char *qdev_fw_name(DeviceState *dev); void qdev_assert_realized_properly(void); Object *qdev_get_machine(void); =20 +/** + * machine_get_container: + * @name: The name of container to lookup + * + * Get a container of the machine (QOM path "/machine/NAME"). + * + * Returns: the machine container object. + */ +Object *machine_get_container(const char *name); + /** * qdev_get_human_name() - Return a human-readable name for a device * @dev: The device. Must be a valid and non-NULL pointer. diff --git a/hw/core/qdev.c b/hw/core/qdev.c index b622be15ee..fa3bc85d9a 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -828,6 +828,17 @@ Object *qdev_get_machine(void) return dev; } =20 +Object *machine_get_container(const char *name) +{ + Object *container, *machine; + + machine =3D qdev_get_machine(); + container =3D object_resolve_path_component(machine, name); + assert(object_dynamic_cast(container, TYPE_CONTAINER)); + + return container; +} + char *qdev_get_human_name(DeviceState *dev) { g_assert(dev !=3D NULL); --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217023; cv=none; d=zohomail.com; s=zohoarc; b=dOAZmtHSv8HH6L+Rce0MG1953tBAprgvinYpXoxdxxNycYNp+e+HbQEm4S4ltFFoI/s4OOxLP6/MhFrlblkF/mScazv40oYxfhva3oe89HHPTyDF/bBLX55wSlBgMCRe2vyP9UQtWO74Dz9L9aPkhPcmwRQ0J9ujne8Yjaie7Jw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217023; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UK/Elqka/VxSTfGrQ82qaQxK80KUlVn54aM5DoC1EMk=; b=fmn851D+SbNSsb6R+gCH1ecm8ZtUmFapBJpYUruNEgIc+pubTfiy8cXuVGdebICIzzzQDRx5+RGh+Y13HoQSWMmB5GjTtH6acd7QwubcTfYqF32X65hKXboI7a0ICTCszyXhJ44QU8RI5I3mq+FaT24QPoIbfNUKqlKtl3V53wo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217022994682.2792834473604; Thu, 21 Nov 2024 11:23:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECl3-0006Qt-DW; Thu, 21 Nov 2024 14:22:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl0-0006Q3-Vo for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECkz-0002Xx-6l for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:26 -0500 Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-219-Mp_IYnPcOpm__HMpc1YFSw-1; Thu, 21 Nov 2024 14:22:23 -0500 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-83abb901672so141640339f.3 for ; Thu, 21 Nov 2024 11:22:23 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UK/Elqka/VxSTfGrQ82qaQxK80KUlVn54aM5DoC1EMk=; b=LyllM0UfvToLqIsCmDqmGTvo92UJ8svHpj4Ca2a7zM7WP6TfaZmE8+z7IX3Mm4Nw93tcy0 9B1q7mqGE0GMDyLbHubNvgCykD4EynRBUT2zOyg55bFGVYQ2U6lbZYCnn3WKYNAL5LZ8hb 9T9Jeil8EsX3QqbjtYx7CQf670aiwG8= X-MC-Unique: Mp_IYnPcOpm__HMpc1YFSw-1 X-Mimecast-MFC-AGG-ID: Mp_IYnPcOpm__HMpc1YFSw X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216942; x=1732821742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UK/Elqka/VxSTfGrQ82qaQxK80KUlVn54aM5DoC1EMk=; b=rm/zAv8n/Nvdj+8OhUNxt1LVD298flu/mwcoi0QE8mJtm3QDA34wCi/c7I8k85/cgZ FxL3Xv3Bmku3B8g3bzP/+VOTBKYdfC3WUXnsXUkAklb7y8rnle8wSHBSk+cjMDMZY1V2 CWrOtZYvqO74dKFgM2EeJstYVANTqRwrewp8b/evNM4AhXkAySLRLBaDSmEBzr7hUI4k zgdHxy6P0dn2Cf6fKIvDK/PQp8vgYxfvhCnNyuSiGHicIieVxeJiFykNzXQTyyVwDfXo GYtDmANdOzjLugjN4347T/8zwAc7MbzZL8AyjIOijfMUKpyS5fK4VO/RsbuNIETY1Vvs Vcqg== X-Gm-Message-State: AOJu0Yxdhobxwd+fINaSmRovvbHU4L89XJ4whuBZujm/QfNk1CkAMJjY rP/BQLqG7ReopEUvpQ++J3j/H8aFy0CFwPi0TX8U6aT8AUCgPDpm5PBOwLyDTBuJshE1t+cXc7R F/RlusHGfyY4B6LedKhh0hYWCeyGYBy4KK7t/OevCPls/Sm13N2g34GuiIXNHLt3a2mhunsbblL REMS4kyK8ZyCuudhvxgjCpGrqGG4e0sfJq2w== X-Gm-Gg: ASbGnct177L288v2ITXC/JPASYy+Kdpt4oVoNBtDEBxdilWVONZV0mhzrHSeIMDVPEP 12jtgYvTzlbiYKQROBNHvvJZZ0wtfJyFwfteOgoG+1PuXYw1s09kHVx4E4ZmyVVVdXmEU6lYT7M XE17t5Y6XJiW379N+KeLEg1fflcti48NDzf2DWKYnPCV6JDNos1LBlIvu3FKglUE7Wkkv/jY1ky pbm8ornQdbI5qE+F/LTysgW5eZSIdPgC6DccvWpYJFompRooJ2rHYf+4HFIvO7U/wpc/h7EQT0c 5rXjR4nzpDKZsblWn8u4VKR5Rw== X-Received: by 2002:a05:6602:2c8c:b0:83a:acba:887a with SMTP id ca18e2360f4ac-83ecdb0dd30mr16250339f.0.1732216941947; Thu, 21 Nov 2024 11:22:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEA0uQlYAqFOdcuBhY/0+U+GBC6yKwfxku5KtRi/qpmWbg80i+ktjindaGwSSHa/iJSPWH2Fg== X-Received: by 2002:a05:6602:2c8c:b0:83a:acba:887a with SMTP id ca18e2360f4ac-83ecdb0dd30mr16246139f.0.1732216941458; Thu, 21 Nov 2024 11:22:21 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 10/13] qom: Use machine_get_container() Date: Thu, 21 Nov 2024 14:21:59 -0500 Message-ID: <20241121192202.4155849-11-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, 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_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217025128116600 Content-Type: text/plain; charset="utf-8" Use machine_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/gpio.c | 3 +-- hw/core/qdev.c | 3 +-- hw/core/sysbus.c | 4 ++-- hw/i386/pc.c | 4 ++-- system/ioport.c | 2 +- system/memory.c | 2 +- system/qdev-monitor.c | 6 +++--- system/vl.c | 3 +-- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/hw/core/gpio.c b/hw/core/gpio.c index 80d07a6ec9..6e32a8eec6 100644 --- a/hw/core/gpio.c +++ b/hw/core/gpio.c @@ -121,8 +121,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, cons= t char *name, int n, name ? name : "unnamed-gpio-out", n); if (input_pin && !OBJECT(input_pin)->parent) { /* We need a name for object_property_set_link to work */ - object_property_add_child(container_get(qdev_get_machine(), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), "non-qdev-gpio[*]", OBJECT(input_pin)); } object_property_set_link(OBJECT(dev), propname, diff --git a/hw/core/qdev.c b/hw/core/qdev.c index fa3bc85d9a..d52b669355 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -476,8 +476,7 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) if (!obj->parent) { gchar *name =3D g_strdup_printf("device[%d]", unattached_count= ++); =20 - object_property_add_child(container_get(qdev_get_machine(), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), name, obj); unattached_parent =3D true; g_free(name); diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index e64d99c8ed..9355849ff0 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -65,9 +65,9 @@ void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *= func, void *opaque) }; =20 /* Loop through all sysbus devices that were spawned outside the machi= ne */ - container =3D container_get(qdev_get_machine(), "/peripheral"); + container =3D machine_get_container("peripheral"); find_sysbus_device(container, &find); - container =3D container_get(qdev_get_machine(), "/peripheral-anon"); + container =3D machine_get_container("peripheral-anon"); find_sysbus_device(container, &find); } =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 317aaca25a..b8ec2506e1 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -460,7 +460,7 @@ static int check_fdc(Object *obj, void *opaque) } =20 static const char * const fdc_container_path[] =3D { - "/unattached", "/peripheral", "/peripheral-anon" + "unattached", "peripheral", "peripheral-anon" }; =20 /* @@ -474,7 +474,7 @@ static ISADevice *pc_find_fdc0(void) CheckFdcState state =3D { 0 }; =20 for (i =3D 0; i < ARRAY_SIZE(fdc_container_path); i++) { - container =3D container_get(qdev_get_machine(), fdc_container_path= [i]); + container =3D machine_get_container(fdc_container_path[i]); object_child_foreach(container, check_fdc, &state); } =20 diff --git a/system/ioport.c b/system/ioport.c index fd551d0375..55c2a75239 100644 --- a/system/ioport.c +++ b/system/ioport.c @@ -258,7 +258,7 @@ static void portio_list_add_1(PortioList *piolist, object_ref(&mrpio->mr); object_unparent(OBJECT(&mrpio->mr)); if (!piolist->owner) { - owner =3D container_get(qdev_get_machine(), "/unattached"); + owner =3D machine_get_container("unattached"); } else { owner =3D piolist->owner; } diff --git a/system/memory.c b/system/memory.c index 85f6834cb3..fba351b030 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1238,7 +1238,7 @@ static void memory_region_do_init(MemoryRegion *mr, char *name_array =3D g_strdup_printf("%s[*]", escaped_name); =20 if (!owner) { - owner =3D container_get(qdev_get_machine(), "/unattached"); + owner =3D machine_get_container("unattached"); } =20 object_property_add_child(owner, name_array, OBJECT(mr)); diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 4c09b38ffb..4d46af2c8d 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -348,7 +348,7 @@ static Object *qdev_get_peripheral(void) static Object *dev; =20 if (dev =3D=3D NULL) { - dev =3D container_get(qdev_get_machine(), "/peripheral"); + dev =3D machine_get_container("peripheral"); } =20 return dev; @@ -359,7 +359,7 @@ static Object *qdev_get_peripheral_anon(void) static Object *dev; =20 if (dev =3D=3D NULL) { - dev =3D container_get(qdev_get_machine(), "/peripheral-anon"); + dev =3D machine_get_container("peripheral-anon"); } =20 return dev; @@ -1085,7 +1085,7 @@ static GSList *qdev_build_hotpluggable_device_list(Ob= ject *peripheral) static void peripheral_device_del_completion(ReadLineState *rs, const char *str) { - Object *peripheral =3D container_get(qdev_get_machine(), "/peripheral"= ); + Object *peripheral =3D machine_get_container("peripheral"); GSList *list, *item; =20 list =3D qdev_build_hotpluggable_device_list(peripheral); diff --git a/system/vl.c b/system/vl.c index 15e35162c6..cdc0b6e10c 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2136,8 +2136,7 @@ static void qemu_create_machine(QDict *qdict) object_property_add_child(object_get_root(), "machine", OBJECT(current_machine)); qemu_create_machine_containers(OBJECT(current_machine)); - object_property_add_child(container_get(OBJECT(current_machine), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), "sysbus", OBJECT(sysbus_get_default())); =20 if (machine_class->minimum_page_bits) { --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217091; cv=none; d=zohomail.com; s=zohoarc; b=EyYCAq96B8BVTHdtAPJtHH1JnZ5G5SwJOluS4xgOChdaIX1L/hUc933yyVfGdCRwGS7abNKKZoMJk1vsg8xGmTdBptWOUcj9zPZuCVDF3UQv8H3yNcVe88+FX0T2/YlFKxwY7X6BuRt4IAXCkZWaGaU4EdAQRoMXpPY7NKXp6K4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217091; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZZ5qJtjFMCsorpUx6DRRJUFzx5r4IsUySwfiiQk0TFQ=; b=UBVt8T48Tv8qEXya/S03lg8RoUEukiw3xoPDVqv1BWntKRisGa/NZL2KzUdFR5F9D8Izxo9bGDbjd4PLJDwYnGozlYrSRp0DIlcPd5VuWczFNss+Trf2e89DKjdaWIzVzklqScKIt5r5vSTkgHwq18d5BAvpuIPHvuyEjBZw0Fg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217091603515.1476436331773; Thu, 21 Nov 2024 11:24:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECl4-0006Rf-5d; Thu, 21 Nov 2024 14:22:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl2-0006QJ-GS for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl0-0002Y9-Sm for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:28 -0500 Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-sfjjxHg6PPyn3Vqal0XCeQ-1; Thu, 21 Nov 2024 14:22:25 -0500 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-83a9bd80875so129277439f.2 for ; Thu, 21 Nov 2024 11:22:25 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216946; 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=ZZ5qJtjFMCsorpUx6DRRJUFzx5r4IsUySwfiiQk0TFQ=; b=Xn3q2VpLfxsP5yykp9NOzL4qzhN5Mfmcn8eER+N8C7exUIsrGINp78BghcerrIzpZ10qcP 2P5dwg2fWxgIfUROLQylMKyCFwnL9Zt+Qu8894BiyNkpnRRF/EzNjje92Sgw2F7X/YhsUa BtdzbBkQ1EWTDLldnqiGvMv1BKjU5dY= X-MC-Unique: sfjjxHg6PPyn3Vqal0XCeQ-1 X-Mimecast-MFC-AGG-ID: sfjjxHg6PPyn3Vqal0XCeQ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216944; x=1732821744; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZZ5qJtjFMCsorpUx6DRRJUFzx5r4IsUySwfiiQk0TFQ=; b=ipUCtwjNcVppH117d28ezFA0NnbrwZVosZA+zvUb2YmMloLn7cQynsYsxkfyjAQJCH YsKJhbxcAIbJABzb/L/jWhkD0nr0CyBdEOqsC0mfxF22hP453tk1NX9sxRGMSsG5eiNU mY691whK0WuwYVMB2MMLMQsQHtF0cP2XMod37V3q4CWRYxQSvFRhwMVFmxncU+S3H6ER rl7a5tWY5ZJn3K8AzCM9Lyam3/pnW9y4Cb/3sOgCVTymIwIAqiRUAxxKFuLqtPHsm8WE dz1ThPGYTx6KdbehyIU5x01dJqsmJqwYjBydaZRetwUSg2ro0Y8XJHxTEf+FEyEEiD06 Dq3w== X-Gm-Message-State: AOJu0YxtoyMx4UDVThmz1CoAz1mRNrgfj8RJMSwkiFwBhzxeXyz0L92f uYFG5QG7XuNhS6wJFqY7OKt1CcYekTrp7iO5WMFA9jPpABuYQB5rTCbBALkI9x2r4ORtldp0xXr pjQAZTVh7HALJzhRmlOwStqOahiOvuAiUbwjp+MUKEy7OaOqKcB0ZGhYO6TY8nmmU/VrnHOQb/a YvO1T8EjGE3V1dhJVAAZSkNNItDTfhOmsb0g== X-Gm-Gg: ASbGncuB98DulXiMxco3Vsd18ffYAM2ErcZf8PhUf/fJ3HxadjRw+Ilrrqf39Z+LxbJ OgDiySSbhI8lMnNiPK4OypvIlAql8qZonOmoFthkamKKEonXJiLKi7aRMGNND2m+7/4X8A0mKFB GMa+ye9Kwo06X+hwKhuzLv7z/zm6073ZCRHaCVvk5Kzfv8rwPg8maKK6K/ZA6Hjiz4qGK63SjAc 0JZ0cDmjFaemmlzNcppla/BjuscH15u7U5YyIhUERa3UIYDCB3abnvy7NoPHO13gwy457t2t737 5w8U9iRwPRHE0FPwtdwE+ijRXQ== X-Received: by 2002:a05:6602:6d8c:b0:82c:eeaa:b1e0 with SMTP id ca18e2360f4ac-83ecdcf2cecmr8576939f.11.1732216944037; Thu, 21 Nov 2024 11:22:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IESk0s/ydcqZLTxrRxL2JA2N1Dsl1nbSwzMslT2zl1q2FJY1o4ALENUViddyT6UwKP20Op0RQ== X-Received: by 2002:a05:6602:6d8c:b0:82c:eeaa:b1e0 with SMTP id ca18e2360f4ac-83ecdcf2cecmr8574139f.11.1732216943572; Thu, 21 Nov 2024 11:22:23 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 11/13] qom: Add object_get_container() Date: Thu, 21 Nov 2024 14:22:00 -0500 Message-ID: <20241121192202.4155849-12-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, 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_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217093349116600 Add a helper to fetch a root container (under object_get_root()). Sanity check on the type of the object. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Peter Xu --- include/qom/object.h | 10 ++++++++++ qom/object.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 597e961b8c..4eeee7f7c4 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1524,6 +1524,16 @@ const char *object_property_get_type(Object *obj, co= nst char *name, */ Object *object_get_root(void); =20 +/** + * object_get_container: + * @name: the name of container to lookup + * + * Lookup a root level container. + * + * Returns: the container with @name. + */ +Object *object_get_container(const char *name); + =20 /** * object_get_objects_root: diff --git a/qom/object.c b/qom/object.c index 2fb0b8418e..25316b9536 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1756,6 +1756,16 @@ static Object *object_root_initialize(void) return root; } =20 +Object *object_get_container(const char *name) +{ + Object *container; + + container =3D object_resolve_path_component(object_get_root(), name); + assert(object_dynamic_cast(container, TYPE_CONTAINER)); + + return container; +} + Object *object_get_root(void) { static Object *root; --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732217038; cv=none; d=zohomail.com; s=zohoarc; b=YMDam6AgJyQg9VhGhu+5frsmwd9g9yfI3ZXTtGTKCv5RU+hNKL6MmxUku2eQtsfAfzHszebFlRbf1AdAv4fMRSf0znotCs/7C1WS6xOMzWQD4d7+Fa9+GFp02GtL8NSH8a+AfNGPCd9il+fL+Cq9XvSRdOtZAK3VEmTEFUS2M6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732217038; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KlCjmMhOsETnaTyXAbRHACVEqc3kQ0Zh/uAJpxK1nFM=; b=k+yohl+Kdce2TRHeuY0fh+eebxzn7WT/jQGOmo6Rf3lAx2kHsWpGmx5KIy9ZuYQy7S6o6C3h5PPjtb54nI72XsaBVO/5IdGAdGjFUsGIbeBnoEzpe/UqL9pSknE5RulXEc1oscOe9wvikDg+rU9C4vUYvpmJ5Yf8zHaFNYPcK6E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732217038905478.59776826234975; Thu, 21 Nov 2024 11:23:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECl5-0006SK-Jm; Thu, 21 Nov 2024 14:22:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl3-0006Rg-Uz for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl2-0002YU-FH for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:29 -0500 Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-As8xvxmPOMGDG9TgWiYVRQ-1; Thu, 21 Nov 2024 14:22:26 -0500 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-83acaa1f819so139143839f.3 for ; Thu, 21 Nov 2024 11:22:26 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216947; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KlCjmMhOsETnaTyXAbRHACVEqc3kQ0Zh/uAJpxK1nFM=; b=ZshSu66os53hV1RdyuLeHLHNBos8h/ALnBVOhdIaa1Kl+tL2rvHRmmYl3RXw5qz6fugHHA T+Iy7dLU1Zzm0Mwx2ffs82tBEEJHMS+x0HguHILqeWU+kAhy173jazpHeGtGofFGYbqF4T L7uPam8u8sXLnSr0CxlWTeIfGQpMv4c= X-MC-Unique: As8xvxmPOMGDG9TgWiYVRQ-1 X-Mimecast-MFC-AGG-ID: As8xvxmPOMGDG9TgWiYVRQ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216945; x=1732821745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KlCjmMhOsETnaTyXAbRHACVEqc3kQ0Zh/uAJpxK1nFM=; b=aPEjh0Oc1eucaAgmmUlfApHPLSF4opQTFATyvlRoQvphNWuFX/OBo8WtPGvtD3WNte vHyhjeJd8Y0/p9Ca8p216nLygMXVQlKjw/OH2EDbwFfeCwHN/vq1aeJNCq5aOAIk2P9R dmDdUsYEukxgR0F/xwHsnPFUAcMc4zddD66uv0iChPYzui0cU3eL8XSzYxnrqk1K/x3y nwdFtokM00HCzAVcW2QV82Vl3Wn4mRjtEtWD9Eo/S3DAi3b4UDjXf6MH8z2ZkC+7T+yB 277dMwRH5wg8BQxMd7AvQ3at0c8nrBXaYRENjUmNOAkoKPVApToyw+1fKjkgRWzLctVu 1fUA== X-Gm-Message-State: AOJu0Yywmmbg+SafsNtZiqCtHi4QkjON1rIizpj6rqAsJdRDIb88SNzH 4MGJYzKu4iG1vkVXpCOt0tXGhm/gD0jgKaY0EjEXLGRZqJ9HX5N+PUx6FY1mxU5XbSk7Izsg/Af yBDwXAW+WgRtwmoTRMkiw33qc4Z/vEGrj1TwXAdBcaYWj01GwubKc+/V/wT5PPlBPI74etonX2W h5SGA2+1LXYoxm9Hj2ZM+rhCbbv2NJDPvv4A== X-Gm-Gg: ASbGnctc9B/0JlCjSqi58AqKCLtB+q3c9LygkJ6zPFtF6SJGMDeYEWG0hSiMGxXAIxE OaJr2gsPcIB4R0gX22Q3y1c7Y4kKO5e2yT9brjY68FLp+StM0Lg5sMI+yL8yGda46rSV/d4BABc JVQZBXbtPfFhnvRI2yu0ghPFnZd9kO+i2hUpvGuzBHvdb8H1/9WaO8CdU2x6x4LXUqHn9qtvq3w 94HwATcwluoaL61iZgMKjkSq+96Ime8XEXXUsu0QmDM95KPig3ezWaIsmmSPH8k1scahXtzqhp5 TmZnApMga5d3ozo8un3GkONdRw== X-Received: by 2002:a05:6602:6c0a:b0:837:7d54:acf1 with SMTP id ca18e2360f4ac-83ecdc5165fmr9753539f.2.1732216945552; Thu, 21 Nov 2024 11:22:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEcrz4gsR2FCel784ZzHiMIHEQa6Iq+lDIdERLixZPsbyuVSNez3p4F297s/6ql0Xdi1xWIA== X-Received: by 2002:a05:6602:6c0a:b0:837:7d54:acf1 with SMTP id ca18e2360f4ac-83ecdc5165fmr9750639f.2.1732216945208; Thu, 21 Nov 2024 11:22:25 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 12/13] qom: Use object_get_container() Date: Thu, 21 Nov 2024 14:22:01 -0500 Message-ID: <20241121192202.4155849-13-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732217041199116600 Content-Type: text/plain; charset="utf-8" Use object_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- backends/cryptodev.c | 4 ++-- chardev/char.c | 2 +- qom/object.c | 2 +- scsi/pr-manager.c | 4 ++-- ui/console.c | 2 +- ui/dbus-chardev.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index d8bd2a1ae6..263de4913b 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -97,7 +97,7 @@ static int qmp_query_cryptodev_foreach(Object *obj, void = *data) QCryptodevInfoList *qmp_query_cryptodev(Error **errp) { QCryptodevInfoList *list =3D NULL; - Object *objs =3D container_get(object_get_root(), "/objects"); + Object *objs =3D object_get_container("objects"); =20 object_child_foreach(objs, qmp_query_cryptodev_foreach, &list); =20 @@ -557,7 +557,7 @@ static void cryptodev_backend_stats_cb(StatsResultList = **result, switch (target) { case STATS_TARGET_CRYPTODEV: { - Object *objs =3D container_get(object_get_root(), "/objects"); + Object *objs =3D object_get_container("objects"); StatsArgs stats_args; stats_args.result.stats =3D result; stats_args.names =3D names; diff --git a/chardev/char.c b/chardev/char.c index a1722aa076..22fc5f7f76 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -48,7 +48,7 @@ =20 Object *get_chardevs_root(void) { - return container_get(object_get_root(), "/chardevs"); + return object_get_container("chardevs"); } =20 static void chr_be_event(Chardev *s, QEMUChrEvent event) diff --git a/qom/object.c b/qom/object.c index 25316b9536..c9e53ed92c 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1779,7 +1779,7 @@ Object *object_get_root(void) =20 Object *object_get_objects_root(void) { - return container_get(object_get_root(), "/objects"); + return object_get_container("objects"); } =20 Object *object_get_internal_root(void) diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c index fb5fc29730..1977d99ce0 100644 --- a/scsi/pr-manager.c +++ b/scsi/pr-manager.c @@ -21,7 +21,7 @@ #include "qemu/module.h" #include "qapi/qapi-commands-block.h" =20 -#define PR_MANAGER_PATH "/objects" +#define PR_MANAGER_PATH "objects" =20 typedef struct PRManagerData { PRManager *pr_mgr; @@ -135,7 +135,7 @@ PRManagerInfoList *qmp_query_pr_managers(Error **errp) { PRManagerInfoList *head =3D NULL; PRManagerInfoList **prev =3D &head; - Object *container =3D container_get(object_get_root(), PR_MANAGER_PATH= ); + Object *container =3D object_get_container(PR_MANAGER_PATH); =20 object_child_foreach(container, query_one_pr_manager, &prev); return head; diff --git a/ui/console.c b/ui/console.c index 5165f17125..914ed2cc76 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1160,7 +1160,7 @@ DisplayState *init_displaystate(void) * all QemuConsoles are created and the order / numbering * doesn't change any more */ name =3D g_strdup_printf("console[%d]", con->index); - object_property_add_child(container_get(object_get_root(), "/backe= nd"), + object_property_add_child(object_get_container("backend"), name, OBJECT(con)); g_free(name); } diff --git a/ui/dbus-chardev.c b/ui/dbus-chardev.c index 1d3a7122a1..bf061cbc93 100644 --- a/ui/dbus-chardev.c +++ b/ui/dbus-chardev.c @@ -106,7 +106,7 @@ dbus_chardev_init(DBusDisplay *dpy) dpy->notifier.notify =3D dbus_display_on_notify; dbus_display_notifier_add(&dpy->notifier); =20 - object_child_foreach(container_get(object_get_root(), "/chardevs"), + object_child_foreach(object_get_container("chardevs"), dbus_display_chardev_foreach, dpy); } =20 --=20 2.45.0 From nobody Sat Nov 23 15:31:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1732216978; cv=none; d=zohomail.com; s=zohoarc; b=XJnKkYjunoIQj0WzLYfQRmADSeuhPs0o/PAdvdw8naMDCetSI9+WhnXsB+JitBnVXCz6pVIMPs+PEaUxNuhxc2f7VGu9ZeUIGE3ShAKeGAKzBQwL1x4mXy7CYmcRSAbbIBzGUQlEG+rfRUJ8O7fO+IOMPgsEJGAPiApdAPy/3+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732216978; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=09qVDtV8+X8joyoLsYEjsugdMH7ZxlNybCqke+Rx6OQ=; b=QD97Ba4O1nE8nV3sQE4rdmBYTyoWdDO7haL54PnbdDh9w6+dg+59wn69PF5gj/IT3n7KVePGE/o6oj8wKgtNiGQMZtq34z9idOzukCRsVlvGKMg8DspGKjAANcw8Hb7143JfJJ3NwSa+RbBYBdl+VvR4KqaACkyRL67wpv5MPwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732216978398811.6311693107465; Thu, 21 Nov 2024 11:22:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tECl8-0006So-8O; Thu, 21 Nov 2024 14:22:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl5-0006SJ-Gm for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tECl3-0002Yf-P4 for qemu-devel@nongnu.org; Thu, 21 Nov 2024 14:22:31 -0500 Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-513-len4P6ppNjuPe2WspEB_EQ-1; Thu, 21 Nov 2024 14:22:28 -0500 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-83ab369a523so126975639f.3 for ; Thu, 21 Nov 2024 11:22:28 -0800 (PST) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe345f0sm102939173.45.2024.11.21.11.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 11:22:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732216949; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=09qVDtV8+X8joyoLsYEjsugdMH7ZxlNybCqke+Rx6OQ=; b=PKT2mvxBtpO6WfQtqeW2+vqRniw9YkcP4mvda9NYKsgQcmIB8n6UrYGeIuBo1V9lAxEwVo 3TWMAwsfZ26a5J6BUM/Av+usCo20HEblFdPX4q1KZRbRlBaLpvB00gw03nPGv5I4qK3WXm BgIW7gKw0JCcpOwBxgCVAmn7RLjY9FI= X-MC-Unique: len4P6ppNjuPe2WspEB_EQ-1 X-Mimecast-MFC-AGG-ID: len4P6ppNjuPe2WspEB_EQ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732216947; x=1732821747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=09qVDtV8+X8joyoLsYEjsugdMH7ZxlNybCqke+Rx6OQ=; b=mRWbChEsNHLULfQvoOHEaRk13dEk82Ecs7x72XDuZ9q7arV0/kP4Yq8snUuIyvOhqi cErxAwaORkcdkEUGxTXKZlgyLxUG1gM7xznEuR8PSWaFIKv5bRIOOj+sQ+xbFAg39ICz cUDx56nLPxVyJWVHambOURx8GoT682JN3nuqoi1eGV7+Lpq/GSvnv/RMvt64jyZUEp2j fQWI8RqriotS8uc+KIrk6Y5T6zutCif7UCPpFbOLV876yMB9Ry/qPfB9/cAHwL4MBnOW 4u999vS1+cFwwPu//F45P1Yw/T00l9Yq+ZfHq42TK2oXJ1I66MSBfyDOTRCtl//XwOfv sKyw== X-Gm-Message-State: AOJu0Yw8iqoRXfCvuwAPkJrZrCJ423wKED+j8nOmb5ykUC40yx6cUC+9 pder35aWlsNmlfHqLk0tWkdpnewgYG14bPpGubVYQJX3B68U23tfTVdg096YcOA2yK0qvO8ugcG GchxPMtVihpBew6yHVuArU5EogwcYZqgp7Uesamr+24gnAaYSXR/L3pqO6uZTUHBcKX4rj1eimA 4L+FjPmYMIMh7swYdTqnQ8SOXsdtbbBFCeXw== X-Gm-Gg: ASbGncuBmB887nC8Mrp/Pyd5frjdwZdqwIaEU7drbBPUCqmUATUIQVynhDLprLHnptI OyKiltm+R6sVbtQAtggms5iu/4zm6Vv7gHDFpaW9TOy+dTDfC82Hxo5AWmtOhODYMQuGjc4iWqM /amCrCNK6uCu9ACaPclG1GaUrHOHFvunGfTWjqi1gGevL8ArZvFGf0Vg/NQWo2AU9wBy6jf0g4b Gpo7G2f5H7Kw3ISLM0qbXhMHglprMyq1klqGgZasVD0ZjOSd/g57KflCyK2beikuMDz1dbSTH++ onVWow5C855Bwi/PAbKO6f9HaQ== X-Received: by 2002:a05:6602:154d:b0:83a:872f:4b98 with SMTP id ca18e2360f4ac-83ecdc44f29mr10843739f.2.1732216947123; Thu, 21 Nov 2024 11:22:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGdfiMZqSHprSPJo6ciJj7VtcqnP9zLzTP0uWTYoy3dP0ye2D7P7kHsUqOzEA56o8WYjW8VA== X-Received: by 2002:a05:6602:154d:b0:83a:872f:4b98 with SMTP id ca18e2360f4ac-83ecdc44f29mr10841439f.2.1732216946834; Thu, 21 Nov 2024 11:22:26 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Peter Maydell , Juraj Marcin , peterx@redhat.com, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost Subject: [PATCH v2 13/13] qom: Remove container_get() Date: Thu, 21 Nov 2024 14:22:02 -0500 Message-ID: <20241121192202.4155849-14-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com> References: <20241121192202.4155849-1-peterx@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, 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_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732216978798116600 Content-Type: text/plain; charset="utf-8" Now there's no user of container_get(), remove it. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qom/object.h | 11 ----------- qom/container.c | 23 ----------------------- 2 files changed, 34 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 4eeee7f7c4..f3a887e34f 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -2031,17 +2031,6 @@ int object_child_foreach(Object *obj, int (*fn)(Obje= ct *child, void *opaque), int object_child_foreach_recursive(Object *obj, int (*fn)(Object *child, void *opaque), void *opaque); -/** - * container_get: - * @root: root of the #path, e.g., object_get_root() - * @path: path to the container - * - * Return a container object whose path is @path. Create more containers - * along the path if necessary. - * - * Returns: the container object. - */ -Object *container_get(Object *root, const char *path); =20 /** * object_property_add_new_container: diff --git a/qom/container.c b/qom/container.c index 20ab74b0e8..38a27ec1ed 100644 --- a/qom/container.c +++ b/qom/container.c @@ -34,27 +34,4 @@ Object *object_property_add_new_container(Object *obj, c= onst char *name) return child; } =20 -Object *container_get(Object *root, const char *path) -{ - Object *obj, *child; - char **parts; - int i; - - parts =3D g_strsplit(path, "/", 0); - assert(parts !=3D NULL && parts[0] !=3D NULL && !parts[0][0]); - obj =3D root; - - for (i =3D 1; parts[i] !=3D NULL; i++, obj =3D child) { - child =3D object_resolve_path_component(obj, parts[i]); - if (!child) { - child =3D object_property_add_new_container(obj, parts[i]); - } - } - - g_strfreev(parts); - - return obj; -} - - type_init(container_register_types) --=20 2.45.0