From nobody Sat Feb 7 06:21:17 2026 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=1634309620; cv=none; d=zohomail.com; s=zohoarc; b=D39JKxmf2Y8UkNh8n9FPvQpZWJbbwTe9mppPx4d7/0M0DP7E0+FnIHL2S0KkOJOyD4NhWcndbsSXBoEi4IFjasmLji0EvSdeWhadU3GIyFZHMXtTIAVjHL03jqm1zcO/3Emj1jHsC8oF89G6YWVK1X2OXOJeo3sY1bXez7mk5aQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634309620; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cRCZlNtkutYPPN8MGG4zTDGFwViY+cRpkYXx35fSry0=; b=edlDxkCHpTRywCAw0fk9c9hOPXnkzXPt4YBLUqFPHN0k45N8b2y1yMVVqlZayREpTtMiT5udCrM57gpCdz9cb2GxFvyJthBRxDAvuoSW715wEFw8WK9aQAdks9JpLUT++OUweX66ThN8bCqMUZklmtpPHUjMQowVj3XZKadHUQc= 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 1634309620022165.86553231572202; Fri, 15 Oct 2021 07:53:40 -0700 (PDT) Received: from localhost ([::1]:55144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbOaY-0008H2-Ss for importer@patchew.org; Fri, 15 Oct 2021 10:53:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbOVu-0000Ia-Tl for qemu-devel@nongnu.org; Fri, 15 Oct 2021 10:48:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbOVt-0001nP-82 for qemu-devel@nongnu.org; Fri, 15 Oct 2021 10:48:50 -0400 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-209-Jbro4qwbM_SyTeWbs58_jw-1; Fri, 15 Oct 2021 10:48:47 -0400 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 23CAD801ADA for ; Fri, 15 Oct 2021 14:48:46 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.193.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DB2F19739; Fri, 15 Oct 2021 14:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634309328; 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=cRCZlNtkutYPPN8MGG4zTDGFwViY+cRpkYXx35fSry0=; b=hFRnfhNOd6pIb3Nlud8LQ7BAr9141//2cFjTIdSlX/uy/URJI2Xtln/gwhytG8FSUWBaeU Z/+TPLnVgkDTm+02zw0tijb0j2kKIIxIGBbdH0hs4gaolZjBl1RwEb17S1bQNk1mhT0zuh hYzrndBL+X5K3Uz7WF1WEKZPeUxe8l0= X-MC-Unique: Jbro4qwbM_SyTeWbs58_jw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PULL 07/15] qdev: Avoid using string visitor for properties Date: Fri, 15 Oct 2021 16:46:32 +0200 Message-Id: <20211015144640.198044-8-kwolf@redhat.com> In-Reply-To: <20211015144640.198044-1-kwolf@redhat.com> References: <20211015144640.198044-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634309620757100001 Content-Type: text/plain; charset="utf-8" The only thing the string visitor adds compared to a keyval visitor is list support. git grep for 'visit_start_list' and 'visit.*List' shows that devices don't make use of this. In a world with a QAPIfied command line interface, the keyval visitor is used to parse the command line. In order to make sure that no devices start using this feature that would make backwards compatibility harder, just switch away from object_property_parse(), which internally uses the string visitor, to a keyval visitor and object_property_set(). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Message-Id: <20211008133442.141332-8-kwolf@redhat.com> Reviewed-by: Michael S. Tsirkin Tested-by: Peter Krempa Signed-off-by: Kevin Wolf --- softmmu/qdev-monitor.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 3df99ce9fc..672f87ed4f 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -28,6 +28,8 @@ #include "qapi/qmp/dispatch.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qobject-input-visitor.h" #include "qemu/config-file.h" #include "qemu/error-report.h" #include "qemu/help_option.h" @@ -198,16 +200,28 @@ static int set_property(void *opaque, const char *nam= e, const char *value, Error **errp) { Object *obj =3D opaque; + QString *val; + Visitor *v; + int ret; =20 if (strcmp(name, "driver") =3D=3D 0) return 0; if (strcmp(name, "bus") =3D=3D 0) return 0; =20 - if (!object_property_parse(obj, name, value, errp)) { - return -1; + val =3D qstring_from_str(value); + v =3D qobject_input_visitor_new_keyval(QOBJECT(val)); + + if (!object_property_set(obj, name, v, errp)) { + ret =3D -1; + goto out; } - return 0; + + ret =3D 0; +out: + visit_free(v); + qobject_unref(val); + return ret; } =20 static const char *find_typename_by_alias(const char *alias) --=20 2.31.1