From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULiLg-0007K7-AE for qemu-devel@nongnu.org; Fri, 29 Mar 2013 19:04:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULiLe-0003Lx-17 for qemu-devel@nongnu.org; Fri, 29 Mar 2013 19:04:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULiLd-0003KP-O0 for qemu-devel@nongnu.org; Fri, 29 Mar 2013 19:04:37 -0400 Message-ID: <51561E00.9070002@redhat.com> Date: Fri, 29 Mar 2013 17:04:32 -0600 From: Eric Blake MIME-Version: 1.0 References: <1363961953-13561-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1363961953-13561-13-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1363961953-13561-13-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2GXJICBJSWONFXTLNWJVI" Subject: Re: [Qemu-devel] [PATCH V10 12/17] hmp: add function hmp_info_snapshots() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2GXJICBJSWONFXTLNWJVI Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/22/2013 08:19 AM, Wenchao Xia wrote: > This function will simply call qmp interface qmp_query_snapshots() > added in last commit and then dump information in monitor console. > To get snapshot info, Now qemu and qemu-img both call block layer > function bdrv_query_snapshot_info_list() in their calling path, and > then they just translate the qmp object got to strings in stdout or > monitor console. >=20 > Signed-off-by: Wenchao Xia > --- > hmp.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > hmp.h | 1 + > 2 files changed, 43 insertions(+), 0 deletions(-) >=20 > diff --git a/hmp.c b/hmp.c > index b0a861c..c475d65 100644 > --- a/hmp.c > +++ b/hmp.c > @@ -651,6 +651,48 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict= ) > qapi_free_TPMInfoList(info_list); > } > =20 > +/* assume list is valid */ > +static void monitor_dump_snapshotinfolist(Monitor *mon, SnapshotInfoLi= st *list) > +{ > + SnapshotInfoList *elem; > + char buf[256]; > + > + monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), N= ULL)); Are you sure that won't ever be truncated? I'm pretty sure that I could come up with a scenario where I cause bdrv_snapshot_dump() to want to output more than 256 bytes of details. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2GXJICBJSWONFXTLNWJVI 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.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRVh4AAAoJEKeha0olJ0Nqn0YIAKCrTtzhxGxmKRZbks4PnLhC EUzHkRmkJ7rDDhJAPfHHq+TkJI4gF+1v+jDzyERVkoHQA0edTTaGXC8TAyBC5iru PnepsvT3QeJk8NA0Hq1+dGLjEwUyMzs8099Bv0uYnVQKrhqsZkumdFW2ZUirHagw Ho2SB8DSremM1/dRoJR8qFH65wQFNpYamxN9uEBikrjdkCSTo5ZhvdFg6stdU/UT ldiu80ftRooENBwUGKNmlktPHpinT7nRmrOR44mB+m66j3vv3nhxTodKYOyQNFjF 82wMoS0eW2Zx4a+mh2HZzqe1a/XcSTFFxunstc3DaqXGKcR+WP4ATLY4LCw5Owo= =wZLX -----END PGP SIGNATURE----- ------enig2GXJICBJSWONFXTLNWJVI--