From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr0nt-0006Qf-TV for qemu-devel@nongnu.org; Sun, 01 Jun 2014 04:07:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wr0nn-0007Sn-BP for qemu-devel@nongnu.org; Sun, 01 Jun 2014 04:07:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr0nn-0007SO-2b for qemu-devel@nongnu.org; Sun, 01 Jun 2014 04:07:35 -0400 Message-ID: <1401610057.2875.85.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Sun, 01 Jun 2014 11:07:37 +0300 In-Reply-To: <20140530194530.GD15000@otherpad.lan.raisama.net> References: <1401108058-27348-1-git-send-email-marcel.a@redhat.com> <1401108058-27348-5-git-send-email-marcel.a@redhat.com> <20140530194530.GD15000@otherpad.lan.raisama.net> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2 4/4] hw/machine: qemu machine opts as properties to QemuMachineState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: agraf@suse.de, mst@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, mdroth@linux.vnet.ibm.com, armbru@redhat.com, aliguori@amazon.com, lcapitulino@redhat.com, afaerber@suse.de On Fri, 2014-05-30 at 16:45 -0300, Eduardo Habkost wrote: > 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 > > --- > > 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. It seems to be the caller responsibility. > > (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?) We don't have yet, from what I know, and this is for the moment the QMP way to handle string attributes. Thanks, Marcel >