From nobody Mon Feb 9 23:44:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1632474448; cv=none; d=zohomail.com; s=zohoarc; b=ZURr/yi7g0CjdkB9yjOveqpiJ8tjyW2OP3EKeY5I1Yrvrs2jZPquUJgqk1P47+SbQITO0CargQdn9AECS0/pEg3jGb+9gXgKeRk1P1vCtD/mQ9Qq2Jb8Ac92UiOJ8WOcQ3K22DIo/pqWp7uUysj4t7CX0fB+vJW26ia8DejsKBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632474448; 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=2MMbngAgfFJdLFjKN1OY+WDHDson9Zzsfp6RdzHlTdk=; b=HYVj9vA5ifVCor1/3IxTOdnO9SqUeYs9boFEYKzRmB07RFhi8DzX0nsHFoqyvmdRA/3gmlhINp24Wblaq70OMZheZ3dwF8EcvMBozQh8Nr7YuPtGk8eZE362c58Qn4RqfcGvV1ZoF0iRsLYMDe+pl3oBec/LnYrQPVmdZjgZDq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1632474448189435.710943434108; Fri, 24 Sep 2021 02:07:28 -0700 (PDT) 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-277-7zOnuXMoOa2TaZsnTBe59w-1; Fri, 24 Sep 2021 05:07:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B92661007905; Fri, 24 Sep 2021 09:07:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A4915FC25; Fri, 24 Sep 2021 09:07:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6A3A31832DDA; Fri, 24 Sep 2021 09:07:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18O95uN9024168 for ; Fri, 24 Sep 2021 05:05:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id A23505DEB8; Fri, 24 Sep 2021 09:05:56 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.193.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0C265D9DC; Fri, 24 Sep 2021 09:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632474447; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2MMbngAgfFJdLFjKN1OY+WDHDson9Zzsfp6RdzHlTdk=; b=Og/HRpts4W3G5kQxtUSVsdPE2wp7UGCTDGS9PLhpkincEwq5w3vCJ1U0x5A4ndOzyYSKj9 t/ErnJbTXZprZ0w7ypSyDPx3An1OrLvEK3Eq9sLGqLSzcT2Q2i2bAfmot9prLE9MGGVSgX kyt1WGdJ4/LZTAH6Uy5bB1/ZNqaoN+s= X-MC-Unique: 7zOnuXMoOa2TaZsnTBe59w-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH 04/11] qdev: Avoid using string visitor for properties Date: Fri, 24 Sep 2021 11:04:20 +0200 Message-Id: <20210924090427.9218-5-kwolf@redhat.com> In-Reply-To: <20210924090427.9218-1-kwolf@redhat.com> References: <20210924090427.9218-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, armbru@redhat.com, its@irrelevant.dk, pbonzini@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632474448539100001 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 --- 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 0705f00846..034b999401 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