diff mbox

[v2,4/4] vl: Set error location when parsing memory options

Message ID 1455303747-19776-5-git-send-email-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eduardo Habkost Feb. 12, 2016, 7:02 p.m. UTC
Set error location so the error_report() calls will show
appropriate command-line argument or config file info.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Marcel Apfelbaum Feb. 12, 2016, 7:35 p.m. UTC | #1
On 02/12/2016 09:02 PM, Eduardo Habkost wrote:
> Set error location so the error_report() calls will show
> appropriate command-line argument or config file info.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>   vl.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/vl.c b/vl.c
> index 50cd018..8fe79dd 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2907,6 +2907,10 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
>       const char *maxmem_str, *slots_str;
>       const ram_addr_t default_ram_size = mc->default_ram_size;
>       QemuOpts *opts = qemu_find_opts_singleton("memory");
> +    Location loc;
> +
> +    loc_push_none(&loc);
> +    qemu_opts_loc_restore(opts);
>
>       sz = 0;
>       mem_str = qemu_opt_get(opts, "size");
> @@ -2981,6 +2985,8 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
>                   "'%s' option", slots_str ? "maxmem" : "slots");
>           exit(EXIT_FAILURE);
>       }
> +
> +    loc_pop(&loc);
>   }
>
>   int main(int argc, char **argv, char **envp)
>

Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>


Thanks,
Marcel
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 50cd018..8fe79dd 100644
--- a/vl.c
+++ b/vl.c
@@ -2907,6 +2907,10 @@  static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
     const char *maxmem_str, *slots_str;
     const ram_addr_t default_ram_size = mc->default_ram_size;
     QemuOpts *opts = qemu_find_opts_singleton("memory");
+    Location loc;
+
+    loc_push_none(&loc);
+    qemu_opts_loc_restore(opts);
 
     sz = 0;
     mem_str = qemu_opt_get(opts, "size");
@@ -2981,6 +2985,8 @@  static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
                 "'%s' option", slots_str ? "maxmem" : "slots");
         exit(EXIT_FAILURE);
     }
+
+    loc_pop(&loc);
 }
 
 int main(int argc, char **argv, char **envp)