aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2015-01-29 14:48:40 +0100
committerMichael S. Tsirkin <mst@redhat.com>2015-02-26 12:42:19 +0100
commit214224adb4ebc9f3d211b867f588413e13f05bb3 (patch)
tree1d86cb09f7a7a9c27db1b85d43e4be4ad3220a84 /vl.c
parentc0e57a6022fdb2b00e7946bbfa2ad1f9515527cd (diff)
vl.c: Fix error messages when parsing maxmem parameters
Produce more human readable error messages and fix few spelling mistakes. Also remove a redundant check for the max memory size. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/vl.c b/vl.c
index e1ffd0a96a..908128c2ba 100644
--- a/vl.c
+++ b/vl.c
@@ -2693,29 +2693,27 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size)
uint64_t slots;
sz = qemu_opt_get_size(opts, "maxmem", 0);
+ slots = qemu_opt_get_number(opts, "slots", 0);
if (sz < ram_size) {
- error_report("invalid -m option value: maxmem "
- "(0x%" PRIx64 ") <= initial memory (0x"
- RAM_ADDR_FMT ")", sz, ram_size);
+ error_report("invalid value of -m option maxmem: "
+ "maximum memory size (0x%" PRIx64 ") must be at least "
+ "the initial memory size (0x" RAM_ADDR_FMT ")",
+ sz, ram_size);
exit(EXIT_FAILURE);
- }
-
- slots = qemu_opt_get_number(opts, "slots", 0);
- if ((sz > ram_size) && !slots) {
- error_report("invalid -m option value: maxmem "
- "(0x%" PRIx64 ") more than initial memory (0x"
- RAM_ADDR_FMT ") but no hotplug slots where "
- "specified", sz, ram_size);
+ } else if (sz > ram_size) {
+ if (!slots) {
+ error_report("invalid value of -m option: maxmem was "
+ "specified, but no hotplug slots were specified");
+ exit(EXIT_FAILURE);
+ }
+ } else if (slots) {
+ error_report("invalid value of -m option maxmem: "
+ "memory slots were specified but maximum memory size "
+ "(0x%" PRIx64 ") is equal to the initial memory size "
+ "(0x" RAM_ADDR_FMT ")", sz, ram_size);
exit(EXIT_FAILURE);
}
- if ((sz <= ram_size) && slots) {
- error_report("invalid -m option value: %"
- PRIu64 " hotplug slots where specified but "
- "maxmem (0x%" PRIx64 ") <= initial memory (0x"
- RAM_ADDR_FMT ")", slots, sz, ram_size);
- exit(EXIT_FAILURE);
- }
*maxram_size = sz;
*ram_slots = slots;
} else if ((!maxmem_str && slots_str) ||