qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] vl: Print maxmem in hex format for error mes


From: Igor Mammedov
Subject: Re: [Qemu-devel] [PATCH v2] vl: Print maxmem in hex format for error message
Date: Tue, 16 Sep 2014 11:12:58 +0200

On Tue, 16 Sep 2014 15:45:32 +0800
zhanghailiang <address@hidden> wrote:

> In error message, maxmem is printed in Dec but ram_size in Hex.
> It is better to print them in same format.
> Also use error_report instead of fprintf.
> 
> Signed-off-by: zhanghailiang <address@hidden>
> ---
>  v2:
> - Remove redundant "qemu:" in error message, for error_report already prepend
>   a variation of "qemu" (comment of Eric Blake)
> ---
>  vl.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index 5db0d08..71a831b 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3358,34 +3358,34 @@ int main(int argc, char **argv, char **envp)
>  
>                      sz = qemu_opt_get_size(opts, "maxmem", 0);
>                      if (sz < ram_size) {
> -                        fprintf(stderr, "qemu: invalid -m option value: 
> maxmem "
> -                                "(%" PRIu64 ") <= initial memory ("
> -                                RAM_ADDR_FMT ")\n", sz, ram_size);
> +                        error_report("invalid -m option value: maxmem "
> +                                "(0x%" PRIx64 ") <= initial memory (0x"
> +                                RAM_ADDR_FMT ")", sz, ram_size);
>                          exit(EXIT_FAILURE);
>                      }
>  
>                      slots = qemu_opt_get_number(opts, "slots", 0);
>                      if ((sz > ram_size) && !slots) {
> -                        fprintf(stderr, "qemu: invalid -m option value: 
> maxmem "
> -                                "(%" PRIu64 ") more than initial memory ("
> +                        error_report("invalid -m option value: maxmem "
> +                                "(0x%" PRIx64 ") more than initial memory 
> (0x"
>                                  RAM_ADDR_FMT ") but no hotplug slots where "
> -                                "specified\n", sz, ram_size);
> +                                "specified", sz, ram_size);
>                          exit(EXIT_FAILURE);
>                      }
>  
>                      if ((sz <= ram_size) && slots) {
> -                        fprintf(stderr, "qemu: invalid -m option value:  %"
> +                        error_report("invalid -m option value:  %"
>                                  PRIu64 " hotplug slots where specified but "
> -                                "maxmem (%" PRIu64 ") <= initial memory ("
> -                                RAM_ADDR_FMT ")\n", slots, sz, ram_size);
> +                                "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) ||
>                             (maxmem_str && !slots_str)) {
> -                    fprintf(stderr, "qemu: invalid -m option value: missing "
> -                            "'%s' option\n", slots_str ? "maxmem" : "slots");
> +                     error_report("invalid -m option value: missing "
indent error

> +                            "'%s' option", slots_str ? "maxmem" : "slots");
>                      exit(EXIT_FAILURE);
>                  }
>                  break;

with above fixed,

Reviewed-By: Igor Mammedov <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]