From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZemKh-0007Y7-RX for qemu-devel@nongnu.org; Wed, 23 Sep 2015 11:51:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZemKg-0005Fc-T2 for qemu-devel@nongnu.org; Wed, 23 Sep 2015 11:51:47 -0400 Date: Wed, 23 Sep 2015 17:51:37 +0200 From: Kevin Wolf Message-ID: <20150923155137.GE4557@noname.redhat.com> References: <1442497700-2536-1-git-send-email-kwolf@redhat.com> <1442497700-2536-12-git-send-email-kwolf@redhat.com> <5602C93C.4060305@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DSayHWYpDlRfCAAQ" Content-Disposition: inline In-Reply-To: <5602C93C.4060305@redhat.com> Subject: Re: [Qemu-devel] [PATCH 11/16] block-backend: Add blk_set_bs() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: berto@igalia.com, qemu-block@nongnu.org, jcody@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com --DSayHWYpDlRfCAAQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 23.09.2015 um 17:46 hat Max Reitz geschrieben: > On 17.09.2015 15:48, Kevin Wolf wrote: > > It allows changing the BlockDriverState that a BlockBackend points to. > >=20 > > Signed-off-by: Kevin Wolf > > --- > > block/block-backend.c | 16 ++++++++++++++++ > > include/block/block_int.h | 2 ++ > > 2 files changed, 18 insertions(+) > >=20 > > diff --git a/block/block-backend.c b/block/block-backend.c > > index c2e8732..a2afcff 100644 > > --- a/block/block-backend.c > > +++ b/block/block-backend.c > > @@ -239,6 +239,22 @@ BlockDriverState *blk_bs(BlockBackend *blk) > > } > > =20 > > /* > > + * Changes the BlockDriverState attached to @blk > > + */ > > +void blk_set_bs(BlockBackend *blk, BlockDriverState *bs) > > +{ > > + bdrv_ref(bs); > > + > > + if (blk->bs) { > > + blk->bs->blk =3D NULL; > > + bdrv_unref(blk->bs); > > + } > > + > > + blk->bs =3D bs; > > + bs->blk =3D blk; > > +} > > + > > +/* >=20 > As discussed in the BlockBackend and media thread, you should probably > assert(bs->blk =3D=3D NULL), Yes, my current branch has this already. > and I'd rather have this implemented as > blk_remove_bs(blk); blk_insert_bs(blk, bs);, but that's probably > something that won't happen until I do so myself. Let's see which series hits master first. If yours is first, I'll happily change this patch to make use of the new functions; otherwise, you get to rebase. Kevin --DSayHWYpDlRfCAAQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJWAsqJAAoJEH8JsnLIjy/W4lkP/2MYv70IIhAcyzODCcAQvsYg 2vyT2/TFTPbtb6hsADyLgfcYLI1uOK8MiOjU39MmtlL4ZyRRAFuudRuCNKpyQFlK 8En2Tw6BTZmf626cwEoqCDVJAtayBBZsmOrTs5tIVZ6btn+KVRViyuXZZ1VzVTyl EHmIEkb104kYzzw3zfzw3H0yXMBOX6GAZUY65vXVJwAZobu4qEsmu3uR2eIjZdtz z2+NIuM8PtnPnIDGw05nwVcASFPyWKLiC2/mEz6wbyVdt9gmt6zjH1MlV73HypEb mmB2hi6MPei1cGot7U/C3ZZu2t/Ivxt/SjEEpFYqsCnWuRgWYifMRBlQDa0IMU7A 4gwj5Wab5a/hQJOhM0ccnYRMPJjoqfoqHuBEEiNB5FGKdVZpPefNvqm6WbWG6eLk BBv3FGjWqT0j64pjppjy6IzE8tIELR1e99xMfOkBvpQ8ul7TzmfP71Op9U6gqQb5 A8l70IF3hUCGpNYHUay8S1C0RAvM+Gy/fhtOnzNMlbJDyvuZpKG7A0HTpR8s8Zth OsXN5e3DCqwv1pvQBRdCEA6+muaG98kQEcvmkGBw6RUpEL0gwBgzA+tYmCYj256E XIMsdkgf1R86+F1KaqDsNGpkY5tETgVoX2Ud18cFLvKVjNsMzbuDzhdtBbUzTAsj hXOfPBBPBvxO1Utvo94W =ARax -----END PGP SIGNATURE----- --DSayHWYpDlRfCAAQ--