From patchwork Tue Oct 29 12:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13854866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A22CED2AB36 for ; Tue, 29 Oct 2024 12:27:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5lIw-00069A-VY; Tue, 29 Oct 2024 08:26:34 -0400 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 1t5lIm-00067r-F5 for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:26 -0400 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 1t5lIj-0000TU-Sd for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730204779; 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=I4htve3jF9i+MdStP1HNvXC37SaqbXO3fBifh0QuZLA=; b=STTQoQHrFBXgEGiRjw3cvIz7xAdNgRdwHwPx9r0+mq/gx2o+gcAOVE//VjgOPDeQqoR/Y2 tkFHyvdWwcEPsUFYGsb6VjLw2oc8jufAVbGExr/59VS4wL8mQFCny/efdY6toEyrNqaGfM T3sNhLLLluEIkwDnSZeOSsL+Q3C4Sy8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-421-TIYMtRACNeK14eYjLNwNwA-1; Tue, 29 Oct 2024 08:26:15 -0400 X-MC-Unique: TIYMtRACNeK14eYjLNwNwA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4315afcae6cso31121575e9.0 for ; Tue, 29 Oct 2024 05:26:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730204774; x=1730809574; 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=I4htve3jF9i+MdStP1HNvXC37SaqbXO3fBifh0QuZLA=; b=W/UfpUG67MyIsUewZEUzCOtw1WmPjIJ6de88QZVWymkDWDd2Xx73EMq82xzKJrtT6I /CvwpFgYXKQFIB/xEd9sosygktVn5VYVvQPCVU7mccq8R7VYhXuDpYxx2e0enOMyPwPS JPFNVq6mm4ncLvbzxqK/eGeoPm0XOzn4bF5CM/oavg2tCDKxpxD3OHdecxKXY7MguqB9 zHISCwNXZU+y8CV0wuBBh4rB2A1BBvNgu7yI6UiaLYVXAmLJC5RFyvX90mRNxw9iS6KD +ONFdzb07aAjxvBo+tfuzAptvjg/UfTtH9znetlPk4T69Ng0WyvrZbqzXmZAjFsGZc74 LMMw== X-Gm-Message-State: AOJu0YzhmcMs5TK6BPvUrbF7n2/xonAylONzAgHfPIlzeluijHPXUO1F FBCRZ+k6hCpkm0bCga4Hl19NCGUehweumefgsrAvpvtWaD0sQB4Mdo2RP9qgbt1OB2GZFwdJJNO F4lkBFF+IPh2Pzh50/N/Zu8IQSRwE5SFd6Tx/ajYu2rHQzT4u2zDEnrQc0RCRuQesX+1s8XNhjc IssGdNTw6rtY6zwuAgoIg7u3hmIg+ZHdMV9DBDt+w= X-Received: by 2002:a05:600c:314f:b0:42c:b826:a26c with SMTP id 5b1f17b1804b1-431b55e6087mr16772735e9.8.1730204773868; Tue, 29 Oct 2024 05:26:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETz7lpPtCJw2TF5vgB2ARn1TOjm1oJTPDs8htQ8AjvaQlJ2OXOF9TDruwhrmr0l7iL0prKCQ== X-Received: by 2002:a05:600c:314f:b0:42c:b826:a26c with SMTP id 5b1f17b1804b1-431b55e6087mr16772445e9.8.1730204773439; Tue, 29 Oct 2024 05:26:13 -0700 (PDT) Received: from [192.168.10.3] ([151.49.226.83]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431935962acsm141012345e9.19.2024.10.29.05.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:26:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: armbru@redhat.com, "Dr. David Alan Gilbert" Subject: [PATCH 1/5] qom: remove unused function Date: Tue, 29 Oct 2024 13:26:05 +0100 Message-ID: <20241029122609.514347-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241029122609.514347-1-pbonzini@redhat.com> References: <20241029122609.514347-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.302, 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The function has been unused since commit 4fa28f23906 ("ppc/pnv: Instantiate cores separately", 2019-12-17). The idea was that you could use it to build an array of objects via pointer arithmetic, but no one is doing it anymore. Cc: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini Reviewed-by: Daniel P. Berrangé --- include/qom/object.h | 8 -------- qom/object.c | 8 -------- 2 files changed, 16 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 2af9854675c..43c135984a6 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -2032,14 +2032,6 @@ int object_child_foreach_recursive(Object *obj, */ Object *container_get(Object *root, const char *path); -/** - * object_type_get_instance_size: - * @typename: Name of the Type whose instance_size is required - * - * Returns the instance_size of the given @typename. - */ -size_t object_type_get_instance_size(const char *typename); - /** * object_property_help: * @name: the name of the property diff --git a/qom/object.c b/qom/object.c index 11424cf4711..8b269414488 100644 --- a/qom/object.c +++ b/qom/object.c @@ -262,14 +262,6 @@ static size_t type_object_get_align(TypeImpl *ti) return 0; } -size_t object_type_get_instance_size(const char *typename) -{ - TypeImpl *type = type_get_by_name(typename); - - g_assert(type != NULL); - return type_object_get_size(type); -} - static bool type_is_ancestor(TypeImpl *type, TypeImpl *target_type) { assert(target_type); From patchwork Tue Oct 29 12:26:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13854865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9033D2AB33 for ; Tue, 29 Oct 2024 12:27:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5lJB-0006Ap-7I; Tue, 29 Oct 2024 08:26:52 -0400 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 1t5lIm-00067s-FJ for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:26 -0400 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 1t5lIj-0000Ta-Ss for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730204781; 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=45MBX6aNgqsN2wiv/WXqRIpWZQdipkdsz1mMqox8E0Q=; b=RN9nhNFfaFIhY+TjzaM5XY6UgYCo8PAPNC6hjcVy2P+vB9AYlFa93XKbOqZ1jYuCdvNa/k taXUThM8lmEgMBi6u+6jJHhmuAuMUHQW6b6/KS1A/Cwm6yNUWDi/mGTN4VWtoQBYtyF9JB fgcwjgzdBtCgprAX5hM8h8mLabJhSwQ= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-QlWBdyfOOpCEbDQUWjGgzA-1; Tue, 29 Oct 2024 08:26:19 -0400 X-MC-Unique: QlWBdyfOOpCEbDQUWjGgzA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-539e03bfd4aso4297215e87.1 for ; Tue, 29 Oct 2024 05:26:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730204776; x=1730809576; 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=45MBX6aNgqsN2wiv/WXqRIpWZQdipkdsz1mMqox8E0Q=; b=Lm1WTuQyJh/HEHfLu06lK3ichMaWqYrjEb80bVJSB8lCK9ObDdqCSCtNz49IJgQ+42 ZDxUr3w7D0+sQdYeTc1+hKWZ1RRG/r7lF3B7i3t8gTT/boK3m4+DR9PWf6LavffXJFpz Vjpv/uTFMX7JljSS1AEDJggzSMp6KQCZfO04prnoSSyGR6uKFxNJpXmNLDnyGdykmgq2 s00Osb6wi0D27Js5afjo01WZuNxdfrfxIMBXFa+dU2YyCa30YJdV6JOZFDfTgn7abPWA cBzd4QIlUCChBLHn6xd3spiliJzzDmkROQv/Fd7Qj9odeiqrhE3Xqz0g0Pxig89l1CbL H/MQ== X-Gm-Message-State: AOJu0YwWM0T+i6ydIv8gwap0POvEK6OyMmGj+1Syqj6CNjlo9eKZ2zyM 9zMyI0RbEGcz9M0EF5p6j7R9HiiDbxkr5zDd3zQFpgQHMz+IdgVmuyyh5F72hzTJyYtk8jFo1Dj Wxpr88yzIg1pRqbgsL5e5bf54yYEiA4PGKwFQmmOJsdkFE5oi9tHxJHgjSFYHBeO3mPnxtPQ9I9 uFITwRGUCvuk+bSryQDpou2RVfse9qilx0ElPxxKs= X-Received: by 2002:a05:6512:ba2:b0:539:968a:9196 with SMTP id 2adb3069b0e04-53b34a2d6e3mr4928774e87.48.1730204776198; Tue, 29 Oct 2024 05:26:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1vsDurwYa4Uy/mtUm3yRQiII7PrCndzfPuDQG7Dtn7vMEkeTE6OxRtmKJDnL87risDM8mbA== X-Received: by 2002:a05:6512:ba2:b0:539:968a:9196 with SMTP id 2adb3069b0e04-53b34a2d6e3mr4928756e87.48.1730204775709; Tue, 29 Oct 2024 05:26:15 -0700 (PDT) Received: from [192.168.10.3] ([151.49.226.83]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b57b051sm176900505e9.42.2024.10.29.05.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:26:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: armbru@redhat.com Subject: [PATCH 2/5] qom: use object_new_with_class when possible Date: Tue, 29 Oct 2024 13:26:06 +0100 Message-ID: <20241029122609.514347-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241029122609.514347-1-pbonzini@redhat.com> References: <20241029122609.514347-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.302, 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org A small optimization/code simplification, that also makes it clear that we won't look for a type in a not-loaded-yet module---the module will have been loaded by a call to module_object_class_by_name(), if present. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- hw/core/qdev.c | 5 +++-- qom/object_interfaces.c | 2 +- qom/qom-qmp-cmds.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 17c454334c6..5f13111b77c 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -151,10 +151,11 @@ DeviceState *qdev_new(const char *name) DeviceState *qdev_try_new(const char *name) { - if (!module_object_class_by_name(name)) { + ObjectClass *oc = module_object_class_by_name(name); + if (!oc) { return NULL; } - return DEVICE(object_new(name)); + return DEVICE(object_new_with_class(oc)); } static QTAILQ_HEAD(, DeviceListener) device_listeners diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index e0833c8bfe4..1f2aa133066 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -108,7 +108,7 @@ Object *user_creatable_add_type(const char *type, const char *id, } assert(qdict); - obj = object_new(type); + obj = object_new_with_class(klass); object_set_properties_from_qdict(obj, qdict, v, &local_err); if (local_err) { goto out; diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index e91a2353472..69a8e17aa80 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -141,7 +141,7 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename, return NULL; } - obj = object_new(typename); + obj = object_new_with_class(klass); object_property_iter_init(&iter, obj); while ((prop = object_property_iter_next(&iter))) { From patchwork Tue Oct 29 12:26:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13854867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCCB2D2AB35 for ; Tue, 29 Oct 2024 12:27:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5lIz-00069S-Qh; Tue, 29 Oct 2024 08:26:37 -0400 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 1t5lIo-00067z-8M for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:27 -0400 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 1t5lIl-0000Tk-Ci for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730204782; 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=Ig1z+rhJdSJSO97leX3ay0AjAoKtPA0I38pbsYq3HOE=; b=LK9+JRANovaWuznRT+Z7tIsEeSedEk/qgN/MLXSce3Xf/Yrv/hdsx4pABfF5GKS8xCkyPZ Pv0uwrx/vmBJf5mgo539YbXvIUlIQkDv7E5oJFSDzac3enrGk9E20C3NFjcQGw4TwqgkOg 2d3Psrk1DPXObRQ0h0kt4hG8Fj0fSdE= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-WflVo-hLPOKLl2dYMWcoYg-1; Tue, 29 Oct 2024 08:26:20 -0400 X-MC-Unique: WflVo-hLPOKLl2dYMWcoYg-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37d45de8bbfso3778015f8f.3 for ; Tue, 29 Oct 2024 05:26:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730204779; x=1730809579; 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=Ig1z+rhJdSJSO97leX3ay0AjAoKtPA0I38pbsYq3HOE=; b=kzfDXky8NmJAP4HvDj76Gc71zqaSKk261N8uoT5m6WOgLWahy6YC3yQQ6Wr6Wp330Y ndyXAB+QVze97P55gcgtnl1kP+kblzHjMxiu7mYmCd15k2dHEhEYVBTYste+IGX7ZLtx 4dM8g1VFTUvg6H1pufvysY9SCA2YOZTHMV/kfRAtGFS9JTkYUvmdYyFTQfbOhpWDXdtT divwu0x93b7vJT210zHapvId7d5UsEYjq4BEYbe5FbkfBLKVLHRilU/3k3tRWOOiIG92 tIe3IZoXJpOYtRLtKsF1qm/rmBH8nHyI9twAF7+m6iiS8luiO6ofaVhK/6GFUjfTd7/h +noQ== X-Gm-Message-State: AOJu0Ywv2CyEXUzD+9yVxkN4/wdYE82/Fjd9ibxS18vmgTJBZ9EX8m9k ZZgQkbO1mvUQyuLLKI0VEBmYtGzb+05QmQU+VgzhsbkFgUdLz1VlsoPghyLDTK56dU0ZekJPB/O sqKpljgUmZwBrPPOj6a+AywhavMyhfMf7b9OmSrByhVQn+HC+KB+sCHzN4SToHTw5qAfNGy5mdQ ikTADYlkktYJ6Lti8S1tc9PNCGqaVzlZPJkeysaXo= X-Received: by 2002:a05:6000:b88:b0:37d:397a:5a05 with SMTP id ffacd0b85a97d-38061248a2dmr9833228f8f.54.1730204777244; Tue, 29 Oct 2024 05:26:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcVTAPJfFql+QmVu7qlNmzBuX/DgsRrJJWTmbw2QpBeS84m6dkJ9fsVQanQ4abYW1CWIVriw== X-Received: by 2002:a05:6000:b88:b0:37d:397a:5a05 with SMTP id ffacd0b85a97d-38061248a2dmr9833205f8f.54.1730204776827; Tue, 29 Oct 2024 05:26:16 -0700 (PDT) Received: from [192.168.10.3] ([151.49.226.83]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b712bfsm12356488f8f.79.2024.10.29.05.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:26:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: armbru@redhat.com Subject: [PATCH 3/5] qom: centralize module-loading functionality Date: Tue, 29 Oct 2024 13:26:07 +0100 Message-ID: <20241029122609.514347-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241029122609.514347-1-pbonzini@redhat.com> References: <20241029122609.514347-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.302, 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Put together the common code of object_initialize() and module_object_class_by_name() into a function that supports Error **. Rename the existing function type_get_by_name() to clarify that it will only look at defined types; this is often okay within object.c to look at the parents, but not outside it. Signed-off-by: Paolo Bonzini --- qom/object.c | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/qom/object.c b/qom/object.c index 8b269414488..29155c64639 100644 --- a/qom/object.c +++ b/qom/object.c @@ -195,7 +195,7 @@ void type_register_static_array(const TypeInfo *infos, int nr_infos) } } -static TypeImpl *type_get_by_name(const char *name) +static TypeImpl *type_get_by_name_noload(const char *name) { if (name == NULL) { return NULL; @@ -204,10 +204,32 @@ static TypeImpl *type_get_by_name(const char *name) return type_table_lookup(name); } +static TypeImpl *type_get_or_load_by_name(const char *name, Error **errp) +{ + TypeImpl *type = type_get_by_name_noload(name); + +#ifdef CONFIG_MODULES + if (!type) { + int rv = module_load_qom(name, errp); + if (rv > 0) { + type = type_get_by_name_noload(name); + } else { + error_prepend(errp, "could not load a module for type '%s'", name); + return NULL; + } + } +#endif + if (!type) { + error_setg(errp, "unknown type '%s'", name); + } + + return type; +} + static TypeImpl *type_get_parent(TypeImpl *type) { if (!type->parent_type && type->parent) { - type->parent_type = type_get_by_name(type->parent); + type->parent_type = type_get_by_name_noload(type->parent); if (!type->parent_type) { fprintf(stderr, "Type '%s' is missing its parent '%s'\n", type->name, type->parent); @@ -363,7 +385,7 @@ static void type_initialize(TypeImpl *ti) } for (i = 0; i < ti->num_interfaces; i++) { - TypeImpl *t = type_get_by_name(ti->interfaces[i].typename); + TypeImpl *t = type_get_by_name_noload(ti->interfaces[i].typename); if (!t) { error_report("missing interface '%s' for object '%s'", ti->interfaces[i].typename, parent->name); @@ -557,23 +579,7 @@ static void object_initialize_with_type(Object *obj, size_t size, TypeImpl *type void object_initialize(void *data, size_t size, const char *typename) { - TypeImpl *type = type_get_by_name(typename); - -#ifdef CONFIG_MODULES - if (!type) { - int rv = module_load_qom(typename, &error_fatal); - if (rv > 0) { - type = type_get_by_name(typename); - } else { - error_report("missing object type '%s'", typename); - exit(1); - } - } -#endif - if (!type) { - error_report("missing object type '%s'", typename); - abort(); - } + TypeImpl *type = type_get_or_load_by_name(typename, &error_fatal); object_initialize_with_type(data, size, type); } @@ -784,7 +790,7 @@ Object *object_new_with_class(ObjectClass *klass) Object *object_new(const char *typename) { - TypeImpl *ti = type_get_by_name(typename); + TypeImpl *ti = type_get_by_name_noload(typename); return object_new_with_type(ti); } @@ -957,7 +963,7 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class, return class; } - target_type = type_get_by_name(typename); + target_type = type_get_by_name_noload(typename); if (!target_type) { /* target class type unknown, so fail the cast */ return NULL; @@ -1055,7 +1061,7 @@ const char *object_class_get_name(ObjectClass *klass) ObjectClass *object_class_by_name(const char *typename) { - TypeImpl *type = type_get_by_name(typename); + TypeImpl *type = type_get_by_name_noload(typename); if (!type) { return NULL; @@ -1068,21 +1074,15 @@ ObjectClass *object_class_by_name(const char *typename) ObjectClass *module_object_class_by_name(const char *typename) { - ObjectClass *oc; + TypeImpl *type = type_get_or_load_by_name(typename, NULL); - oc = object_class_by_name(typename); -#ifdef CONFIG_MODULES - if (!oc) { - Error *local_err = NULL; - int rv = module_load_qom(typename, &local_err); - if (rv > 0) { - oc = object_class_by_name(typename); - } else if (rv < 0) { - error_report_err(local_err); - } + if (!type) { + return NULL; } -#endif - return oc; + + type_initialize(type); + + return type->class; } ObjectClass *object_class_get_parent(ObjectClass *class) From patchwork Tue Oct 29 12:26:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13854878 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 596DAD2AB33 for ; Tue, 29 Oct 2024 12:27:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5lIz-00069T-SP; Tue, 29 Oct 2024 08:26:38 -0400 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 1t5lIn-00067y-OI for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:26 -0400 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 1t5lIm-0000Ts-6x for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730204783; 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=nIaIDBHybs/Pj/BvXJs4xMHmbif5r8zGkXPmre/ozZk=; b=YTZaT8f+wAswkyGFpK5bFfrm2Mkh7MvnOcnUFI4DI9delbRl9G4eATi3Sn3zifIND2PGEx 7AZZKt/BnqBnoOCAQ0dBLZvolSByzIEL1oSNF24fdmCyUgMf8GGEvk9jRV/7AHQh08U3p3 SkLTzkvEqrFLPyIFV+RPuRSJFYb1Wvo= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-cYBvY7w1PvKlck1aBcJA9w-1; Tue, 29 Oct 2024 08:26:22 -0400 X-MC-Unique: cYBvY7w1PvKlck1aBcJA9w-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37d43e7acd9so2693472f8f.2 for ; Tue, 29 Oct 2024 05:26:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730204779; x=1730809579; 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=nIaIDBHybs/Pj/BvXJs4xMHmbif5r8zGkXPmre/ozZk=; b=tebK4BbIr4vVQ19qzcydk5+fRCQxoCqnjCABPJoIYoc9jK6BqTDXewj/e/msqqKc+8 tEMiq7BnxBgI4qr4MaLvblHuUCR+mg2ZgEmG2qIVwOL9aUC1Zr5dxsXCGj2txDIcqb8t 49/TbnlqNkfIRyp+BmegIMnj2aCT+nJSwVtYGVpKU8wxpKHrcib3XvcH9wWJkjllo7nE SueQ8BWqgIxno2DclU0WivfeJU4TzwrsU1s6tpZJ8GOpbK1NShuU7EsMx1hmFPJnIPew HCUUgLUP37wLRuMQES2O/tzTDj7zU4H7pJaXNdrGof3kGMCoArBQEZMZ+o60WRFP+ymJ paLA== X-Gm-Message-State: AOJu0YyO5KennN4E6gZqPvDKw1LSG9qEN5B6YQ7KFzOAxvKnuHx44QlG g7cuBKACpNSUgRNl69OYkyettIPW0Z76TAfwbQUzAG/w1Y8ifdvWDN4z5kGED4mLleO/zZoIVF4 166bvKK4ENc7oR7aacnAlThqo1sADkGEzG5K8UD/JQjYOIzX+KTB+t7xJPk1sCDOi4RFV9Nd0Ek WFhDhfxe6JB/IfQWhsRECAXnJGQI6l2+1iivtkhOk= X-Received: by 2002:adf:a15b:0:b0:37d:4ebe:163e with SMTP id ffacd0b85a97d-38061206a7emr8724412f8f.53.1730204779329; Tue, 29 Oct 2024 05:26:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLP5N+rEfoScK8OaHnyA4RUwo24MRf15noKsQRNED2KkE38vJeVxufErPK55eAb7acO3lnHQ== X-Received: by 2002:adf:a15b:0:b0:37d:4ebe:163e with SMTP id ffacd0b85a97d-38061206a7emr8724386f8f.53.1730204778891; Tue, 29 Oct 2024 05:26:18 -0700 (PDT) Received: from [192.168.10.3] ([151.49.226.83]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b47a41sm12367568f8f.52.2024.10.29.05.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:26:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: armbru@redhat.com Subject: [PATCH 4/5] qom: let object_new use a module if the type is not present Date: Tue, 29 Oct 2024 13:26:08 +0100 Message-ID: <20241029122609.514347-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241029122609.514347-1-pbonzini@redhat.com> References: <20241029122609.514347-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.302, 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org object_initialize() can use modules (it was added there because virtio-gpu-device is a child device of virtio-gpu-pci; commit 64f7aece8ea, "object_initialize: try module load", 2020-09-15). object_new() cannot; make things consistent. qdev_new() is now just a simple wrapper that returns DeviceState. Signed-off-by: Paolo Bonzini --- hw/core/qdev.c | 16 ---------------- qom/object.c | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index db36f54d914..17c454334c6 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -146,22 +146,6 @@ bool qdev_set_parent_bus(DeviceState *dev, BusState *bus, Error **errp) DeviceState *qdev_new(const char *name) { - ObjectClass *oc = object_class_by_name(name); -#ifdef CONFIG_MODULES - if (!oc) { - int rv = module_load_qom(name, &error_fatal); - if (rv > 0) { - oc = object_class_by_name(name); - } else { - error_report("could not find a module for type '%s'", name); - exit(1); - } - } -#endif - if (!oc) { - error_report("unknown type '%s'", name); - abort(); - } return DEVICE(object_new(name)); } diff --git a/qom/object.c b/qom/object.c index 29155c64639..9edc06d391f 100644 --- a/qom/object.c +++ b/qom/object.c @@ -790,7 +790,7 @@ Object *object_new_with_class(ObjectClass *klass) Object *object_new(const char *typename) { - TypeImpl *ti = type_get_by_name_noload(typename); + TypeImpl *ti = type_get_or_load_by_name(typename, &error_fatal); return object_new_with_type(ti); } From patchwork Tue Oct 29 12:26:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13854864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B446CD2AB38 for ; Tue, 29 Oct 2024 12:27:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5lIz-00069X-SU; Tue, 29 Oct 2024 08:26:38 -0400 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 1t5lIt-00068f-Gp for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:31 -0400 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 1t5lIs-0000UW-5A for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:26:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730204789; 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=FILn0kiELRQI/h2bsureFqbI99ihRtFsbCjCMadVMro=; b=KuQgtvH5yx41c3HaHEMhdQ4sbTd/0Cd9R5AX3KvFfURTnjRzOzFu0nKCUOXLkjZHpfniKz GrYVNj1VwbmJNKACLi1MAEnt5qWvH6imuiqF1PKsZl085IxkD7K8TjnJhKjmA6p2kGZ40J MzGTFfZcV7eI6LSoyQ0Rt3dVb2U725c= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-223-ccSb7PekNlC235xnlvxVHQ-1; Tue, 29 Oct 2024 08:26:26 -0400 X-MC-Unique: ccSb7PekNlC235xnlvxVHQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37d537292d7so3556903f8f.2 for ; Tue, 29 Oct 2024 05:26:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730204783; x=1730809583; 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=FILn0kiELRQI/h2bsureFqbI99ihRtFsbCjCMadVMro=; b=uhumACDbGxSr16V1PJTUgDFBSBcjq+mkotwXZDg1sIbNAgvE4YhOb5R8Hp7BRdcQo4 kkpmmVv/0Pwr4Nf3v68Swj5s/VEKSJImeEJ+1p0UzBUR5ZZ0hnDV4Ew+ndv9UUfyElwg EQh4V5lZMViMD5v8KCklFSOAbCrR/k7nEx1SEJkWxXd1GKwyTnnM0gODUo/vGq8QRlAt apg0cwBDfYkjd0FI+oGiQmUr8e1yx9O0gzWUXqzx9+YjHQ2kUFE6wo23t+n/bojbkIBP l8s6NsC36XaGhRlitQxTZ2op/TUC25/JFzstndajmM9mh8dEZpD+1E5wogCblJsawSOH gK7Q== X-Gm-Message-State: AOJu0YwXUeGZ6O6Ni4KrRwLQVugHf7qGpVGH3oAc54X+RO+RZwLWWA0P Xseqtla/JYbwphRqLFVl9GaslNT3LG4jTuWQmlt/2adUOL6RzLtQXWQArEK/Xo9TM6hMBrstNY9 6gskMhfcJL711JWdGwuajFwFYkWCUENX+5BPkZR0ktOIGmSZm2ElwFGQATh2bLN2P/h4XxI1GG8 CvQ3zva8UR/xfSGxvF9LROsfx99sDrDDBLJLUlJ24= X-Received: by 2002:a5d:5508:0:b0:37d:51b7:5e08 with SMTP id ffacd0b85a97d-3806117ea93mr9939831f8f.18.1730204783334; Tue, 29 Oct 2024 05:26:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGgW/ntLxCwdNahZG9fX1P43CFaOleu13T6XiyyWaxBWyS/3sCmQpMLr3w2hVo34nGTMEgJQ== X-Received: by 2002:a5d:5508:0:b0:37d:51b7:5e08 with SMTP id ffacd0b85a97d-3806117ea93mr9939814f8f.18.1730204782946; Tue, 29 Oct 2024 05:26:22 -0700 (PDT) Received: from [192.168.10.3] ([151.49.226.83]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b92700sm12386260f8f.99.2024.10.29.05.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:26:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: armbru@redhat.com Subject: [PATCH 5/5] qom: allow user-creatable classes to be in modules Date: Tue, 29 Oct 2024 13:26:09 +0100 Message-ID: <20241029122609.514347-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241029122609.514347-1-pbonzini@redhat.com> References: <20241029122609.514347-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.302, 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org There is no real reason to make user-creatable classes different from other backends in this respect. This also allows modularized character devices to be treated by qom-list-properties just like builtin ones. Signed-off-by: Paolo Bonzini --- qom/object_interfaces.c | 2 +- qom/qom-qmp-cmds.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 1f2aa133066..1a6f29c053e 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -90,7 +90,7 @@ Object *user_creatable_add_type(const char *type, const char *id, return NULL; } - klass = object_class_by_name(type); + klass = module_object_class_by_name(type); if (!klass) { error_setg(errp, "invalid object type: %s", type); return NULL; diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 69a8e17aa80..46e4562300c 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -186,7 +186,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename, ObjectPropertyIterator iter; ObjectPropertyInfoList *prop_list = NULL; - klass = object_class_by_name(typename); + klass = module_object_class_by_name(typename); if (klass == NULL) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Class '%s' not found", typename);