From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDoG-0003Tk-Vx for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:36:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGDns-0008LU-N9 for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:36:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDns-0008LQ-FJ for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:36:08 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0RLa7md009526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 27 Jan 2015 16:36:07 -0500 Message-ID: <54C804C6.4040409@redhat.com> Date: Tue, 27 Jan 2015 14:36:06 -0700 From: Eric Blake MIME-Version: 1.0 References: <1422387983-32153-1-git-send-email-mreitz@redhat.com> <1422387983-32153-17-git-send-email-mreitz@redhat.com> In-Reply-To: <1422387983-32153-17-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2pXI8FoO2hk9GNmsS5G57B0Ux75i2kQci" Subject: Re: [Qemu-devel] [PATCH RESEND 16/50] block: Prepare remaining BB functions for NULL BDS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Jeff Cody , Markus Armbruster , Stefan Hajnoczi , John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2pXI8FoO2hk9GNmsS5G57B0Ux75i2kQci Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/27/2015 12:45 PM, Max Reitz wrote: > There are several BlockBackend functions which, in theory, cannot fail.= > This patch makes them cope with the BlockDriverState pointer being NULL= > by making them fall back to some default action like ignoring the value= > in setters and returning the default in getters. >=20 > Signed-off-by: Max Reitz > --- > block/block-backend.c | 70 ++++++++++++++++++++++++++++++++++++++++---= -------- > 1 file changed, 55 insertions(+), 15 deletions(-) >=20 > @@ -926,22 +944,32 @@ void *blk_blockalign(BlockBackend *blk, size_t si= ze) > =20 > bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp= ) > { > + if (!blk->bs) { > + return false; > + } > + > return bdrv_op_is_blocked(blk->bs, op, errp); > } I don't know if this is correct - maybe a no-medium drive should block actions like commit by default? If my design question gets answered satisfactorily that you went with the right default, then Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2pXI8FoO2hk9GNmsS5G57B0Ux75i2kQci 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/ iQEcBAEBCAAGBQJUyATGAAoJEKeha0olJ0NqWzsH/2cIL9n/U1+qgsqvsqZG499r cO0qlPqiOmatOrRVsVWerkoQaGpGT21D1Ijx6oTY2ZQu+JX9j4lEUAM8jumP1/7H cxMxDolNWiAW//ccxTRYIlflV5DA3bhvU7fUJ7OpYY3zbD6InUHRm12QGffqUSmr frtUcoqXWDEmbURLNFCl4fEBNjr2PvBr2J6bo2o8TKS+5Q4pUXalKMpR3USoGq9C SYRcwJikuiSgW5FLUTvDh5EZ4CBNar0UpTm3ZuSD6yxN4STs3adVS2YGZ1VS+MpJ 6vrth6EI+UUUTuIKiiM70icx0YwZQziQrpBI0KWoKB+b1bYiftZf+qqT7TCMVM0= =NPVi -----END PGP SIGNATURE----- --2pXI8FoO2hk9GNmsS5G57B0Ux75i2kQci--