From nobody Mon Feb 9 08:29:23 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=1614177989; cv=none; d=zohomail.com; s=zohoarc; b=S3CHiG/woHTTNbVsSCmmF9QKUmG2l+/Q1uKfZyX/CVhG8/C37qwvI4ZQievW6rEx23oTBcAnL7lvd30y2nPaa3lC4QE7dyddqrOn5KBK6pW3GhxBlM93A+7yAqjX7O6YqslUagmKjNn8aYjE8/s7GatRVSCdn/VNb9A9MVXTOe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177989; 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=feB+MH6bOD5uyb0j/c8EeYyC86YRMBCIo46Nw4bo/pk=; b=YnKlVZzodmZALAbVwtmLc3kmGwPius7Fc5muBVuqIbtkd34DEOWfrZUx9XfUHGioXdlvqJ7itCIUCqR2d0drvCUbx2TT501KUri0zlCdIQttMfgqGS7Z+le5AKuHHtJFuD2vyA8j4krM6COYlBiNRicBMZ61urLtz+gReNDkunI= 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) header.from= 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 1614177989521690.3321864884985; Wed, 24 Feb 2021 06:46:29 -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-229-1yHSPdH3Os211keLucpy3A-1; Wed, 24 Feb 2021 09:46:22 -0500 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 0981310871FB; Wed, 24 Feb 2021 13:56:19 +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 CD8B31001281; Wed, 24 Feb 2021 13:56:18 +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 7227C18095CB; Wed, 24 Feb 2021 13:56:18 +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 11ODuGXT017099 for ; Wed, 24 Feb 2021 08:56:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9B5605D6AD; Wed, 24 Feb 2021 13:56:16 +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 612985D740; Wed, 24 Feb 2021 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177986; 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=feB+MH6bOD5uyb0j/c8EeYyC86YRMBCIo46Nw4bo/pk=; b=bmwdCTcFIii4atqO5IZlHnUV+O2utgm00YRBqrtKLH2TTxac3vSTmtIdvV2sxgEXPmZgBx Bm9AMo1n/LL2R2fajftpzz/0cPDkVmysClyQkTBwRnnN1ZmWiCIyKEj5eYUGLpaWSQ67Og CPvnFXIvpOfDQgkl8JJWYSIp+xPKRUw= X-MC-Unique: 1yHSPdH3Os211keLucpy3A-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 24/31] qemu-io: Use user_creatable_process_cmdline() for --object Date: Wed, 24 Feb 2021 14:52:48 +0100 Message-Id: <20210224135255.253837-25-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.22 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 switches qemu-io from a QemuOpts-based parser for --object to user_creatable_process_cmdline() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties accessible. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- qemu-io.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index ac88d8bd40..bf902302e9 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -477,23 +477,6 @@ enum { OPTION_IMAGE_OPTS =3D 257, }; =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 bool qemu_io_object_print_help(const char *type, QemuOpts *opts) -{ - if (user_creatable_print_help(type, opts)) { - exit(0); - } - return true; -} - static QemuOptsList file_opts =3D { .name =3D "file", .implied_opt_name =3D "file", @@ -550,7 +533,6 @@ int main(int argc, char **argv) qcrypto_init(&error_fatal); =20 module_call_init(MODULE_INIT_QOM); - qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_trace_opts); bdrv_init(); =20 @@ -612,14 +594,9 @@ int main(int argc, char **argv) case 'U': force_share =3D true; break; - case OPTION_OBJECT: { - QemuOpts *qopts; - qopts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!qopts) { - exit(1); - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: imageOpts =3D true; break; @@ -644,10 +621,6 @@ int main(int argc, char **argv) exit(1); } =20 - qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_io_object_print_help, &error_fatal); - if (!trace_init_backends()) { exit(1); } --=20 2.29.2