From nobody Mon Feb 9 06:34:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614178026; cv=none; d=zohomail.com; s=zohoarc; b=UBkcDPjG106a4aFLuScIVraeJcl5MH4HiSWOfe5RQLwqwCTS522ih28Owhxjew4LBZlLn3z98rFMt38W+ypWHui4WH8+FalWDB/z49fNVKjYLRqpiOeKmmFaMBW2Gzn/nOV0Czupdb4DBW0clRKFMAUwPx4CYc4H9ZEhAG8wL28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178026; 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=Rvu65+jRiUDjpKVVzlkVo7vGPJ+1eTBtulg5V6OM288=; b=Z1cEVmfEbz7kfw6XV4VDjb3kMpFOMONikpXxN8c4o97qpVnabbzVW7VyGClRCbt/+M9n1DiFpkOQ5uDDHUet/19Miu10+vjyJF8aAzUSDmf3xxJQ6TgXkzJ638EkBNREt3AEZyS3wVERt6VbQ+ub/ywBNyodKOM1BmoVB7h0bx0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 16141780269336.577739793331261; Wed, 24 Feb 2021 06:47:06 -0800 (PST) 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-330-A5CHiytJOPiKBeXRBuK1EA-1; Wed, 24 Feb 2021 09:46:43 -0500 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 E0144101D0B1; Wed, 24 Feb 2021 13:55:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC32919C46; Wed, 24 Feb 2021 13:55:59 +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 3578A58074; Wed, 24 Feb 2021 13:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODtvPJ017043 for ; Wed, 24 Feb 2021 08:55:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8162A5D743; Wed, 24 Feb 2021 13:55:57 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 937025D6D3; Wed, 24 Feb 2021 13:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178025; 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=Rvu65+jRiUDjpKVVzlkVo7vGPJ+1eTBtulg5V6OM288=; b=U4ezGw/GzG76Vy42t2TJqMEuCMJVvVt008NSVUpOUXTXk4fQZrCpCZeh3sfYIJl0K/wLzi K/i6LA2vUhHAwkZkEkp35ZGi2aGBVXjmTsRM8aMa3RLgIb78Ms8UxoJmxMEvsPqwoU2gLt yTNn58pFpRcX5qQY4cGe9iRJ/LEjT0k= X-MC-Unique: A5CHiytJOPiKBeXRBuK1EA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 21/31] qemu-storage-daemon: Implement --object with qmp_object_add() Date: Wed, 24 Feb 2021 14:52:45 +0100 Message-Id: <20210224135255.253837-22-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.84 on 10.5.11.23 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) Content-Type: text/plain; charset="utf-8" This QAPIfies --object and ensures that QMP and the command line option behave the same. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- storage-daemon/qemu-storage-daemon.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index d8d172cc60..0dfb9c1448 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -38,6 +38,7 @@ #include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-export.h" #include "qapi/qapi-visit-control.h" +#include "qapi/qapi-visit-qom.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" #include "qapi/qobject-input-visitor.h" @@ -130,15 +131,6 @@ enum { =20 extern QemuOptsList qemu_chardev_opts; =20 -static QemuOptsList qemu_object_opts =3D { - .name =3D "object", - .implied_opt_name =3D "qom-type", - .head =3D QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head), - .desc =3D { - { } - }, -}; - static void init_qmp_commands(void) { qmp_init_marshal(&qmp_commands); @@ -263,14 +255,22 @@ static void process_options(int argc, char *argv[]) { QDict *args; bool help; + Visitor *v; + ObjectOptions *options; =20 args =3D keyval_parse(optarg, "qom-type", &help, &error_fa= tal); if (help) { user_creatable_print_help_from_qdict(args); exit(EXIT_SUCCESS); } - user_creatable_add_dict(args, true, &error_fatal); + + v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); + visit_type_ObjectOptions(v, NULL, &options, &error_fatal); + visit_free(v); qobject_unref(args); + + qmp_object_add(options, &error_fatal); + qapi_free_ObjectOptions(options); break; } default: @@ -295,7 +295,6 @@ int main(int argc, char *argv[]) =20 module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_TRACE); - qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_trace_opts); qcrypto_init(&error_fatal); bdrv_init(); --=20 2.29.2