[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/24] util: remove support for hex numbers with a scaling suffix
From: |
Paolo Bonzini |
Subject: |
[PULL 21/24] util: remove support for hex numbers with a scaling suffix |
Date: |
Wed, 21 Dec 2022 19:01:38 +0100 |
This was deprecated in 6.0 and can now be removed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
docs/about/deprecated.rst | 8 --------
docs/about/removed-features.rst | 8 ++++++++
tests/unit/test-cutils.c | 8 ++++++++
util/cutils.c | 14 +++-----------
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 5414289ffaf3..e2ca3c8b566d 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -58,14 +58,6 @@ and will cause a warning.
The replacement for the ``nodelay`` short-form boolean option is ``nodelay=on``
rather than ``delay=off``.
-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'.
-
``-spice password=string`` (since 6.0)
''''''''''''''''''''''''''''''''''''''
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index 78b332faf50a..724a83142511 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -408,6 +408,14 @@ pcspk-audiodev=<name>``.
Use ``-device`` instead.
+Hexadecimal sizes with scaling multipliers (since 8.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' should be written either as
+'32M' or as '0x2000000'.
+
QEMU Machine Protocol (QMP) commands
------------------------------------
diff --git a/tests/unit/test-cutils.c b/tests/unit/test-cutils.c
index 86caddcf6498..2126b463919b 100644
--- a/tests/unit/test-cutils.c
+++ b/tests/unit/test-cutils.c
@@ -2315,6 +2315,14 @@ static void test_qemu_strtosz_invalid(void)
g_assert_cmpint(res, ==, 0xbaadf00d);
g_assert(endptr == str);
+ /* No suffixes */
+ str = "0x18M";
+ endptr = NULL;
+ err = qemu_strtosz(str, &endptr, &res);
+ g_assert_cmpint(err, ==, -EINVAL);
+ g_assert_cmpint(res, ==, 0xbaadf00d);
+ g_assert(endptr == str);
+
/* No negative values */
str = "-0";
endptr = NULL;
diff --git a/util/cutils.c b/util/cutils.c
index def9c746cede..5887e7441405 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -197,10 +197,8 @@ static int64_t suffix_mul(char suffix, int64_t unit)
* fractional portion is truncated to byte
* - 0x7fEE - hexadecimal, unit determined by @default_suffix
*
- * The following cause a deprecation warning, and may be removed in the future
- * - 0xabc{kKmMgGtTpP} - hex with scaling suffix
- *
* The following are intentionally not supported
+ * - hex with scaling suffix, such as 0x20M
* - octal, such as 08
* - fractional hex, such as 0x1.8
* - floating point exponents, such as 1e3
@@ -222,7 +220,6 @@ static int do_strtosz(const char *nptr, const char **end,
int retval;
const char *endptr, *f;
unsigned char c;
- bool hex = false;
uint64_t val, valf = 0;
int64_t mul;
@@ -237,17 +234,16 @@ static int do_strtosz(const char *nptr, const char **end,
goto out;
}
if (val == 0 && (*endptr == 'x' || *endptr == 'X')) {
- /* Input looks like hex, reparse, and insist on no fraction. */
+ /* Input looks like hex; reparse, and insist on no fraction or suffix.
*/
retval = qemu_strtou64(nptr, &endptr, 16, &val);
if (retval) {
goto out;
}
- if (*endptr == '.') {
+ if (*endptr == '.' || suffix_mul(*endptr, unit) > 0) {
endptr = nptr;
retval = -EINVAL;
goto out;
}
- hex = true;
} else if (*endptr == '.') {
/*
* Input looks like a fraction. Make sure even 1.k works
@@ -272,10 +268,6 @@ static int do_strtosz(const char *nptr, const char **end,
c = *endptr;
mul = suffix_mul(c, unit);
if (mul > 0) {
- if (hex) {
- warn_report("Using a multiplier suffix on hex numbers "
- "is deprecated: %s", nptr);
- }
endptr++;
} else {
mul = suffix_mul(default_suffix, unit);
--
2.38.1
- [PULL 07/24] configure: remove useless write_c_skeleton, (continued)
- [PULL 07/24] configure: remove useless write_c_skeleton, Paolo Bonzini, 2022/12/21
- [PULL 11/24] configure: remove backwards-compatibility and obsolete options, Paolo Bonzini, 2022/12/21
- [PULL 09/24] configure: cleanup $cpu tests, Paolo Bonzini, 2022/12/21
- [PULL 12/24] meson: tweak hardening options for Windows, Paolo Bonzini, 2022/12/21
- [PULL 13/24] meson: cleanup dummy-cpus.c rules, Paolo Bonzini, 2022/12/21
- [PULL 14/24] tests/qapi-schema: remove Meson workaround, Paolo Bonzini, 2022/12/21
- [PULL 15/24] configure: test all warnings, Paolo Bonzini, 2022/12/21
- [PULL 16/24] meson: support meson 0.64 -Doptimization=plain, Paolo Bonzini, 2022/12/21
- [PULL 17/24] meson: cleanup compiler detection, Paolo Bonzini, 2022/12/21
- [PULL 19/24] docs: do not talk about past removal as happening in the future, Paolo Bonzini, 2022/12/21
- [PULL 21/24] util: remove support for hex numbers with a scaling suffix,
Paolo Bonzini <=
- [PULL 23/24] target/i386: Add SGX aex-notify and EDECCSSA support, Paolo Bonzini, 2022/12/21
- [PULL 20/24] KVM: remove support for kernel-irqchip=off, Paolo Bonzini, 2022/12/21
- [PULL 18/24] meson: accept relative symlinks in "meson introspect --installed" data, Paolo Bonzini, 2022/12/21
- [PULL 24/24] i386: SGX: remove deprecated member of SGXInfo, Paolo Bonzini, 2022/12/21
- [PULL 22/24] util: remove support -chardev tty and -chardev parport, Paolo Bonzini, 2022/12/21