From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8B5j-0007mY-SJ for qemu-devel@nongnu.org; Fri, 18 Jul 2014 12:33:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8B5X-0005cS-HO for qemu-devel@nongnu.org; Fri, 18 Jul 2014 12:33:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33264 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8B5X-0005cM-BD for qemu-devel@nongnu.org; Fri, 18 Jul 2014 12:32:51 -0400 Message-ID: <53C94C32.7050507@suse.de> Date: Fri, 18 Jul 2014 18:32:50 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1404032955-2591-1-git-send-email-marcel.a@redhat.com> <53C92E49.7090001@suse.de> <1405699194.2696.84.camel@localhost.localdomain> <53C946F6.4040908@suse.de> <1405700615.2696.93.camel@localhost.localdomain> In-Reply-To: <1405700615.2696.93.camel@localhost.localdomain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] machine: replace underscores in machine's property names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: Peter Maydell , mst@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, aliguori@amazon.com, Paolo Bonzini Am 18.07.2014 18:23, schrieb Marcel Apfelbaum: > On Fri, 2014-07-18 at 18:10 +0200, Andreas F=C3=A4rber wrote: >> Hi, >> >> Am 18.07.2014 17:59, schrieb Marcel Apfelbaum: >>> On Fri, 2014-07-18 at 16:25 +0200, Andreas F=C3=A4rber 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 >>>>> --- >>>>> 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 =3D OBJECT(opaque); >>>>> StringInputVisitor *siv; >>>>> Error *local_err =3D NULL; >>>>> + char *c, *qom_name; >>>>> =20 >>>>> if (strcmp(name, "qom-type") =3D=3D 0 || strcmp(name, "id") =3D= =3D 0 || >>>>> strcmp(name, "type") =3D=3D 0) { >>>>> return 0; >>>>> } >>>>> =20 >>>>> + qom_name =3D g_strdup(name); >>>>> + c =3D qom_name; >>>>> + while (*c++) { >>>>> + if (*c =3D=3D '_') { >>>>> + *c =3D '-'; >>>>> + } >>>>> + } >>>> >>>> Actually, is this really safe? By my reading, this function handles >>>> -object as well, which in turn allows - in theory - to instantiate a= ny >>>> device, where some will still have underscores in their property nam= es. >>>> 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, >=20 > 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. Andreas > Paolo, can you please advise? >=20 > Thanks, > Marcel --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg