From patchwork Tue Apr 28 16:34:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC5E3C83008 for ; Tue, 28 Apr 2020 16:45:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8452A2063A for ; Tue, 28 Apr 2020 16:45:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HtiTbFTO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8452A2063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTM1-0002Ns-IB for qemu-devel@archiver.kernel.org; Tue, 28 Apr 2020 12:45:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34310) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTF7-0006Sw-6C for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTTBj-0000rW-FL for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:37:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:41874 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTTBi-0000r5-Ta for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:34:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588091666; 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=nKzEcWFq8QhyR/rUJfvEYK3BbmyAuhDmcQ2botSl80Y=; b=HtiTbFTO3ZRZD+q4g5pxIQVfLRYhuxcKGaimBiADPXvnZT6SnrwH1w67MT+moe8zEIw5BA 44tm9DPkT9JEcFGH/nStfAJuCEpM/RWlzo0/aZmLbUKCtMXmuMQCcl1RxiHHRmoRPnIzd8 uCC71oElG5wgGWpvFAq4fhkwL8Zk8+I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-HRwvfoEhOGmfNQ6s8OzTlA-1; Tue, 28 Apr 2020 12:34:24 -0400 X-MC-Unique: HRwvfoEhOGmfNQ6s8OzTlA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 70CD1800D24 for ; Tue, 28 Apr 2020 16:34:23 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FFF228563; Tue, 28 Apr 2020 16:34:21 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 03DE311358BE; Tue, 28 Apr 2020 18:34:20 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char * Date: Tue, 28 Apr 2020 18:34:04 +0200 Message-Id: <20200428163419.4483-3-armbru@redhat.com> In-Reply-To: <20200428163419.4483-1-armbru@redhat.com> References: <20200428163419.4483-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/28 02:16:38 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Uses of gchar * in qom/object.h: * ObjectProperty member @name Functions that take a property name argument all use char *. Change the member to match. * ObjectProperty member @type Functions that take a property type argument or return it all use char *. Change the member to match. * ObjectProperty member @description Functions that take a property description argument all use char *. Change the member to match. * object_resolve_path_component() parameter @part Path components are property names. Most callers pass char * arguments. Change the parameter to match. Adjust the few callers that pass gchar * to pass char *. * Return value of object_get_canonical_path_component(), object_get_canonical_path() Most callers convert their return values right back to char *. Change the return value to match. Adjust the few callers where that would add a conversion to gchar * to use char * instead. Signed-off-by: Markus Armbruster --- include/qom/object.h | 12 +++++----- monitor/monitor-internal.h | 2 +- hw/dma/xlnx-zdma.c | 4 ++-- hw/net/virtio-net.c | 2 +- hw/ppc/spapr_drc.c | 2 +- memory.c | 4 ++-- qom/container.c | 2 +- qom/object.c | 46 ++++++++++++++++++++------------------ 8 files changed, 38 insertions(+), 36 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 784c97c0e1..ccfa82e33d 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -369,9 +369,9 @@ typedef void (ObjectPropertyInit)(Object *obj, ObjectProperty *prop); struct ObjectProperty { - gchar *name; - gchar *type; - gchar *description; + char *name; + char *type; + char *description; ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyResolve *resolve; @@ -1421,7 +1421,7 @@ Object *object_get_internal_root(void); * path is the path within the composition tree starting from the root. * %NULL if the object doesn't have a parent (and thus a canonical path). */ -gchar *object_get_canonical_path_component(Object *obj); +char *object_get_canonical_path_component(Object *obj); /** * object_get_canonical_path: @@ -1429,7 +1429,7 @@ gchar *object_get_canonical_path_component(Object *obj); * Returns: The canonical path for a object. This is the path within the * composition tree starting from the root. */ -gchar *object_get_canonical_path(Object *obj); +char *object_get_canonical_path(Object *obj); /** * object_resolve_path: @@ -1487,7 +1487,7 @@ Object *object_resolve_path_type(const char *path, const char *typename, * * Returns: The resolved object or NULL on path lookup failure. */ -Object *object_resolve_path_component(Object *parent, const gchar *part); +Object *object_resolve_path_component(Object *parent, const char *part); /** * object_property_add_child: diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 8f60ccc70a..b39e03b744 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -91,7 +91,7 @@ struct Monitor { bool skip_flush; bool use_io_thread; - gchar *mon_cpu_path; + char *mon_cpu_path; QTAILQ_ENTRY(Monitor) entry; /* diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c index 1c45367f3c..880630a0b0 100644 --- a/hw/dma/xlnx-zdma.c +++ b/hw/dma/xlnx-zdma.c @@ -710,7 +710,7 @@ static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size) RegisterInfo *r = &s->regs_info[addr / 4]; if (!r->data) { - gchar *path = object_get_canonical_path(OBJECT(s)); + char *path = object_get_canonical_path(OBJECT(s)); qemu_log("%s: Decode error: read from %" HWADDR_PRIx "\n", path, addr); @@ -729,7 +729,7 @@ static void zdma_write(void *opaque, hwaddr addr, uint64_t value, RegisterInfo *r = &s->regs_info[addr / 4]; if (!r->data) { - gchar *path = object_get_canonical_path(OBJECT(s)); + char *path = object_get_canonical_path(OBJECT(s)); qemu_log("%s: Decode error: write to %" HWADDR_PRIx "=%" PRIx64 "\n", path, addr, value); diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index a46e3b37a7..836be2787e 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -399,7 +399,7 @@ static void rxfilter_notify(NetClientState *nc) VirtIONet *n = qemu_get_nic_opaque(nc); if (nc->rxfilter_notify_enabled) { - gchar *path = object_get_canonical_path(OBJECT(n->qdev)); + char *path = object_get_canonical_path(OBJECT(n->qdev)); qapi_event_send_nic_rx_filter_changed(!!n->netclient_name, n->netclient_name, path); g_free(path); diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 47e6bb12f9..0b66d59867 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -518,7 +518,7 @@ static void realize(DeviceState *d, Error **errp) SpaprDrc *drc = SPAPR_DR_CONNECTOR(d); Object *root_container; gchar *link_name; - gchar *child_name; + char *child_name; Error *err = NULL; trace_spapr_drc_realize(spapr_drc_index(drc)); diff --git a/memory.c b/memory.c index 601b749906..936c1b23d4 100644 --- a/memory.c +++ b/memory.c @@ -1175,7 +1175,7 @@ static void memory_region_get_container(Object *obj, Visitor *v, Error **errp) { MemoryRegion *mr = MEMORY_REGION(obj); - gchar *path = (gchar *)""; + char *path = (char *)""; if (mr->container) { path = object_get_canonical_path(OBJECT(mr->container)); @@ -2845,7 +2845,7 @@ static void mtree_expand_owner(const char *label, Object *obj) if (dev && dev->id) { qemu_printf(" id=%s", dev->id); } else { - gchar *canonical_path = object_get_canonical_path(obj); + char *canonical_path = object_get_canonical_path(obj); if (canonical_path) { qemu_printf(" path=%s", canonical_path); g_free(canonical_path); diff --git a/qom/container.c b/qom/container.c index f6ccaf7ea7..e635e8ee76 100644 --- a/qom/container.c +++ b/qom/container.c @@ -28,7 +28,7 @@ static void container_register_types(void) Object *container_get(Object *root, const char *path) { Object *obj, *child; - gchar **parts; + char **parts; int i; parts = g_strsplit(path, "/", 0); diff --git a/qom/object.c b/qom/object.c index e06c78f9a5..0c9e2052fa 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1357,7 +1357,7 @@ void object_property_set_link(Object *obj, Object *value, const char *name, Error **errp) { if (value) { - gchar *path = object_get_canonical_path(value); + char *path = object_get_canonical_path(value); object_property_set_str(obj, path, name, errp); g_free(path); } else { @@ -1653,14 +1653,15 @@ static void object_get_child_property(Object *obj, Visitor *v, Error **errp) { Object *child = opaque; - gchar *path; + char *path; path = object_get_canonical_path(child); visit_type_str(v, name, &path, errp); g_free(path); } -static Object *object_resolve_child_property(Object *parent, void *opaque, const gchar *part) +static Object *object_resolve_child_property(Object *parent, void *opaque, + const char *part) { return opaque; } @@ -1681,7 +1682,7 @@ void object_property_add_child(Object *obj, const char *name, Object *child, Error **errp) { Error *local_err = NULL; - gchar *type; + char *type; ObjectProperty *op; if (child->parent != NULL) { @@ -1740,14 +1741,14 @@ static void object_get_link_property(Object *obj, Visitor *v, { LinkProperty *lprop = opaque; Object **targetp = object_link_get_targetp(obj, lprop); - gchar *path; + char *path; if (*targetp) { path = object_get_canonical_path(*targetp); visit_type_str(v, name, &path, errp); g_free(path); } else { - path = (gchar *)""; + path = (char *)""; visit_type_str(v, name, &path, errp); } } @@ -1765,7 +1766,7 @@ static Object *object_resolve_link(Object *obj, const char *name, const char *path, Error **errp) { const char *type; - gchar *target_type; + char *target_type; bool ambiguous = false; Object *target; @@ -1828,7 +1829,8 @@ static void object_set_link_property(Object *obj, Visitor *v, } } -static Object *object_resolve_link_property(Object *parent, void *opaque, const gchar *part) +static Object *object_resolve_link_property(Object *parent, void *opaque, + const char *part) { LinkProperty *lprop = opaque; @@ -1858,7 +1860,7 @@ static void object_add_link_prop(Object *obj, const char *name, { Error *local_err = NULL; LinkProperty *prop = g_malloc(sizeof(*prop)); - gchar *full_type; + char *full_type; ObjectProperty *op; if (flags & OBJ_PROP_LINK_DIRECT) { @@ -1910,7 +1912,7 @@ object_class_property_add_link(ObjectClass *oc, { Error *local_err = NULL; LinkProperty *prop = g_new0(LinkProperty, 1); - gchar *full_type; + char *full_type; ObjectProperty *op; prop->offset = offset; @@ -1945,7 +1947,7 @@ void object_property_add_const_link(Object *obj, const char *name, NULL, OBJ_PROP_LINK_DIRECT, errp); } -gchar *object_get_canonical_path_component(Object *obj) +char *object_get_canonical_path_component(Object *obj) { ObjectProperty *prop = NULL; GHashTableIter iter; @@ -1970,7 +1972,7 @@ gchar *object_get_canonical_path_component(Object *obj) return NULL; } -gchar *object_get_canonical_path(Object *obj) +char *object_get_canonical_path(Object *obj) { Object *root = object_get_root(); char *newpath, *path = NULL; @@ -2000,7 +2002,7 @@ gchar *object_get_canonical_path(Object *obj) return path; } -Object *object_resolve_path_component(Object *parent, const gchar *part) +Object *object_resolve_path_component(Object *parent, const char *part) { ObjectProperty *prop = object_property_find(parent, part, NULL); if (prop == NULL) { @@ -2015,9 +2017,9 @@ Object *object_resolve_path_component(Object *parent, const gchar *part) } static Object *object_resolve_abs_path(Object *parent, - gchar **parts, - const char *typename, - int index) + char **parts, + const char *typename, + int index) { Object *child; @@ -2038,9 +2040,9 @@ static Object *object_resolve_abs_path(Object *parent, } static Object *object_resolve_partial_path(Object *parent, - gchar **parts, - const char *typename, - bool *ambiguous) + char **parts, + const char *typename, + bool *ambiguous) { Object *obj; GHashTableIter iter; @@ -2078,7 +2080,7 @@ Object *object_resolve_path_type(const char *path, const char *typename, bool *ambiguousp) { Object *obj; - gchar **parts; + char **parts; parts = g_strsplit(path, "/", 0); assert(parts); @@ -2769,7 +2771,7 @@ static void property_set_alias(Object *obj, Visitor *v, const char *name, } static Object *property_resolve_alias(Object *obj, void *opaque, - const gchar *part) + const char *part) { AliasProperty *prop = opaque; @@ -2791,7 +2793,7 @@ void object_property_add_alias(Object *obj, const char *name, AliasProperty *prop; ObjectProperty *op; ObjectProperty *target_prop; - gchar *prop_type; + char *prop_type; Error *local_err = NULL; target_prop = object_property_find(target_obj, target_name, errp); From patchwork Tue Apr 28 16:34:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283862 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CED4C83000 for ; Tue, 28 Apr 2020 16:44:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 66F7F2063A for ; Tue, 28 Apr 2020 16:44:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O6SZNtjt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66F7F2063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTLi-00023u-Ck for qemu-devel@archiver.kernel.org; Tue, 28 Apr 2020 12:44:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34386) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTFE-0006iV-N8 for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTTBm-0000t1-V5 for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:04 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23464 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTTBm-0000s3-Bv for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:34:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588091669; 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=0RVxeOfjwQA17QUx70Pvu4YyioLTk9WXNYBcQ9CshsY=; b=O6SZNtjtofph8KvyWZujdyTTPVjiD34p4anHUUNjZvBXS3FF2MqAtxeeFuZ9iVX8cZp/EN 1uxdaVBpSsicgC7HH2wPXa5EtjxlLmK8MtqyzreuyBugAgD1235eWyZ19w+mHwpMlRLq0A PgMJsxgSfZDR4ePrDURyH5sCdK6lDvA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-333-Q__xRBRGMqKlCHuxXITuUQ-1; Tue, 28 Apr 2020 12:34:27 -0400 X-MC-Unique: Q__xRBRGMqKlCHuxXITuUQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7DB18189595B for ; Tue, 28 Apr 2020 16:34:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9823467651; Tue, 28 Apr 2020 16:34:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1536911358C3; Tue, 28 Apr 2020 18:34:20 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 07/17] tests/check-qom-proplist: Improve iterator coverage Date: Tue, 28 Apr 2020 18:34:09 +0200 Message-Id: <20200428163419.4483-8-armbru@redhat.com> In-Reply-To: <20200428163419.4483-1-armbru@redhat.com> References: <20200428163419.4483-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/28 04:15:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The tests' "qemu-dummy" device has only class properties. Turn one of them into an instance property. test_dummy_class_iterator() expects one fewer property than test_dummy_iterator(). Rewrite test_dummy_prop_iterator() to take expected properties as argument. Signed-off-by: Markus Armbruster --- tests/check-qom-proplist.c | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index a8b2958e6e..140d56439a 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -130,17 +130,18 @@ static void dummy_init(Object *obj) object_property_add_bool(obj, "bv", dummy_get_bv, dummy_set_bv, - &err); + NULL); + /* duplicate: */ + object_property_add_str(obj, "sv", + dummy_get_sv, + dummy_set_sv, + &err); error_free_or_abort(&err); } static void dummy_class_init(ObjectClass *cls, void *data) { - object_class_property_add_bool(cls, "bv", - dummy_get_bv, - dummy_set_bv, - NULL); object_class_property_add_str(cls, "sv", dummy_get_sv, dummy_set_sv, @@ -520,34 +521,33 @@ static void test_dummy_getenum(void) } -static void test_dummy_prop_iterator(ObjectPropertyIterator *iter) +static void test_dummy_prop_iterator(ObjectPropertyIterator *iter, + const char *expected[], int n) { - bool seenbv = false, seensv = false, seenav = false, seentype = false; ObjectProperty *prop; + int i; while ((prop = object_property_iter_next(iter))) { - if (!seenbv && g_str_equal(prop->name, "bv")) { - seenbv = true; - } else if (!seensv && g_str_equal(prop->name, "sv")) { - seensv = true; - } else if (!seenav && g_str_equal(prop->name, "av")) { - seenav = true; - } else if (!seentype && g_str_equal(prop->name, "type")) { - /* This prop comes from the base Object class */ - seentype = true; - } else { - g_printerr("Found prop '%s'\n", prop->name); - g_assert_not_reached(); + for (i = 0; i < n; i++) { + if (!g_strcmp0(prop->name, expected[i])) { + break; + } } + g_assert(i < n); + expected[i] = NULL; + } + + for (i = 0; i < n; i++) { + g_assert(!expected[i]); } - g_assert(seenbv); - g_assert(seenav); - g_assert(seensv); - g_assert(seentype); } static void test_dummy_iterator(void) { + const char *expected[] = { + "type", /* inherited from TYPE_OBJECT */ + "sv", "av", /* class properties */ + "bv"}; /* instance property */ Object *parent = object_get_objects_root(); DummyObject *dobj = DUMMY_OBJECT( object_new_with_props(TYPE_DUMMY, @@ -561,17 +561,18 @@ static void test_dummy_iterator(void) ObjectPropertyIterator iter; object_property_iter_init(&iter, OBJECT(dobj)); - test_dummy_prop_iterator(&iter); + test_dummy_prop_iterator(&iter, expected, ARRAY_SIZE(expected)); object_unparent(OBJECT(dobj)); } static void test_dummy_class_iterator(void) { + const char *expected[] = { "type", "av", "sv" }; ObjectPropertyIterator iter; ObjectClass *klass = object_class_by_name(TYPE_DUMMY); object_class_property_iter_init(&iter, klass); - test_dummy_prop_iterator(&iter); + test_dummy_prop_iterator(&iter, expected, ARRAY_SIZE(expected)); } static void test_dummy_delchild(void) From patchwork Tue Apr 28 16:34:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7B29C83000 for ; Tue, 28 Apr 2020 16:41:42 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A1BED206D6 for ; Tue, 28 Apr 2020 16:41:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="W9BZ+iie" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1BED206D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTIi-0004FB-37 for qemu-devel@archiver.kernel.org; Tue, 28 Apr 2020 12:41:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34436) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTFQ-00070B-MU for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTTBz-0000vB-JO for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:16 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32544 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTTBz-0000uj-4l for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:34:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588091682; 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=nzP+uw+2XuwrGiqU22XaFcepv5QrViywKvtT5n9Opwo=; b=W9BZ+iieodkVnXwEghI577iEpsKSeyTJ40W5gjw70wQ1JWOoHVaSSHkFRSgbs3JqN93aJY 7tLwW2eRpdVTHcImBlJdoyg1bMx2eNl+LB7ZmEhclYwzbwtdN0mb0Wih6dsf60iZOBHTEC VbcI7Z7AFOHBzIIbWjWf7Vk1LaxWwnA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-wpsAwwXYNcmcjr10Xs1pog-1; Tue, 28 Apr 2020 12:34:40 -0400 X-MC-Unique: wpsAwwXYNcmcjr10Xs1pog-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60C2E18A0738; Tue, 28 Apr 2020 16:34:39 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D3375DA66; Tue, 28 Apr 2020 16:34:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 188E611358C4; Tue, 28 Apr 2020 18:34:20 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Date: Tue, 28 Apr 2020 18:34:10 +0200 Message-Id: <20200428163419.4483-9-armbru@redhat.com> In-Reply-To: <20200428163419.4483-1-armbru@redhat.com> References: <20200428163419.4483-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/28 04:15:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: berrange@redhat.com, ehabkost@redhat.com, David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, pbonzini@redhat.com, Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto. Impact: * s390_feat_bitmap_to_ascii() misidentifies S390_FEAT_PCC_CMAC_AES_256 as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message when s390_realize_cpu_model() fails in check_compatibility(). * s390_realize_cpu_model() misidentifies it in check_consistency() warnings. * s390_cpu_list() likewise. Affects -cpu help. * s390_cpu_model_register_props() creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description for S390_FEAT_PCC_CMAC_AES_256, and no property for S390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMP device_add, QMP device-list-properties, and QOM introspection. Fix by deleting the wayward 'e'. Fixes: 782417446279717aa85320191a519b51f6d5dd31 Cc: Halil Pasic Cc: Cornelia Huck Cc: Christian Borntraeger Cc: Richard Henderson Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Signed-off-by: Markus Armbruster --- target/s390x/cpu_features_def.inc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/cpu_features_def.inc.h b/target/s390x/cpu_features_def.inc.h index 31dff0d84e..a8d562d688 100644 --- a/target/s390x/cpu_features_def.inc.h +++ b/target/s390x/cpu_features_def.inc.h @@ -310,7 +310,7 @@ DEF_FEAT(PCC_CMAC_ETDEA_192, "pcc-cmac-etdea-128", PCC, 10, "PCC Compute-Last-Bl DEF_FEAT(PCC_CMAC_TDEA, "pcc-cmac-etdea-192", PCC, 11, "PCC Compute-Last-Block-CMAC-Using-EncryptedTDEA-192") DEF_FEAT(PCC_CMAC_AES_128, "pcc-cmac-aes-128", PCC, 18, "PCC Compute-Last-Block-CMAC-Using-AES-128") DEF_FEAT(PCC_CMAC_AES_192, "pcc-cmac-aes-192", PCC, 19, "PCC Compute-Last-Block-CMAC-Using-AES-192") -DEF_FEAT(PCC_CMAC_AES_256, "pcc-cmac-eaes-256", PCC, 20, "PCC Compute-Last-Block-CMAC-Using-AES-256") +DEF_FEAT(PCC_CMAC_AES_256, "pcc-cmac-aes-256", PCC, 20, "PCC Compute-Last-Block-CMAC-Using-AES-256") DEF_FEAT(PCC_CMAC_EAES_128, "pcc-cmac-eaes-128", PCC, 26, "PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-128") DEF_FEAT(PCC_CMAC_EAES_192, "pcc-cmac-eaes-192", PCC, 27, "PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-192") DEF_FEAT(PCC_CMAC_EAES_256, "pcc-cmac-eaes-256", PCC, 28, "PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-256") From patchwork Tue Apr 28 16:34:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBE9CC83001 for ; Tue, 28 Apr 2020 16:52:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 995B82063A for ; Tue, 28 Apr 2020 16:52:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HHw9cNXt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 995B82063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTTB-0006FE-Dk for qemu-devel@archiver.kernel.org; Tue, 28 Apr 2020 12:52:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34394) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTFG-0006ls-Lj for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTTBo-0000tX-34 for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:06 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34021 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTTBn-0000t8-K8 for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:34:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588091670; 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=cnNsMekgRnqDnpykk6bN9r6dKCrQkcHisa/B6Io0xnU=; b=HHw9cNXtpMFe7w0bVJhOSdZ73oe9jsdU3NVx+E3MozFXav3nTzoKitwSzaGPsLxW5S6KQw pOz6+oFbYsf6kQJiyNX5XGmxElT0rtyxgH5WxyYIVik/8GytGSPFUaqUOnSpwbG8TxThk/ aZ3bGwWG4dDuYAI1qwSb9s/pW0IH9EM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-AN8aSZmTNOCpfo2T1qSFKw-1; Tue, 28 Apr 2020 12:34:27 -0400 X-MC-Unique: AN8aSZmTNOCpfo2T1qSFKw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8EC2E189595E for ; Tue, 28 Apr 2020 16:34:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B653E6607C; Tue, 28 Apr 2020 16:34:24 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1FA1F11358C6; Tue, 28 Apr 2020 18:34:20 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 10/17] e1000: Don't run e1000_instance_init() twice Date: Tue, 28 Apr 2020 18:34:12 +0200 Message-Id: <20200428163419.4483-11-armbru@redhat.com> In-Reply-To: <20200428163419.4483-1-armbru@redhat.com> References: <20200428163419.4483-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/28 04:15:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Jason Wang , berrange@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" QOM object initialization runs .instance_init() for the type and all its supertypes; see object_init_with_type(). Both TYPE_E1000_BASE and its concrete subtypes set .instance_init() to e1000_instance_init(). For the concrete subtypes, it duly gets run twice. The second run fails, but the error gets ignored (a later commit will change that). Remove it from the subtypes. Cc: Jason Wang Signed-off-by: Markus Armbruster --- hw/net/e1000.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 2a69eee63f..0d2c2759e3 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1824,7 +1824,6 @@ static void e1000_register_types(void) type_info.parent = TYPE_E1000_BASE; type_info.class_data = (void *)info; type_info.class_init = e1000_class_init; - type_info.instance_init = e1000_instance_init; type_register(&type_info); } From patchwork Tue Apr 28 16:34:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C460C83000 for ; Tue, 28 Apr 2020 16:50:18 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EBB592063A for ; Tue, 28 Apr 2020 16:50:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Yop9O1ei" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBB592063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTR2-0002Mo-Vx for qemu-devel@archiver.kernel.org; Tue, 28 Apr 2020 12:50:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34390) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTFG-0006lI-5H for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTTBn-0000tC-5L for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:05 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55757 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTTBm-0000sI-Lr for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:34:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588091669; 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=bSbfMAJ4GnwLUv0Gh7iU3vhxKU1k0E4h/igRgZgLE7A=; b=Yop9O1eiLHxyINJdYseGmp41VZBI493mIAzZ/9u61OH2chdMph0vVny1Q/FLOY4RnPczGd j0w1gQRWTYf38hpZRCYJzOfNO6cg731K8sG3MfDCZrRr5QQ5GkyS0T4zlOz4kp4HLHLNG9 /sBarcc8ebufKxYth/EeHlMxwl+w7dY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-333-CpeKPK0GPaSNkJqmYvPgBA-1; Tue, 28 Apr 2020 12:34:27 -0400 X-MC-Unique: CpeKPK0GPaSNkJqmYvPgBA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 820C8EC1A2; Tue, 28 Apr 2020 16:34:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EF7A6607D; Tue, 28 Apr 2020 16:34:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 22D2711358C7; Tue, 28 Apr 2020 18:34:20 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 11/17] hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory Date: Tue, 28 Apr 2020 18:34:13 +0200 Message-Id: <20200428163419.4483-12-armbru@redhat.com> In-Reply-To: <20200428163419.4483-1-armbru@redhat.com> References: <20200428163419.4483-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/28 04:15:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , berrange@redhat.com, ehabkost@redhat.com, Andrew Baumann , qemu-arm@nongnu.org, pbonzini@redhat.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The "bcm2835-peripherals" device's .instance_init() method bcm2835_peripherals_init() attempts to make two memory regions QOM children of the device. This is futile, because memory_region_init() already did. The errors are ignored (a later commit will change that). Drop the useless calls. Cc: Peter Maydell Cc: Andrew Baumann Cc: "Philippe Mathieu-Daudé" Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster --- hw/arm/bcm2835_peripherals.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index edcaa4916d..8b399d67ff 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -43,12 +43,10 @@ static void bcm2835_peripherals_init(Object *obj) /* Memory region for peripheral devices, which we export to our parent */ memory_region_init(&s->peri_mr, obj,"bcm2835-peripherals", 0x1000000); - object_property_add_child(obj, "peripheral-io", OBJECT(&s->peri_mr), NULL); sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_mr); /* Internal memory region for peripheral bus addresses (not exported) */ memory_region_init(&s->gpu_bus_mr, obj, "bcm2835-gpu", (uint64_t)1 << 32); - object_property_add_child(obj, "gpu-bus", OBJECT(&s->gpu_bus_mr), NULL); /* Internal memory region for request/response communication with * mailbox-addressable peripherals (not exported) From patchwork Tue Apr 28 16:34:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3FCBC83000 for ; Tue, 28 Apr 2020 16:57:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A8CA120757 for ; Tue, 28 Apr 2020 16:57:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="enoMN3V7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8CA120757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTXn-0005pa-Ph for qemu-devel@archiver.kernel.org; Tue, 28 Apr 2020 12:57:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34532) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTTFd-00074p-8g for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTTDI-0002bk-Iw for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:38:28 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:50710 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTTDI-0002bW-3h for qemu-devel@nongnu.org; Tue, 28 Apr 2020 12:36:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588091763; 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=geLYC3lNN4C+LXNUVW83AAFmHLmqi1bfvQCyEEm7w/4=; b=enoMN3V7RFAlBb0ijAb5yQKabCon8n56AVESi02CkC73EKELz+h4eg1+ywatuHwDRWyC7b iscMxjKEdkc6DOAwFmehm6Jx64LiPsM4QAQ6Z//+bypQyEY90A+pw1Ng0DgCih3pTwMl0o dIQCt9/a5P5Q88jQPl08cuLAjd9anmk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-TJZgCtyHOJqpWaNxXlp6NA-1; Tue, 28 Apr 2020 12:34:30 -0400 X-MC-Unique: TJZgCtyHOJqpWaNxXlp6NA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A87D4464 for ; Tue, 28 Apr 2020 16:34:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B644363F7A; Tue, 28 Apr 2020 16:34:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3B0F311358CE; Tue, 28 Apr 2020 18:34:20 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 17/17] qom: Drop @errp parameter of object_property_del() Date: Tue, 28 Apr 2020 18:34:19 +0200 Message-Id: <20200428163419.4483-18-armbru@redhat.com> In-Reply-To: <20200428163419.4483-1-armbru@redhat.com> References: <20200428163419.4483-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/28 04:11:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Same story as for object_property_add(): the only way object_property_del() can fail is when the property with this name does not exist. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing &error_abort. Most callers do that, the commit before previous fixed one that didn't (and got the error handling wrong), and the two remaining exceptions ignore errors. Drop the @errp parameter and assert the precondition instead. Signed-off-by: Markus Armbruster --- include/qom/object.h | 2 +- hw/core/qdev.c | 2 +- hw/i386/pc_sysfw.c | 2 +- hw/ppc/spapr_drc.c | 4 ++-- qom/object.c | 7 +------ qom/object_interfaces.c | 3 +-- tests/check-qom-proplist.c | 2 +- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 7458fefc7b..15af9dbbc8 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1047,7 +1047,7 @@ ObjectProperty *object_property_add(Object *obj, const char *name, ObjectPropertyRelease *release, void *opaque); -void object_property_del(Object *obj, const char *name, Error **errp); +void object_property_del(Object *obj, const char *name); ObjectProperty *object_class_property_add(ObjectClass *klass, const char *name, const char *type, diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 64ac9829bd..e26e5a75c9 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -64,7 +64,7 @@ static void bus_remove_child(BusState *bus, DeviceState *child) bus->num_children--; /* This gives back ownership of kid->child back to us. */ - object_property_del(OBJECT(bus), name, NULL); + object_property_del(OBJECT(bus), name); object_unref(OBJECT(kid->child)); g_free(kid); return; diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 002133a2d8..2abab3a27c 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -120,7 +120,7 @@ static void pc_system_flash_cleanup_unused(PCMachineState *pcms) dev_obj = OBJECT(pcms->flash[i]); if (!object_property_get_bool(dev_obj, "realized", &error_abort)) { prop_name = g_strdup_printf("pflash%d", i); - object_property_del(OBJECT(pcms), prop_name, &error_abort); + object_property_del(OBJECT(pcms), prop_name); g_free(prop_name); object_unparent(dev_obj); pcms->flash[i] = NULL; diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 8b2171f698..b958f8acb5 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -405,7 +405,7 @@ static void spapr_drc_release(SpaprDrc *drc) g_free(drc->fdt); drc->fdt = NULL; drc->fdt_start_offset = 0; - object_property_del(OBJECT(drc), "device", &error_abort); + object_property_del(OBJECT(drc), "device"); drc->dev = NULL; } @@ -551,7 +551,7 @@ static void unrealize(DeviceState *d) vmstate_unregister(VMSTATE_IF(drc), &vmstate_spapr_drc, drc); root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); name = g_strdup_printf("%x", spapr_drc_index(drc)); - object_property_del(root_container, name, &error_abort); + object_property_del(root_container, name); g_free(name); } diff --git a/qom/object.c b/qom/object.c index 14c7efe127..424cc20987 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1280,15 +1280,10 @@ ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name, return prop; } -void object_property_del(Object *obj, const char *name, Error **errp) +void object_property_del(Object *obj, const char *name) { ObjectProperty *prop = g_hash_table_lookup(obj->properties, name); - if (!prop) { - error_setg(errp, "Property '.%s' not found", name); - return; - } - if (prop->release) { prop->release(obj, name, prop->opaque); } diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 54e14a3a14..5684ed0483 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -88,8 +88,7 @@ Object *user_creatable_add_type(const char *type, const char *id, user_creatable_complete(USER_CREATABLE(obj), &local_err); if (local_err) { if (id != NULL) { - object_property_del(object_get_objects_root(), - id, &error_abort); + object_property_del(object_get_objects_root(), id); } goto out; } diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index 84f48fe592..13a824cfae 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -280,7 +280,7 @@ static void dummy_bus_init(Object *obj) static void dummy_bus_unparent(Object *obj) { DummyBus *bus = DUMMY_BUS(obj); - object_property_del(obj->parent, "backend", NULL); + object_property_del(obj->parent, "backend"); object_unparent(OBJECT(bus->backend)); }