From: Jim Cromie <jim.cromie@gmail.com>
To: qemu-devel@nongnu.org
Cc: Jim Cromie <jim.cromie@gmail.com>
Subject: [PATCH] print memory in MB units in initrd-too-large errmsg
Date: Fri, 4 Aug 2023 13:01:01 -0600 [thread overview]
Message-ID: <20230804190101.759753-1-jim.cromie@gmail.com> (raw)
Change 2 error messages to display sizes in MB, not bytes.
qemu: initrd is too large, cannot support this. (max: 2047 MB, need 5833 MB)
Also, distinguish 2 sites by adding "it" and "this" respectively.
This tells a careful reader that the error above is from the 2nd size
check.
With MB displayed, I have to ask: is it coincidence that max == 2048-1 ?
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
hw/i386/x86.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index a88a126123..0677fe2fd1 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -878,9 +878,9 @@ void x86_load_linux(X86MachineState *x86ms,
initrd_size = g_mapped_file_get_length(mapped_file);
initrd_max = x86ms->below_4g_mem_size - acpi_data_size - 1;
if (initrd_size >= initrd_max) {
- fprintf(stderr, "qemu: initrd is too large, cannot support."
- "(max: %"PRIu32", need %"PRId64")\n",
- initrd_max, (uint64_t)initrd_size);
+ fprintf(stderr, "qemu: initrd is too large, cannot support it. "
+ "(max: %"PRIu32" MB, need %"PRId64" MB)\n",
+ initrd_max>>20, (uint64_t)initrd_size>>20);
exit(1);
}
@@ -1023,9 +1023,9 @@ void x86_load_linux(X86MachineState *x86ms,
initrd_data = g_mapped_file_get_contents(mapped_file);
initrd_size = g_mapped_file_get_length(mapped_file);
if (initrd_size >= initrd_max) {
- fprintf(stderr, "qemu: initrd is too large, cannot support."
- "(max: %"PRIu32", need %"PRId64")\n",
- initrd_max, (uint64_t)initrd_size);
+ fprintf(stderr, "qemu: initrd is too large, cannot support this. "
+ "(max: %"PRIu32" MB, need %"PRId64" MB)\n",
+ initrd_max>>20, (uint64_t)initrd_size>>20);
exit(1);
}
--
2.41.0
next reply other threads:[~2023-08-04 21:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 19:01 Jim Cromie [this message]
2023-08-05 6:26 ` [PATCH] print memory in MB units in initrd-too-large errmsg Markus Armbruster
2023-08-07 3:08 ` jim.cromie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230804190101.759753-1-jim.cromie@gmail.com \
--to=jim.cromie@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).