From: Marcel Apfelbaum <marcel.a@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
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
Subject: Re: [Qemu-devel] [PATCH V2 4/4] hw/machine: qemu machine opts as properties to QemuMachineState
Date: Sun, 01 Jun 2014 11:07:37 +0300 [thread overview]
Message-ID: <1401610057.2875.85.camel@localhost.localdomain> (raw)
In-Reply-To: <20140530194530.GD15000@otherpad.lan.raisama.net>
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 <marcel.a@redhat.com>
> > ---
> > 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
>
next parent reply other threads:[~2014-06-01 8:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1401108058-27348-1-git-send-email-marcel.a@redhat.com>
[not found] ` <1401108058-27348-5-git-send-email-marcel.a@redhat.com>
[not found] ` <20140530194530.GD15000@otherpad.lan.raisama.net>
2014-06-01 8:07 ` Marcel Apfelbaum [this message]
[not found] ` <20140530192507.GC15000@otherpad.lan.raisama.net>
2014-06-01 8:21 ` [Qemu-devel] [PATCH V2 4/4] hw/machine: qemu machine opts as properties to QemuMachineState Marcel Apfelbaum
2014-06-02 15:21 ` Eduardo Habkost
2014-06-05 11:49 ` Marcel Apfelbaum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401610057.2875.85.camel@localhost.localdomain \
--to=marcel.a@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).