From nobody Mon Feb 9 19:52:13 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=1612465657; cv=none; d=zohomail.com; s=zohoarc; b=AAy2UlsxwUPoqb5bLmv3313jMcWMeH8Kc9FRUKKFJRFGGasG9dte4y9+i2ldPN48cgSe1Fnwf4nimbw4ht2BIHT4i4whN3mprE+aX4gFBqaA8igqQmvNGzZgseYW9NXzmven7V1TXfkOdCz6W8+7P9Dk2KiIzqMlR7NvhhJzRtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612465657; 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=Li6Ao/DbQxPFNLfVf61+wv+1AFJdn7FecJIZ/NshX8k=; b=W+5PYLiEvNiezpCtd0bwwXnILSj+ZvVnHiX2fKYXbtLYfIOB0zMyr7N7nbu1wWo05WmuYL3DRZ/6HwOWtaqq934FK8SAePsjAqYG11WT28sR5qmHRnszurOh3CDgNdAJzw3YRxle+3SRVXM0xYVEIpJmuPqwOro+DPS0WZ2KKkI= 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 1612465657690791.0531184425017; Thu, 4 Feb 2021 11:07:37 -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-13-6QBtpFEcNFS9F9HLI54jkA-1; Thu, 04 Feb 2021 14:07:33 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80E8439387; Thu, 4 Feb 2021 19:07:27 +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 469BF5C257; Thu, 4 Feb 2021 19:07:25 +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 C22C718095CB; Thu, 4 Feb 2021 19:07:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 114J7IJi007361 for ; Thu, 4 Feb 2021 14:07:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5258D5DEF8; Thu, 4 Feb 2021 19:07:18 +0000 (UTC) Received: from blue.redhat.com (ovpn-112-103.phx2.redhat.com [10.3.112.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id C77BC5D9CC; Thu, 4 Feb 2021 19:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612465656; 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=Li6Ao/DbQxPFNLfVf61+wv+1AFJdn7FecJIZ/NshX8k=; b=ayNzbBe/8ECEXWN4N4QtQxyG8GkM3nrmlOZgQZi7DzhjSasJU6NYv4VMB3pxyZOXyNMUlw B4KeW/QoIFkJv5T7emNeaJpqXINlF65K6TaYM5mZRqKMX3tdAMkP0O4sfmNkIVLi+8a+zc +xekhkJKXMSsBP253AkZqlyE3PIY9+I= X-MC-Unique: 6QBtpFEcNFS9F9HLI54jkA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH 2/3] utils: Deprecate hex-with-suffix sizes Date: Thu, 4 Feb 2021 13:07:07 -0600 Message-Id: <20210204190708.1306296-3-eblake@redhat.com> In-Reply-To: <20210204190708.1306296-1-eblake@redhat.com> References: <20210204190708.1306296-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: vsementsov@virtuozzo.com, qemu-block@nongnu.org, "reviewer:Incompatible changes" , tao3.xu@intel.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.79 on 10.5.11.16 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" Supporting '0x20M' looks odd, particularly since we have an 'E' suffix that is ambiguous between a hex digit and the extremely large exibyte suffix, as well as a 'B' suffix for bytes. In practice, people using hex inputs are specifying values in bytes (and would have written 0x2000000, or possibly relied on default_suffix in the case of qemu_strtosz_MiB), and the use of scaling suffixes makes the most sense for inputs in decimal (where the user would write 32M). But rather than outright dropping support for hex-with-suffix, let's follow our deprecation policy. Sadly, since qemu_strtosz() does not have an Err** parameter, we pollute to stderr. Signed-off-by: Eric Blake --- docs/system/deprecated.rst | 8 ++++++++ util/cutils.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 6ac757ed9fa7..c404c3926e6f 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -146,6 +146,14 @@ library enabled as a cryptography provider. Neither the ``nettle`` library, or the built-in cryptography provider are supported on FIPS enabled hosts. +hexadecimal sizes with scaling multipliers (since 6.0) +'''''''''''''''''''''''''''''''''''''''''''''''''''''' + +Input parameters that take a size value should only use a size suffix +(such as 'k' or 'M') when the base is written in decimal, and not when +the value is hexadecimal. That is, '0x20M' is deprecated, and should +be written either as '32M' or as '0x2000000'. + QEMU Machine Protocol (QMP) commands ------------------------------------ diff --git a/util/cutils.c b/util/cutils.c index 0234763bd70b..75190565cbb5 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -264,7 +264,7 @@ static int do_strtosz(const char *nptr, const char **en= d, int retval; const char *endptr; unsigned char c; - bool mul_required =3D false; + bool mul_required =3D false, hex =3D false; uint64_t val; int64_t mul; double fraction =3D 0.0; @@ -309,6 +309,10 @@ static int do_strtosz(const char *nptr, const char **e= nd, c =3D *endptr; mul =3D suffix_mul(c, unit); if (mul > 0) { + if (hex) { + fprintf(stderr, "Using a multiplier suffix on hex numbers " + "is deprecated: %s\n", nptr); + } endptr++; } else { mul =3D suffix_mul(default_suffix, unit); --=20 2.30.0