From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X896C-0001ZW-NL for qemu-devel@nongnu.org; Fri, 18 Jul 2014 10:25:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8962-0003EO-MW for qemu-devel@nongnu.org; Fri, 18 Jul 2014 10:25:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58910 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8962-0003EC-Fu for qemu-devel@nongnu.org; Fri, 18 Jul 2014 10:25:14 -0400 Message-ID: <53C92E49.7090001@suse.de> Date: Fri, 18 Jul 2014 16:25:13 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1404032955-2591-1-git-send-email-marcel.a@redhat.com> In-Reply-To: <1404032955-2591-1-git-send-email-marcel.a@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 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 , qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Cc: mdroth@linux.vnet.ibm.com, aliguori@amazon.com, mst@redhat.com 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 >=20 > 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 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? Since it's really late, I would be more comfortable to copy this function with a large TODO and only apply this fixup for -machine, where we are more easily able to review and test. Opinions? Regards, Andreas > + > siv =3D string_input_visitor_new(value); > - object_property_set(obj, string_input_get_visitor(siv), name, &loc= al_err); > + object_property_set(obj, string_input_get_visitor(siv), qom_name, = &local_err); > string_input_visitor_cleanup(siv); > + free(qom_name); > =20 > if (local_err) { > qerror_report_err(local_err); >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg