From nobody Mon Feb 9 08:56: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@nongnu.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@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510353912535343.0068325632526; Fri, 10 Nov 2017 14:45:12 -0800 (PST) Received: from localhost ([::1]:43754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDI2v-0007pb-Po for importer@patchew.org; Fri, 10 Nov 2017 17:45:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDI1F-0006mt-Vx for qemu-devel@nongnu.org; Fri, 10 Nov 2017 17:43:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDI1E-0000pV-Ti for qemu-devel@nongnu.org; Fri, 10 Nov 2017 17:43:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34172) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eDI18-0000nb-SX; Fri, 10 Nov 2017 17:43:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D7A97E423; Fri, 10 Nov 2017 22:43:18 +0000 (UTC) Received: from localhost (ovpn-204-126.brq.redhat.com [10.40.204.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94AC717122; Fri, 10 Nov 2017 22:43:17 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Fri, 10 Nov 2017 23:43:01 +0100 Message-Id: <20171110224302.14424-4-mreitz@redhat.com> In-Reply-To: <20171110224302.14424-1-mreitz@redhat.com> References: <20171110224302.14424-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 10 Nov 2017 22:43:18 +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] [PATCH for-2.12 3/4] blockdev: Drop BD-{remove, insert}-medium's @device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org, Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.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" This is an incompatible change, which is fine as the commands are experimental. Signed-off-by: Max Reitz --- qapi/block-core.json | 10 ++-------- blockdev.c | 30 +++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 76bf50f813..cf3f941999 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3405,8 +3405,6 @@ # # If the tray is open and there is no medium inserted, this will be a no-o= p. # -# @device: Block device name (deprecated, use @id instead) -# # @id: The name or QOM path of the guest device (since: 2.8) # # Note: This command is still a work in progress and is considered experim= ental. @@ -3441,8 +3439,7 @@ # ## { 'command': 'x-blockdev-remove-medium', - 'data': { '*device': 'str', - '*id': 'str' } } + 'data': { 'id': 'str' } } =20 ## # @x-blockdev-insert-medium: @@ -3451,8 +3448,6 @@ # device's tray must currently be open (unless there is no attached guest # device) and there must be no medium inserted already. # -# @device: Block device name (deprecated, use @id instead) -# # @id: The name or QOM path of the guest device (since: 2.8) # # @node-name: name of a node in the block driver state graph @@ -3480,8 +3475,7 @@ # ## { 'command': 'x-blockdev-insert-medium', - 'data': { '*device': 'str', - '*id': 'str', + 'data': { 'id': 'str', 'node-name': 'str'} } =20 =20 diff --git a/blockdev.c b/blockdev.c index 56a6b24a0b..a74224e8f8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -59,6 +59,11 @@ static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_stat= es =3D =20 static int do_open_tray(const char *blk_name, const char *qdev_id, bool force, Error **errp); +static void blockdev_remove_medium(bool has_device, const char *device, + bool has_id, const char *id, Error **er= rp); +static void blockdev_insert_medium(bool has_device, const char *device, + bool has_id, const char *id, + const char *node_name, Error **errp); =20 static const char *const if_name[IF_COUNT] =3D { [IF_NONE] =3D "none", @@ -2256,7 +2261,7 @@ void qmp_eject(bool has_device, const char *device, } error_free(local_err); =20 - qmp_x_blockdev_remove_medium(has_device, device, has_id, id, errp); + blockdev_remove_medium(has_device, device, has_id, id, errp); } =20 void qmp_block_passwd(bool has_device, const char *device, @@ -2379,8 +2384,8 @@ void qmp_blockdev_close_tray(bool has_device, const c= har *device, } } =20 -void qmp_x_blockdev_remove_medium(bool has_device, const char *device, - bool has_id, const char *id, Error **err= p) +static void blockdev_remove_medium(bool has_device, const char *device, + bool has_id, const char *id, Error **er= rp) { BlockBackend *blk; BlockDriverState *bs; @@ -2436,6 +2441,11 @@ out: aio_context_release(aio_context); } =20 +void qmp_x_blockdev_remove_medium(const char *id, Error **errp) +{ + blockdev_remove_medium(false, NULL, true, id, errp); +} + static void qmp_blockdev_insert_anon_medium(BlockBackend *blk, BlockDriverState *bs, Error **= errp) { @@ -2481,9 +2491,9 @@ static void qmp_blockdev_insert_anon_medium(BlockBack= end *blk, } } =20 -void qmp_x_blockdev_insert_medium(bool has_device, const char *device, - bool has_id, const char *id, - const char *node_name, Error **errp) +static void blockdev_insert_medium(bool has_device, const char *device, + bool has_id, const char *id, + const char *node_name, Error **errp) { BlockBackend *blk; BlockDriverState *bs; @@ -2509,6 +2519,12 @@ void qmp_x_blockdev_insert_medium(bool has_device, c= onst char *device, qmp_blockdev_insert_anon_medium(blk, bs, errp); } =20 +void qmp_x_blockdev_insert_medium(const char *id, const char *node_name, + Error **errp) +{ + blockdev_insert_medium(false, NULL, true, id, node_name, errp); +} + void qmp_blockdev_change_medium(bool has_device, const char *device, bool has_id, const char *id, const char *filename, @@ -2583,7 +2599,7 @@ void qmp_blockdev_change_medium(bool has_device, cons= t char *device, error_free(err); err =3D NULL; =20 - qmp_x_blockdev_remove_medium(has_device, device, has_id, id, &err); + blockdev_remove_medium(has_device, device, has_id, id, &err); if (err) { error_propagate(errp, err); goto fail; --=20 2.13.6