qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.a@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	mst@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	aliguori@amazon.com, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH] machine: replace underscores in machine's property names
Date: Fri, 18 Jul 2014 19:35:58 +0300	[thread overview]
Message-ID: <1405701358.2696.96.camel@localhost.localdomain> (raw)
In-Reply-To: <53C94C32.7050507@suse.de>

On Fri, 2014-07-18 at 18:32 +0200, Andreas Färber wrote:
> Am 18.07.2014 18:23, schrieb Marcel Apfelbaum:
> > On Fri, 2014-07-18 at 18:10 +0200, Andreas Färber wrote:
> >> Hi,
> >>
> >> Am 18.07.2014 17:59, schrieb Marcel Apfelbaum:
> >>> On Fri, 2014-07-18 at 16:25 +0200, Andreas Färber wrote:
> >>>> Am 29.06.2014 11:09, schrieb Marcel Apfelbaum:
> >>>>> Replaced '_' with '-' to comply with QOM guidelines.
> >>>>> Made the conversion from HMP to QMP in vl.c
> >>>>>
> >>>>> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> >>>>> ---
> >>>>>  hw/core/machine.c |  8 ++++----
> >>>>>  vl.c              | 12 +++++++++++-
> >>>>>  2 files changed, 15 insertions(+), 5 deletions(-)
> >>>> [snip]
> >>>>> diff --git a/vl.c b/vl.c
> >>>>> index a1686ef..7587c97 100644
> >>>>> --- a/vl.c
> >>>>> +++ b/vl.c
> >>>>> @@ -2820,15 +2820,25 @@ static int object_set_property(const char *name, const char *value, void *opaque
> >>>>>      Object *obj = OBJECT(opaque);
> >>>>>      StringInputVisitor *siv;
> >>>>>      Error *local_err = NULL;
> >>>>> +    char *c, *qom_name;
> >>>>>  
> >>>>>      if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 ||
> >>>>>          strcmp(name, "type") == 0) {
> >>>>>          return 0;
> >>>>>      }
> >>>>>  
> >>>>> +    qom_name = g_strdup(name);
> >>>>> +    c = qom_name;
> >>>>> +    while (*c++) {
> >>>>> +        if (*c == '_') {
> >>>>> +            *c = '-';
> >>>>> +        }
> >>>>> +    }
> >>>>
> >>>> Actually, is this really safe? By my reading, this function handles
> >>>> -object as well, which in turn allows - in theory - to instantiate any
> >>>> device, where some will still have underscores in their property names.
> >>>> Not sure if all non-device objects such as virtio-rng backends have been
> >>>> checked?
> >>> Hi Andreas,
> >>>
> >>> I checked and object_set_property is used only be machine right now, so
> >>> no problem here.
> >>
> >> Indeed you are right. If -object is no longer using it, can we drop
> >> qom-type handling? What changed there?
> > Hi Andreas,
> > 
> > The check was originally placed there by Paolo for -object handling.
> > We need to find out where the "qom-type" property is coming from. (What code is adding it)
> > If is added automatically at parse/init time we can't get rid of it.
> > If is object specific, it is ok.
> 
> It was not a QOM property, it was a QemuOpt parameter for -object and
> therefore excluded from the handling like your type property is. Paolo
> had dicussed to rename qom-type to type for simplicity and consistency,
> but what I don't know is why this function is no longer used.
Paolo, can you help?
I posted a V2, but I can resend in case it is needed, of course.

Thanks,
Marcel
> 
> Andreas
> 
> > Paolo, can you please advise?
> > 
> > Thanks,
> > Marcel
> 

  reply	other threads:[~2014-07-18 16:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-29  9:09 [Qemu-devel] [PATCH] machine: replace underscores in machine's property names Marcel Apfelbaum
2014-06-29 11:37 ` Michael S. Tsirkin
2014-07-17 14:15   ` Marcel Apfelbaum
2014-07-17 14:20     ` Paolo Bonzini
2014-07-17 15:48       ` Andreas Färber
2014-07-17 16:47         ` Michael Roth
2014-07-17 17:00           ` Paolo Bonzini
2014-07-18 14:15             ` Andreas Färber
2014-07-18 14:19               ` Paolo Bonzini
2014-07-18 16:06               ` Marcel Apfelbaum
2014-07-17 16:55 ` Peter Maydell
2014-07-17 16:59   ` Marcel Apfelbaum
2014-07-18 14:25 ` Andreas Färber
2014-07-18 14:38   ` Paolo Bonzini
2014-07-18 15:59   ` Marcel Apfelbaum
2014-07-18 16:10     ` Andreas Färber
2014-07-18 16:23       ` Marcel Apfelbaum
2014-07-18 16:32         ` Andreas Färber
2014-07-18 16:35           ` Marcel Apfelbaum [this message]
2014-07-18 20:11           ` Paolo Bonzini

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=1405701358.2696.96.camel@localhost.localdomain \
    --to=marcel.a@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).