From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvxP3-0005H4-8s for qemu-devel@nongnu.org; Thu, 17 Jan 2013 16:53:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvxP2-00053C-BO for qemu-devel@nongnu.org; Thu, 17 Jan 2013 16:53:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvxP2-00052v-3M for qemu-devel@nongnu.org; Thu, 17 Jan 2013 16:53:40 -0500 Message-ID: <50F872DF.20607@redhat.com> Date: Thu, 17 Jan 2013 14:53:35 -0700 From: Eric Blake MIME-Version: 1.0 References: <1358408410-22187-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1358408410-22187-5-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1358408410-22187-5-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2IFTQUTEAJDPFGGDMRWXK" Subject: Re: [Qemu-devel] [PATCH V4 04/13] block: add snapshot info query function bdrv_query_snapshot_infolist() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: aliguori@us.ibm.com, phrdina@redhat.com, stefanha@gmail.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, pbonzini@redhat.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2IFTQUTEAJDPFGGDMRWXK Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/17/2013 12:40 AM, Wenchao Xia wrote: > This patch add function bdrv_query_snapshot_infolist(), which will > return snapshot info of an image in qmp object format. The implementati= on > code are mostly copied from qemu-img.c with modification to fit more > for qmp based block layer API. > To help filter out snapshot info not needed, a call back function is > added in bdrv_query_snapshot_infolist(). > bdrv_can_read_snapshot() should be called before call this function, > to avoid got *errp set unexpectly. s/unexpectly/unexpectedly/ >=20 > Signed-off-by: Wenchao Xia > Reviewed-by: Eric Blake > --- > block.c | 46 +++++++++++++++++++++++++++++++++++++++++= +++++ > include/block/block.h | 7 +++++++ > 2 files changed, 53 insertions(+), 0 deletions(-) >=20 > +SnapshotInfoList *bdrv_query_snapshot_infolist(BlockDriverState *bs, > + SnapshotFilterFunc filt= er, > + void *opaque, > + Error **errp) > +{ > + int i, sn_count; > + QEMUSnapshotInfo *sn_tab =3D NULL; > + SnapshotInfoList *info_list, *cur_item =3D NULL, *head =3D NULL; > + > + sn_count =3D bdrv_snapshot_list(bs, &sn_tab); > + if (sn_count < 0) { > + /* Fix me: set errp in bdrv_snapshot_list() instead of here *= / You didn't remove this fixme anywhere in the series; it would be better to respin things to avoid a net gain of fixmes. > + error_setg(errp, "bdrv_snapshot_list: error %d\n", sn_count); > + return NULL; > + } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2IFTQUTEAJDPFGGDMRWXK 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/ iQEcBAEBCAAGBQJQ+HLfAAoJEKeha0olJ0NqSFsH/jmcjQl+pZkTu8rRFTZECFUz 3TtxIb6/gZbZRsb6Z6Q9O2i0Kar9GZeigY4S4GpzEZKoo9RbEIclfIhyLTtycy6F DImcYvOxW773zeX9Z662f7RDVsfROWR3ohaMV7tWd+lnFAAwVk/F+bme4Fjd42wx UXvBkp/7v8cD+xKxnQOcTQpnrZk/ubE4mHIIZYyaaqkQqyPo4x+7gmI6E8l4Tv36 ZKLOh1L27jF+UtNNMEEdV8OxTb+/hfWMfYv614DSc8KIFE9Lkucl04Xfgq1Sy8RN g8toOBmmb9aqTryjQ/bTp+oHgRPVINAeXdQUYjC1xiybbKfWry3hGBH1YdptaK8= =thHH -----END PGP SIGNATURE----- ------enig2IFTQUTEAJDPFGGDMRWXK--