[Qemu-devel] [PATCHv2 1/2] 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 pkre...@redhat.com --- Notes: Version 2: - fixed spacing in error message - changed control flow to allow maxmem == ram_size in case slots == 0 vl.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/vl.c b/vl.c index 983259b..5a012f4 100644 --- a/vl.c +++ b/vl.c @@ -2694,29 +2694,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 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) || -- 2.2.1
Re: [Qemu-devel] [PATCHv2 1/2] vl.c: Fix error messages when parsing maxmem parameters
On Wed, 28 Jan 2015 09:35:03 +0100 Peter Krempa pkre...@redhat.com wrote: 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 pkre...@redhat.com --- Notes: Version 2: - fixed spacing in error message - changed control flow to allow maxmem == ram_size in case slots == 0 vl.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/vl.c b/vl.c index 983259b..5a012f4 100644 --- a/vl.c +++ b/vl.c @@ -2694,29 +2694,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 at least typo?? 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) ||
Re: [Qemu-devel] [PATCHv2 1/2] vl.c: Fix error messages when parsing maxmem parameters
On Wed, 28 Jan 2015 17:21:28 +0100 Peter Krempa pkre...@redhat.com wrote: On Wed, Jan 28, 2015 at 13:29:41 +0100, Igor Mammedov wrote: On Wed, 28 Jan 2015 09:35:03 +0100 Peter Krempa pkre...@redhat.com wrote: 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 pkre...@redhat.com --- Notes: Version 2: - fixed spacing in error message - changed control flow to allow maxmem == ram_size in case slots == 0 vl.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/vl.c b/vl.c index 983259b..5a012f4 100644 --- a/vl.c +++ b/vl.c @@ -2694,29 +2694,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 at least typo?? must be at least Hmm, right. Should I respin the series to fix it? Send an extra incremental patch with subject: fixup! vl.c: Fix error messages when parsing maxmem parameters Peter
Re: [Qemu-devel] [PATCHv2 1/2] vl.c: Fix error messages when parsing maxmem parameters
On Wed, Jan 28, 2015 at 13:29:41 +0100, Igor Mammedov wrote: On Wed, 28 Jan 2015 09:35:03 +0100 Peter Krempa pkre...@redhat.com wrote: 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 pkre...@redhat.com --- Notes: Version 2: - fixed spacing in error message - changed control flow to allow maxmem == ram_size in case slots == 0 vl.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/vl.c b/vl.c index 983259b..5a012f4 100644 --- a/vl.c +++ b/vl.c @@ -2694,29 +2694,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 at least typo?? must be at least Hmm, right. Should I respin the series to fix it? Peter signature.asc Description: Digital signature
Re: [Qemu-devel] [PATCHv2 1/2] vl.c: Fix error messages when parsing maxmem parameters
Igor Mammedov imamm...@redhat.com writes: On Wed, 28 Jan 2015 17:21:28 +0100 Peter Krempa pkre...@redhat.com wrote: On Wed, Jan 28, 2015 at 13:29:41 +0100, Igor Mammedov wrote: On Wed, 28 Jan 2015 09:35:03 +0100 Peter Krempa pkre...@redhat.com wrote: 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 pkre...@redhat.com --- Notes: Version 2: - fixed spacing in error message - changed control flow to allow maxmem == ram_size in case slots == 0 vl.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/vl.c b/vl.c index 983259b..5a012f4 100644 --- a/vl.c +++ b/vl.c @@ -2694,29 +2694,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 at least typo?? must be at least Hmm, right. Should I respin the series to fix it? Send an extra incremental patch with subject: fixup! vl.c: Fix error messages when parsing maxmem parameters I'd simply respin, especially a small series like this one.