From nobody Mon Feb 9 12:10:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591036903; cv=none; d=zohomail.com; s=zohoarc; b=NV2RNwGr02MFUg24lYDOHKb6FFoiMfWLW6dUtZRKxypOZYXRo51w5gmPKLWYnZls5daXo7fTGEdrs7RVRh2P2yP9oi64i3fPkWnceEzqnehQariA0iCojvDL9afk06HyhrJQfa78OAe2h8BxZOJtz+LNfculVTAxdFgY4bD9TxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591036903; 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=OHxVtPOwk8X0Lkxcx8Zs8dDT9uchBKr/fFeliKyqXPo=; b=b/wNgmFtev82LZp6uvEJnFKZyqEpEWIs+5Rx7VGO37Dg6bYG+sLZMBfbdwwGxeMTTLY3eslWiZK1VfDkoyq8422YJ8sBfb2L7XMQBpgWQibbNihSFC7NDNySzKufdESEIIB2ZY+CfN3dSHMAxLAGxzRr0VodGw2pfRyq7QOexKw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591036903586717.8981054960364; Mon, 1 Jun 2020 11:41:43 -0700 (PDT) Received: from localhost ([::1]:55966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfpNW-0000Fn-50 for importer@patchew.org; Mon, 01 Jun 2020 14:41:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfpMG-00078A-Vx for qemu-devel@nongnu.org; Mon, 01 Jun 2020 14:40:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:44958 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 1jfpMG-0000Oh-5z for qemu-devel@nongnu.org; Mon, 01 Jun 2020 14:40:24 -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-293-prLSYnmGOhu21cJ0x68CbA-1; Mon, 01 Jun 2020 14:40:21 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3928B835B42; Mon, 1 Jun 2020 18:40:20 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-113-144.ams2.redhat.com [10.36.113.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2E7610016DA; Mon, 1 Jun 2020 18:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591036823; 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=OHxVtPOwk8X0Lkxcx8Zs8dDT9uchBKr/fFeliKyqXPo=; b=gcz/SQVdRWCXAlRIG/R0Hc5aKXwvDlj7++qMJGMTAARQ4pGbEFmFiy3Cl/SR0/fw6htfxj VDQ/ifGsGKXRtqolRwoWAaqQBFQed7pihf6lg7XDWxU49rvd8hFa68CCEUTuEq/dW6uMLJ 5gRDRlfUgPhqP35b1ti3U1cI47iTjzA= X-MC-Unique: prLSYnmGOhu21cJ0x68CbA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Subject: [PULL 04/12] hmp: Simplify qom-set Date: Mon, 1 Jun 2020 19:39:56 +0100 Message-Id: <20200601184004.272784-5-dgilbert@redhat.com> In-Reply-To: <20200601184004.272784-1-dgilbert@redhat.com> References: <20200601184004.272784-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=dgilbert@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/01 11:55:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, 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, SPF_PASS=-0.001, T_HK_NAME_DR=0.01 autolearn=_AUTOLEARN 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: mszeredi@redhat.com, lukasstraub2@web.de, quintela@redhat.com, pannengyuan@huawei.com, f4bug@amsat.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: "Dr. David Alan Gilbert" Simplify qom_set by making it use qmp_qom_set and the JSON parser. (qemu) qom-get /machine smm "auto" (qemu) qom-set /machine smm "auto" Signed-off-by: Dr. David Alan Gilbert Message-Id: <20200520151108.160598-3-dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster Signed-off-by: Dr. David Alan Gilbert With 's'->'S' type change suggested by Paolo and Markus --- hmp-commands.hx | 2 +- qom/qom-hmp-cmds.c | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 250ddae54d..28256209b5 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1806,7 +1806,7 @@ ERST =20 { .name =3D "qom-set", - .args_type =3D "path:s,property:s,value:s", + .args_type =3D "path:s,property:s,value:S", .params =3D "path property value", .help =3D "set QOM property", .cmd =3D hmp_qom_set, diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index a8b0a080c7..f704b6949a 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -48,19 +48,13 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) const char *property =3D qdict_get_str(qdict, "property"); const char *value =3D qdict_get_str(qdict, "value"); Error *err =3D NULL; - bool ambiguous =3D false; - Object *obj; + QObject *obj; =20 - obj =3D object_resolve_path(path, &ambiguous); - if (obj =3D=3D NULL) { - error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", path); - } else { - if (ambiguous) { - monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path); - } - object_property_parse(obj, value, property, &err); + obj =3D qobject_from_json(value, &err); + if (err =3D=3D NULL) { + qmp_qom_set(path, property, obj, &err); } + hmp_handle_error(mon, err); } =20 --=20 2.26.2