From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwarV-0004d1-LD for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:38:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwarR-0003Hm-Dv for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:38:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwarR-0003Hh-5L for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:38:25 -0400 Message-ID: <539F2B8A.5010009@redhat.com> Date: Mon, 16 Jun 2014 11:38:18 -0600 From: Eric Blake MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c9Gqp6fTN0ImSn72DX0DNIgC5Eu4xWUD5" Subject: Re: [Qemu-devel] [PATCH v2 1/4] qmp: add query-memdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , qemu-devel@nongnu.org Cc: Yasunori Goto , Igor Mammedov , "Michael S. Tsirkin" , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --c9Gqp6fTN0ImSn72DX0DNIgC5Eu4xWUD5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/16/2014 04:05 AM, Hu Tao wrote: > Add qmp command query-memdev to query for information > of memory devices >=20 > Signed-off-by: Hu Tao > --- > numa.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > qapi-schema.json | 40 +++++++++++++++++++++++++++ > qmp-commands.hx | 38 +++++++++++++++++++++++++ > 3 files changed, 162 insertions(+) >=20 > diff --git a/numa.c b/numa.c > index 8ba5a38..bcbafd2 100644 > --- a/numa.c > +++ b/numa.c > @@ -34,6 +34,7 @@ > #include "qapi/qmp/qerror.h" > #include "hw/boards.h" > #include "sysemu/hostmem.h" > +#include "qmp-commands.h" > =20 > QemuOptsList qemu_numa_opts =3D { > .name =3D "numa", > @@ -280,3 +281,86 @@ void memory_region_allocate_system_memory(MemoryRe= gion *mr, Object *owner, > addr +=3D size; > } > } > + > +static int query_memdev(Object *obj, void *opaque) > +{ > + MemdevList **list =3D opaque; > + Error *err =3D NULL; This variable is usually named local_err. > + > + if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) { > + MemdevList *m =3D g_malloc0(sizeof(*m)); > + > + m->value =3D g_malloc0(sizeof(*m->value)); > + > + m->value->size =3D object_property_get_int(obj, "size", > + &err); > + if (err) { > + goto error; > + } Is this error ever likely, or would it represent a programming error, in which case passing &error_abort would avoid the need to check for failure afterwords. Similarly for all the other properties. > +query-memdev > +------------ > + > +Show memory devices information. Makes sense, but took me a couple reads. Might be better as: Show information on memory devices. > + > + > +Example (1): What is the "(1)" for? I'd just drop it (probably copy-and-paste from another command that actually had more than one example) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --c9Gqp6fTN0ImSn72DX0DNIgC5Eu4xWUD5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTnyuKAAoJEKeha0olJ0Nq6UgH/iI3uUME32Sn+Zy35FiheOxU zN46N0A4Th0dSTExbjD97FNuZ2H8h6MGTDLUTVCZfNzlMmI/vbDcCVIYBwBjANoB /8R481Mpyjciv7zPab/I/Muqgj23D5xpJ5YSfj2PTDjTjzr46MbaZwKp/20b/VyI PuSS89lnphFCDWUcJqfXpWRbYp4P8al00O5uM7zRQyo6rGBKOsDyjjOZAonaTdw4 U+ME2kdiex116xXL/IG5IUV9gsQ0dwhVx3Hn2+HTHzCJqayIJ/KZND6sgOu+bGfp R9vbTMRTpfxxf6g1EKPtJjB0qzby/xqsqCpsjwkek8TEmmGiTgF7W04I6l4RiG4= =ldpV -----END PGP SIGNATURE----- --c9Gqp6fTN0ImSn72DX0DNIgC5Eu4xWUD5--