From nobody Wed Nov 12 23:17:06 2025 Delivered-To: importer@patchew.org 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; 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=1574445621; cv=none; d=zohomail.com; s=zohoarc; b=QzcT0G1gLo510CgSNGm+zaFKo6t4H5yzO4SGXw3liIpqNEbCkMrdMExltLDrD1iG5+SmDfPHJ5FZ93oGDoeetOHyzZy6nCmjLwgfMXIITvc/YrYp+LHmibstiDUKCqI34LT/sDffNZLtKXoyBj2Ugy0BmAimFCjlxO20R3C+h3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574445621; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=3uplgnk05nmvzXii7ptSX1Nb2C/HeqZjR5kJ19Id48M=; b=GVFjyqw29ytOMjgq65Fd+yY2vfLxWIOUsA6ChHaCY/pcnieOVubdvR/MwyHaFwHRsKqhQCHETcrPxMzjyFgqRv33nUaySt+j/jofOWwG9kWnE7M1zeM/+lYW3rxisLnzpnvInTbQOTtIFhUX1EP1Mwjk84UCW2wOSY23SDZm9Ns= 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 1574445621603492.6723602887955; Fri, 22 Nov 2019 10:00:21 -0800 (PST) Received: from localhost ([::1]:53546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYDEB-000535-RJ for importer@patchew.org; Fri, 22 Nov 2019 13:00:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54168) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYC6n-0005ws-21 for qemu-devel@nongnu.org; Fri, 22 Nov 2019 11:48:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iYC6l-0004Cn-88 for qemu-devel@nongnu.org; Fri, 22 Nov 2019 11:48:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22886 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iYC6j-0004Bl-70 for qemu-devel@nongnu.org; Fri, 22 Nov 2019 11:48:33 -0500 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-141-5v-Rb_NVMRy84jmRGpsx7A-1; Fri, 22 Nov 2019 11:48:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B13C4107ACC5; Fri, 22 Nov 2019 16:48:26 +0000 (UTC) Received: from maximlenovopc.usersys.redhat.com (unknown [10.35.206.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id D761577014; Fri, 22 Nov 2019 16:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574441311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3uplgnk05nmvzXii7ptSX1Nb2C/HeqZjR5kJ19Id48M=; b=PNCxHC4ged95KpjCh40va8hIEb2AYejhZDt/Lx7q34E38jU9RmBzvPrda4OkQvgA+t0owq 0A+GJTEBfey3janOcxHgeo7Wk4Bzxepqh0RUiXBVft55xU8zpthF1chW9fsFACp8o/mZhI M7lWdPCnR57Ms4yqSvxJ3gSFGC7Gw8M= From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v2 7/9] monitor/hmp: move remaining hmp_block* functions to block-hmp-cmds.c Date: Fri, 22 Nov 2019 18:48:05 +0200 Message-Id: <20191122164807.27938-8-mlevitsk@redhat.com> In-Reply-To: <20191122164807.27938-1-mlevitsk@redhat.com> References: <20191122164807.27938-1-mlevitsk@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 5v-Rb_NVMRy84jmRGpsx7A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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: Kevin Wolf , qemu-block@nongnu.org, Markus Armbruster , "Dr. David Alan Gilbert" , Maxim Levitsky , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Maxim Levitsky --- block/monitor/block-hmp-cmds.c | 63 +++++++++++++++++++++++++++++++++ monitor/hmp-cmds.c | 64 ---------------------------------- 2 files changed, 63 insertions(+), 64 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index f3d22c7dd3..76951352b1 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -337,3 +337,66 @@ void hmp_snapshot_delete_blkdev_internal(Monitor *mon,= const QDict *qdict) true, name, &err); hmp_handle_error(mon, &err); } + +void hmp_block_resize(Monitor *mon, const QDict *qdict) +{ + const char *device =3D qdict_get_str(qdict, "device"); + int64_t size =3D qdict_get_int(qdict, "size"); + Error *err =3D NULL; + + qmp_block_resize(true, device, false, NULL, size, &err); + hmp_handle_error(mon, &err); +} + +void hmp_block_stream(Monitor *mon, const QDict *qdict) +{ + Error *error =3D NULL; + const char *device =3D qdict_get_str(qdict, "device"); + const char *base =3D qdict_get_try_str(qdict, "base"); + int64_t speed =3D qdict_get_try_int(qdict, "speed", 0); + + qmp_block_stream(true, device, device, base !=3D NULL, base, false, NU= LL, + false, NULL, qdict_haskey(qdict, "speed"), speed, tru= e, + BLOCKDEV_ON_ERROR_REPORT, false, false, false, false, + &error); + + hmp_handle_error(mon, &error); +} + +void hmp_block_passwd(Monitor *mon, const QDict *qdict) +{ + const char *device =3D qdict_get_str(qdict, "device"); + const char *password =3D qdict_get_str(qdict, "password"); + Error *err =3D NULL; + + qmp_block_passwd(true, device, false, NULL, password, &err); + hmp_handle_error(mon, &err); +} + +void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + char *device =3D (char *) qdict_get_str(qdict, "device"); + BlockIOThrottle throttle =3D { + .bps =3D qdict_get_int(qdict, "bps"), + .bps_rd =3D qdict_get_int(qdict, "bps_rd"), + .bps_wr =3D qdict_get_int(qdict, "bps_wr"), + .iops =3D qdict_get_int(qdict, "iops"), + .iops_rd =3D qdict_get_int(qdict, "iops_rd"), + .iops_wr =3D qdict_get_int(qdict, "iops_wr"), + }; + + /* qmp_block_set_io_throttle has separate parameters for the + * (deprecated) block device name and the qdev ID but the HMP + * version has only one, so we must decide which one to pass. */ + if (blk_by_name(device)) { + throttle.has_device =3D true; + throttle.device =3D device; + } else { + throttle.has_id =3D true; + throttle.id =3D device; + } + + qmp_block_set_io_throttle(&throttle, &err); + hmp_handle_error(mon, &err); +} diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 2acdcd6e1e..8be48e0af6 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1309,16 +1309,6 @@ void hmp_set_link(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } =20 -void hmp_block_passwd(Monitor *mon, const QDict *qdict) -{ - const char *device =3D qdict_get_str(qdict, "device"); - const char *password =3D qdict_get_str(qdict, "password"); - Error *err =3D NULL; - - qmp_block_passwd(true, device, false, NULL, password, &err); - hmp_handle_error(mon, &err); -} - void hmp_balloon(Monitor *mon, const QDict *qdict) { int64_t value =3D qdict_get_int(qdict, "value"); @@ -1328,17 +1318,6 @@ void hmp_balloon(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } =20 -void hmp_block_resize(Monitor *mon, const QDict *qdict) -{ - const char *device =3D qdict_get_str(qdict, "device"); - int64_t size =3D qdict_get_int(qdict, "size"); - Error *err =3D NULL; - - qmp_block_resize(true, device, false, NULL, size, &err); - hmp_handle_error(mon, &err); -} - - void hmp_loadvm(Monitor *mon, const QDict *qdict) { int saved_vm_running =3D runstate_is_running(); @@ -1887,49 +1866,6 @@ void hmp_change(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } =20 -void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) -{ - Error *err =3D NULL; - char *device =3D (char *) qdict_get_str(qdict, "device"); - BlockIOThrottle throttle =3D { - .bps =3D qdict_get_int(qdict, "bps"), - .bps_rd =3D qdict_get_int(qdict, "bps_rd"), - .bps_wr =3D qdict_get_int(qdict, "bps_wr"), - .iops =3D qdict_get_int(qdict, "iops"), - .iops_rd =3D qdict_get_int(qdict, "iops_rd"), - .iops_wr =3D qdict_get_int(qdict, "iops_wr"), - }; - - /* qmp_block_set_io_throttle has separate parameters for the - * (deprecated) block device name and the qdev ID but the HMP - * version has only one, so we must decide which one to pass. */ - if (blk_by_name(device)) { - throttle.has_device =3D true; - throttle.device =3D device; - } else { - throttle.has_id =3D true; - throttle.id =3D device; - } - - qmp_block_set_io_throttle(&throttle, &err); - hmp_handle_error(mon, &err); -} - -void hmp_block_stream(Monitor *mon, const QDict *qdict) -{ - Error *error =3D NULL; - const char *device =3D qdict_get_str(qdict, "device"); - const char *base =3D qdict_get_try_str(qdict, "base"); - int64_t speed =3D qdict_get_try_int(qdict, "speed", 0); - - qmp_block_stream(true, device, device, base !=3D NULL, base, false, NU= LL, - false, NULL, qdict_haskey(qdict, "speed"), speed, tru= e, - BLOCKDEV_ON_ERROR_REPORT, false, false, false, false, - &error); - - hmp_handle_error(mon, &error); -} - typedef struct HMPMigrationStatus { QEMUTimer *timer; --=20 2.17.2