From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD3m6-0004o6-3H for qemu-devel@nongnu.org; Wed, 15 Jun 2016 01:54:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bD3m4-0005rQ-UD for qemu-devel@nongnu.org; Wed, 15 Jun 2016 01:54:02 -0400 Date: Wed, 15 Jun 2016 15:48:23 +1000 From: David Gibson Message-ID: <20160615054823.GE21472@voom.fritz.box> References: <1465520348-13964-1-git-send-email-bharata@linux.vnet.ibm.com> <1465520348-13964-2-git-send-email-bharata@linux.vnet.ibm.com> <20160610040441.GM9226@voom.fritz.box> <20160610093824.69b444c2@nial.brq.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="a1QUDc0q7S3U7/Jg" Content-Disposition: inline In-Reply-To: <20160610093824.69b444c2@nial.brq.redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 1/9] qom: API to get instance_size of a type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Bharata B Rao , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, thuth@redhat.com, aik@ozlabs.ru, agraf@suse.de, pbonzini@redhat.com, ehabkost@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com, eblake@redhat.com, mjrosato@linux.vnet.ibm.com, borntraeger@de.ibm.com --a1QUDc0q7S3U7/Jg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 10, 2016 at 09:38:24AM +0200, Igor Mammedov wrote: > On Fri, 10 Jun 2016 14:04:41 +1000 > David Gibson wrote: >=20 > > On Fri, Jun 10, 2016 at 06:29:00AM +0530, Bharata B Rao wrote: > > > Add an API object_type_get_size(const char *typename) that returns the > > > instance_size of the give typename. > I'd rename it to > object_type_get_instance_size() > so it'd apparent what size is returned from name. I'll make that change in my tree. >=20 > > >=20 > > > Signed-off-by: Bharata B Rao =20 > >=20 > > Reviewed-by: David Gibson > >=20 > > This looks sensible to me, it would be nice to have an ack or two from > > the qemu community at large. > >=20 > > > --- > > > include/qom/object.h | 8 +++++++- > > > qom/object.c | 8 ++++++++ > > > 2 files changed, 15 insertions(+), 1 deletion(-) > > >=20 > > > diff --git a/include/qom/object.h b/include/qom/object.h > > > index 21bb5ff..460ddfc 100644 > > > --- a/include/qom/object.h > > > +++ b/include/qom/object.h > > > @@ -1608,5 +1608,11 @@ int object_child_foreach_recursive(Object *obj, > > > */ > > > Object *container_get(Object *root, const char *path); > > > =20 > > > - > > > +/** > > > + * object_type_get_size: > > > + * @typename: Name of the Type whose instance_size is required > > > + * > > > + * Returns the instance_size of the given @typename. > > > + */ > > > +size_t object_type_get_size(const char *typename); > > > #endif > > > diff --git a/qom/object.c b/qom/object.c > > > index 3bc8a00..0e75877 100644 > > > --- a/qom/object.c > > > +++ b/qom/object.c > > > @@ -202,6 +202,14 @@ static size_t type_object_get_size(TypeImpl *ti) > > > return 0; > > > } > > > =20 > > > +size_t object_type_get_size(const char *typename) > > > +{ > > > + TypeImpl *type =3D type_get_by_name(typename); > > > + > > > + g_assert(type !=3D NULL); > > > + return type_object_get_size(type); > > > +} > > > + > > > static bool type_is_ancestor(TypeImpl *type, TypeImpl *target_type) > > > { > > > assert(target_type); =20 > >=20 >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --a1QUDc0q7S3U7/Jg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXYOwnAAoJEGw4ysog2bOSQl4QAKV7EOatyc/FAViBrcKUJXkD Tu0U2NXOkRzdLZL/J26T1ap2TxKtyQ7+tZeBrTaygdA9ziqizzskMPTfnbJ2jMBy L75g5boxqwxG9AXnA/CmLtuYXQFSuF6ASJzflGw/b5Xz/x5rBgdFl4eYAAKEvrjC kdPZeWuIP0c9HHZamtLsjLzaqZ8V8YK4st/UQSgrLcXCbqstTmHd7pgDe4GSDzrh LNabUA4JEX3iU3AKJx3FXBqbAynF61R33f4Ox3esjTIw74D4YurRXJ8aBZ1FzuBC 8Xe419vxBaJIiER4XkYBLvYjQG3jSeksJOuUFAZg9FtvEI4AqmwIucRy5l3IBKzo uWGp2R7bprqkoZXc0jhna58HMvaEzHxxEcY6Xv0ZhzLK+Js7CRAxb0ySRY2pHO1P BZ5guV6OGtZv/8daq29Ie3VS+drn+W74uGzde9oRSqgHLKbdK3WJ1dX/uotTS88B 0lgFmLXrkPqcAaMF2nt31v2QgUXUMmqKdpTHSoeZBgDZ07sEHI1nwcVmpiVYTnGi AWIoNG1rqlo7hazxd6lef+EDUtwQLnrb+w2slMftRV9440FteqIx/KI4Sm5W9zzZ ja58M4fpX2h/73wxTuFF1i6OJZ50ttBfHzACtHH65kkcgcE6yiyCW3vXfEluqliB 4aau41q37FAt1rf4ZPar =t6Q3 -----END PGP SIGNATURE----- --a1QUDc0q7S3U7/Jg--