qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V2 4/4] hw/machine: qemu machine opts as propert


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH V2 4/4] hw/machine: qemu machine opts as properties to QemuMachineState
Date: Fri, 30 May 2014 16:45:30 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, May 26, 2014 at 03:40:58PM +0300, Marcel Apfelbaum wrote:
> Make machine's QemuOpts QOM properties of machine. The properties
> are automatically filled in. This opens the possiblity to create
> opts per machine rather than global.
> 
> Signed-off-by: Marcel Apfelbaum <address@hidden>
> ---
>  hw/core/machine.c   | 256 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/hw/boards.h |   6 +-
>  vl.c                |  10 +-
>  3 files changed, 266 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index d3ffef7..dbcf2a1 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -11,6 +11,260 @@
>   */
>  
>  #include "hw/boards.h"
> +#include "qapi/visitor.h"
> +
> +static char *machine_get_accel(Object *obj, Error **errp)
> +{
> +    MachineState *ms = MACHINE(obj);
> +    return g_strdup(ms->accel);
> +}
> +
> +static void machine_set_accel(Object *obj, const char *value, Error **errp)
> +{
> +    MachineState *ms = MACHINE(obj);
> +    ms->accel = g_strdup(value);
> +}

You are not freeing the old value here and on the other string setters.

(Do we have some existing common wrapper to automatically free the old
value and set the new one, or every setter should duplicate the same
free/strdup logic?)

-- 
Eduardo



reply via email to

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