From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evMLp-0004zI-G7 for qemu-devel@nongnu.org; Mon, 12 Mar 2018 08:14:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evMLo-0005nc-HX for qemu-devel@nongnu.org; Mon, 12 Mar 2018 08:14:49 -0400 Date: Mon, 12 Mar 2018 13:14:41 +0100 From: Kevin Wolf Message-ID: <20180312121441.GD31537@localhost.localdomain> References: <20180309172713.26318-1-kwolf@redhat.com> <20180309172713.26318-4-kwolf@redhat.com> <20180312114009.GI3493@redhat.com> <20180312114721.GB31537@localhost.localdomain> <20180312115058.GO3493@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20180312115058.GO3493@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/6] luks: Support .bdrv_co_create List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= Cc: qemu-block@nongnu.org, mreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Am 12.03.2018 um 12:50 hat Daniel P. Berrang=E9 geschrieben: > On Mon, Mar 12, 2018 at 12:47:21PM +0100, Kevin Wolf wrote: > > Am 12.03.2018 um 12:40 hat Daniel P. Berrang=E9 geschrieben: > > > On Fri, Mar 09, 2018 at 06:27:10PM +0100, Kevin Wolf wrote: > > > > This adds the .bdrv_co_create driver callback to luks, which enab= les > > > > image creation over QMP. > > > >=20 > > > > Signed-off-by: Kevin Wolf > > > > --- > > > > qapi/block-core.json | 17 ++++++++++++++++- > > > > block/crypto.c | 34 ++++++++++++++++++++++++++++++++++ > > > > 2 files changed, 50 insertions(+), 1 deletion(-) > > > >=20 > > > > diff --git a/qapi/block-core.json b/qapi/block-core.json > > > > index 524d51567a..07039bfe9c 100644 > > > > --- a/qapi/block-core.json > > > > +++ b/qapi/block-core.json > > > > @@ -3452,6 +3452,21 @@ > > > > '*preallocation': 'PreallocMode' } } > > > > =20 > > > > ## > > > > +# @BlockdevCreateOptionsLUKS: > > > > +# > > > > +# Driver specific image creation options for LUKS. > > > > +# > > > > +# @file Node to create the image format on > > > > +# @size Size of the virtual disk in bytes > > > > +# > > > > +# Since: 2.12 > > > > +## > > > > +{ 'struct': 'BlockdevCreateOptionsLUKS', > > > > + 'data': { 'file': 'BlockdevRef', > > > > + 'qcrypto': 'QCryptoBlockCreateOptionsLUKS', > > > > + 'size': 'size' } } > > >=20 > > > s/qcrypto/crypto/ in this field. > > >=20 > > > I do wonder about whether instead of embedding QCryptoBlockCreateOp= tionsLUKS > > > as a field, we could instead use QCryptoBlockCreateOptionsLUKS as t= he > > > base struct and just inherit from it to add file/size. > > >=20 > > > I'm not really fussed, but I wonder if you/Eric have any thoughts o= n the pros > > > or cons of inheritance vs embedding in this case. > >=20 > > I don't think QAPI has a way to embed it in JSON, but still provide a > > QCryptoBlockCreateOptionsLUKS C object. Originally I wanted to use > > inheritance, but instead of having the struct type reused, you get al= l > > field definitions copied. I guess you could then manually cast to the > > base type and it would still work, but it didn't really feel clean. >=20 > IIRC, QAPI generates a method >=20 > $BASETYPE *qapi_$TYPENAME_base(const $TYPENAME *obj) >=20 > which just does the blind cast to the base type. Oh, thanks, I didn't know that one! That makes it an offical API that the QAPI generators must keep working, so it should be fine to use. I'll give it a try then. Kevin