From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwXOH-0002hk-Py for qemu-devel@nongnu.org; Wed, 11 Nov 2015 10:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwXOG-0005tR-MX for qemu-devel@nongnu.org; Wed, 11 Nov 2015 10:32:53 -0500 References: <1447247832-14198-1-git-send-email-berto@igalia.com> From: Eric Blake Message-ID: <56435F9A.6010302@redhat.com> Date: Wed, 11 Nov 2015 08:32:42 -0700 MIME-Version: 1.0 In-Reply-To: <1447247832-14198-1-git-send-email-berto@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="L2vtqkj7n3dFQBOA69J1UWffi7OXWFdxK" Subject: Re: [Qemu-devel] [PATCH for-2.5] block: make 'stats-intervals' a list of integers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Kevin Wolf , Max Reitz , Stefan Hajnoczi , qemu-block@nongnu.org, Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --L2vtqkj7n3dFQBOA69J1UWffi7OXWFdxK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/11/2015 06:17 AM, Alberto Garcia wrote: > This is the natural JSON representation and prevents us from having to > decode the list manually. >=20 > Signed-off-by: Alberto Garcia > --- > blockdev.c | 64 ++++++++++++++++++++++++++++++++++--------= -------- > qapi/block-core.json | 7 +++--- > tests/qemu-iotests/136 | 2 +- > 3 files changed, 48 insertions(+), 25 deletions(-) >=20 > + for (entry =3D qlist_first(interval_list); entry; > + entry =3D qlist_next(entry)) { > + unsigned length; > + switch (qobject_type(entry->value)) { > =20 > - if (*stats_intervals =3D=3D '\0') { > - error_setg(&error, "stats-intervals can't have an empt= y value"); > - } > - > - for (i =3D 0; !error && intervals[i] !=3D NULL; i++) { > + case QTYPE_QSTRING: { > + case QTYPE_QINT: { Why are we accepting both string and int here, but typing it as 'int' in qapi? I guess its due to how command line parsing passes in strings rather than ints? But that should be okay. Reviewed-by: Eric Blake We may eventually want to add an alternate type that takes both int and string from QMP (parsing the port number of server addresses is another spot that could benefit from such an alternate), but that's a project for 2.6. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --L2vtqkj7n3dFQBOA69J1UWffi7OXWFdxK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWQ1+aAAoJEKeha0olJ0NqpgwH/2do5iTQc1HPN60jROYLmXfv k64irokJyVS+0evdrCZtCs1EfsA3FjDZTCajVr+Pe/ggML6mAZi1JzQfiWl6XuDo wLE9EyEQJdDr4eMfWY5S9C7aGJgOSx5e8PILiHWFAK1PCI4VAOmVVFzxHSqkmkpO bfvfsKsOW/kJu3OEZjGRZXCKOlKM/sP4dIbYKuiHJ75r6fXcg00m03LBzDWWaKNr iFMnMLeWyaY1Kc5OICFBnF6tkw7vGvKoL+YgHz2XI8UB5IdAfER9k4bsGcZ5J2s+ RH5Zjpg+tUk6J5OQGudXEVAEf5qrtCj8HjCuVXeuEXOMYgd4d1LtqfFB6PZbq/0= =xW6K -----END PGP SIGNATURE----- --L2vtqkj7n3dFQBOA69J1UWffi7OXWFdxK--