From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnptB-0007zP-TL for qemu-devel@nongnu.org; Tue, 03 Dec 2013 08:19:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vnpt5-00036f-Mi for qemu-devel@nongnu.org; Tue, 03 Dec 2013 08:19:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:32986 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vnpt5-00036U-DT for qemu-devel@nongnu.org; Tue, 03 Dec 2013 08:19:39 -0500 Message-ID: <529DDA66.2030504@suse.de> Date: Tue, 03 Dec 2013 14:19:34 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <10d4ecd00bfd9f76e2668fda2e9b2214865e1ceb.1386053678.git.peter.crosthwaite@xilinx.com> In-Reply-To: <10d4ecd00bfd9f76e2668fda2e9b2214865e1ceb.1386053678.git.peter.crosthwaite@xilinx.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: mark.langsdorf@calxeda.com, "Michael S. Tsirkin" Am 03.12.2013 07:59, schrieb Peter Crosthwaite: > Currently the uintXX property adders make a read only property. This > is not useful for devices that want to create board (or container) > configurable dynamic device properties. Fix by trivially adding propert= y > setters to object_property_add_uintXX. >=20 > Signed-off-by: Peter Crosthwaite > --- > changed since v2: > msg typo: "trivially" Not sure if I've asked already, but these functions were added by mst (so let's CC him) for accessing read-only constants in ACPI code. Your change seems to make them writable - can anything go wrong when the setters are used via QMP? I fear we may need two separate sets of functions, one read-only, one read-write. Andreas >=20 > qom/object.c | 44 ++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 40 insertions(+), 4 deletions(-) >=20 > diff --git a/qom/object.c b/qom/object.c > index fc19cf6..07b454b 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -1353,6 +1353,15 @@ static void property_get_uint8_ptr(Object *obj, = Visitor *v, > visit_type_uint8(v, &value, name, errp); > } > =20 > +static void property_set_uint8_ptr(Object *obj, Visitor *v, > + void *opaque, const char *name, > + Error **errp) > +{ > + uint8_t value; > + visit_type_uint8(v, &value, name, errp); > + *(uint8_t *)opaque =3D value; > +} > + > static void property_get_uint16_ptr(Object *obj, Visitor *v, > void *opaque, const char *name, > Error **errp) > @@ -1361,6 +1370,15 @@ static void property_get_uint16_ptr(Object *obj,= Visitor *v, > visit_type_uint16(v, &value, name, errp); > } > =20 > +static void property_set_uint16_ptr(Object *obj, Visitor *v, > + void *opaque, const char *name, > + Error **errp) > +{ > + uint16_t value; > + visit_type_uint16(v, &value, name, errp); > + *(uint16_t *)opaque =3D value; > +} > + > static void property_get_uint32_ptr(Object *obj, Visitor *v, > void *opaque, const char *name, > Error **errp) > @@ -1369,6 +1387,15 @@ static void property_get_uint32_ptr(Object *obj,= Visitor *v, > visit_type_uint32(v, &value, name, errp); > } > =20 > +static void property_set_uint32_ptr(Object *obj, Visitor *v, > + void *opaque, const char *name, > + Error **errp) > +{ > + uint32_t value; > + visit_type_uint32(v, &value, name, errp); > + *(uint32_t *)opaque =3D value; > +} > + > static void property_get_uint64_ptr(Object *obj, Visitor *v, > void *opaque, const char *name, > Error **errp) > @@ -1377,32 +1404,41 @@ static void property_get_uint64_ptr(Object *obj= , Visitor *v, > visit_type_uint64(v, &value, name, errp); > } > =20 > +static void property_set_uint64_ptr(Object *obj, Visitor *v, > + void *opaque, const char *name, > + Error **errp) > +{ > + uint64_t value; > + visit_type_uint64(v, &value, name, errp); > + *(uint64_t *)opaque =3D value; > +} > + > void object_property_add_uint8_ptr(Object *obj, const char *name, > const uint8_t *v, Error **errp) > { > object_property_add(obj, name, "uint8", property_get_uint8_ptr, > - NULL, NULL, (void *)v, errp); > + property_set_uint8_ptr, NULL, (void *)v, errp)= ; > } > =20 > void object_property_add_uint16_ptr(Object *obj, const char *name, > const uint16_t *v, Error **errp) > { > object_property_add(obj, name, "uint16", property_get_uint16_ptr, > - NULL, NULL, (void *)v, errp); > + property_set_uint16_ptr, NULL, (void *)v, errp= ); > } > =20 > void object_property_add_uint32_ptr(Object *obj, const char *name, > const uint32_t *v, Error **errp) > { > object_property_add(obj, name, "uint32", property_get_uint32_ptr, > - NULL, NULL, (void *)v, errp); > + property_set_uint32_ptr, NULL, (void *)v, errp= ); > } > =20 > void object_property_add_uint64_ptr(Object *obj, const char *name, > const uint64_t *v, Error **errp) > { > object_property_add(obj, name, "uint64", property_get_uint64_ptr, > - NULL, NULL, (void *)v, errp); > + property_set_uint64_ptr, NULL, (void *)v, errp= ); > } > =20 > static void object_instance_init(Object *obj) >=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