From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBTzz-00012m-2k for qemu-devel@nongnu.org; Fri, 10 Jun 2016 17:29:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBTzx-0002XN-34 for qemu-devel@nongnu.org; Fri, 10 Jun 2016 17:29:50 -0400 References: <1465574722-27656-1-git-send-email-kwolf@redhat.com> <1465574722-27656-4-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <575B3143.7090303@redhat.com> Date: Fri, 10 Jun 2016 15:29:39 -0600 MIME-Version: 1.0 In-Reply-To: <1465574722-27656-4-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a5GbowpfiUwMnG9KXaUcIC3RbLKbXLHbd" Subject: Re: [Qemu-devel] [PATCH 3/6] block: Allow .bdrv_load/save_vmstate() to return 0/-errno List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, qemu-devel@nongnu.org, famz@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --a5GbowpfiUwMnG9KXaUcIC3RbLKbXLHbd Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/10/2016 10:05 AM, Kevin Wolf wrote: > The return value of .bdrv_load/save_vmstate() can be any non-negative > number in case of success now. It used to be bytes/-errno. >=20 > Signed-off-by: Kevin Wolf > --- > block/io.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) >=20 > diff --git a/block/io.c b/block/io.c > index 602c7d3..bca244c 100644 > --- a/block/io.c > +++ b/block/io.c > @@ -1839,9 +1839,16 @@ int bdrv_save_vmstate(BlockDriverState *bs, cons= t uint8_t *buf, > .iov_base =3D (void *) buf, > .iov_len =3D size, > }; > + int ret; > =20 > qemu_iovec_init_external(&qiov, &iov, 1); > - return bdrv_writev_vmstate(bs, &qiov, pos); > + > + ret =3D bdrv_writev_vmstate(bs, &qiov, pos); > + if (ret < 0) { > + return ret; > + } > + > + return size; > } > =20 > int bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int6= 4_t pos) > @@ -1870,7 +1877,12 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint= 8_t *buf, > int ret; Aha, my complaint in v2 about it being dead means you need to reinstate it here. > =20 > qemu_iovec_init_external(&qiov, &iov, 1); > - return bdrv_readv_vmstate(bs, &qiov, pos); > + ret =3D bdrv_readv_vmstate(bs, &qiov, pos); > + if (ret < 0) { > + return ret; > + } > + > + return size; > } > =20 > int bdrv_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64= _t pos) >=20 Matches the semantics we have elsewhere (I'm not sure if 'size' is the best choice if we ever need to support short read/write, but doesn't seem to hurt). Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --a5GbowpfiUwMnG9KXaUcIC3RbLKbXLHbd 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/ iQEcBAEBCAAGBQJXWzFDAAoJEKeha0olJ0NqovAH/iVguBHoLk+U2yB/JbYy+o4s wLqtEaszpLqi5EiaTeoRGlus+mgrwveG647Zyv0F8gYfN/Fq4kmVAP5q03WB59tX MbToJJk8TX9a0So+wVO+fr0X4rn2qQn/Voc+R8cNLZ/oAFeswu4CPdpzI2gL8mqv QSXPLAC0EYVEYlsIdlnnXukplhf4rILsXq8gNQ4ZS6WsFM/eUjcdw9doeGGLYbkj pmAHx6LjUlC7ogu1VdcweWSOm7lDPEinmTAGGRk4uGF8Z+y6JlX/5r0nkYgOBtFS ijTatMsOMNFtELZz8/f9zA+CVqgL/zD0i6qmPAjyH/qmanB0mi3MGDl19BEQVaI= =FmuQ -----END PGP SIGNATURE----- --a5GbowpfiUwMnG9KXaUcIC3RbLKbXLHbd--