From nobody Tue Feb 10 16:22:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150695876858350.27998793142763; Mon, 2 Oct 2017 08:39:28 -0700 (PDT) Received: from localhost ([::1]:52874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2oW-0001xp-RZ for importer@patchew.org; Mon, 02 Oct 2017 11:39:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2be-0007zU-Mg for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2bc-0007y5-0w for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz2bb-0007wZ-L4 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:03 -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 mx1.redhat.com (Postfix) with ESMTPS id 9183D15565; Mon, 2 Oct 2017 15:26:02 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5320999DEE; Mon, 2 Oct 2017 15:26:02 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E8F3C11562F2; Mon, 2 Oct 2017 17:25:52 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9183D15565 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 17:25:51 +0200 Message-Id: <20171002152552.27999-32-armbru@redhat.com> In-Reply-To: <20171002152552.27999-1-armbru@redhat.com> References: <20171002152552.27999-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 02 Oct 2017 15:26:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH 31/32] qapi/options: QAPIfy --blockdev argument type X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster --- qapi/options.json | 2 +- vl.c | 42 +++++++----------------------------------- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/qapi/options.json b/qapi/options.json index eb1a3e2dde..d55c6bfa81 100644 --- a/qapi/options.json +++ b/qapi/options.json @@ -877,7 +877,7 @@ # !end texinfo ## { 'option': '--blockdev', - 'data': 'str', # FIXME BlockdevOptions + 'data': 'BlockdevOptions', 'boxed': true, 'help': [ "-blockdev [driver=3D]driver[,node-name=3DN][,discard=3Dignore|unmap]", " [,cache.direct=3Don|off][,cache.no-flush=3Don|off]", diff --git a/vl.c b/vl.c index 1814a53337..32f4b5fef3 100644 --- a/vl.c +++ b/vl.c @@ -3083,13 +3083,6 @@ int main(int argc, char **argv, char **envp) Error *err =3D NULL; bool list_data_dirs =3D false; char **dirs; - typedef struct BlockdevOptions_queue { - BlockdevOptions *bdo; - Location loc; - QSIMPLEQ_ENTRY(BlockdevOptions_queue) entry; - } BlockdevOptions_queue; - QSIMPLEQ_HEAD(, BlockdevOptions_queue) bdo_queue - =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue); QAPIOption *qopt; =20 module_call_init(MODULE_INIT_TRACE); @@ -3233,25 +3226,8 @@ int main(int argc, char **argv, char **envp) drive_add(IF_DEFAULT, 3, qopt[i].u.hdb.data, HD_OPTS); break; case QAPI_OPTION_KIND_BLOCKDEV: - { - Visitor *v; - BlockdevOptions_queue *bdo; - - v =3D qobject_input_visitor_new_str(qopt[i].u.blockdev= .data, - "driver", &err); - if (!v) { - error_report_err(err); - exit(1); - } - - bdo =3D g_new(BlockdevOptions_queue, 1); - visit_type_BlockdevOptions(v, NULL, &bdo->bdo, - &error_fatal); - visit_free(v); - loc_save(&bdo->loc); - QSIMPLEQ_INSERT_TAIL(&bdo_queue, bdo, entry); - break; - } + /* nothing to do */ + break; case QAPI_OPTION_KIND_DRIVE: if (drive_def(qopt[i].u.drive.data) =3D=3D NULL) { exit(1); @@ -4651,15 +4627,11 @@ int main(int argc, char **argv, char **envp) } =20 /* open the virtual block devices */ - while (!QSIMPLEQ_EMPTY(&bdo_queue)) { - BlockdevOptions_queue *bdo =3D QSIMPLEQ_FIRST(&bdo_queue); - - QSIMPLEQ_REMOVE_HEAD(&bdo_queue, entry); - loc_push_restore(&bdo->loc); - qmp_blockdev_add(bdo->bdo, &error_fatal); - loc_pop(&bdo->loc); - qapi_free_BlockdevOptions(bdo->bdo); - g_free(bdo); + for (i =3D 0; qopt[i].cnt; i++) { + if (qopt[i].type =3D=3D QAPI_OPTION_KIND_BLOCKDEV) { + loc_set_cmdline(argv, qopt[i].idx, qopt[i].cnt); + qmp_blockdev_add(&qopt[i].u.blockdev, &error_fatal); + } } if (snapshot || replay_mode !=3D REPLAY_MODE_NONE) { qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, --=20 2.13.6