From: Kevin Wolf <kwolf@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-block@nongnu.org, mreitz@redhat.com, eblake@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/6] luks: Support .bdrv_co_create
Date: Mon, 12 Mar 2018 13:14:41 +0100 [thread overview]
Message-ID: <20180312121441.GD31537@localhost.localdomain> (raw)
In-Reply-To: <20180312115058.GO3493@redhat.com>
Am 12.03.2018 um 12:50 hat Daniel P. Berrangé 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é 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 enables
> > > > image creation over QMP.
> > > >
> > > > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > > > ---
> > > > qapi/block-core.json | 17 ++++++++++++++++-
> > > > block/crypto.c | 34 ++++++++++++++++++++++++++++++++++
> > > > 2 files changed, 50 insertions(+), 1 deletion(-)
> > > >
> > > > 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' } }
> > > >
> > > > ##
> > > > +# @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' } }
> > >
> > > s/qcrypto/crypto/ in this field.
> > >
> > > I do wonder about whether instead of embedding QCryptoBlockCreateOptionsLUKS
> > > as a field, we could instead use QCryptoBlockCreateOptionsLUKS as the
> > > base struct and just inherit from it to add file/size.
> > >
> > > I'm not really fussed, but I wonder if you/Eric have any thoughts on the pros
> > > or cons of inheritance vs embedding in this case.
> >
> > 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 all
> > 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.
>
> IIRC, QAPI generates a method
>
> $BASETYPE *qapi_$TYPENAME_base(const $TYPENAME *obj)
>
> 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
next prev parent reply other threads:[~2018-03-12 12:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 17:27 [Qemu-devel] [PATCH 0/6] luks: Implement .bdrv_co_create Kevin Wolf
2018-03-09 17:27 ` [Qemu-devel] [PATCH 1/6] luks: Separate image file creation from formatting Kevin Wolf
2018-03-09 19:40 ` Eric Blake
2018-03-12 11:35 ` Daniel P. Berrangé
2018-03-12 11:43 ` Kevin Wolf
2018-03-12 11:46 ` Daniel P. Berrangé
2018-03-09 17:27 ` [Qemu-devel] [PATCH 2/6] luks: Create block_crypto_co_create_generic() Kevin Wolf
2018-03-09 20:06 ` Eric Blake
2018-03-12 11:48 ` Daniel P. Berrangé
2018-03-09 17:27 ` [Qemu-devel] [PATCH 3/6] luks: Support .bdrv_co_create Kevin Wolf
2018-03-09 20:15 ` Eric Blake
2018-03-12 11:40 ` Daniel P. Berrangé
2018-03-12 11:47 ` Kevin Wolf
2018-03-12 11:50 ` Daniel P. Berrangé
2018-03-12 12:14 ` Kevin Wolf [this message]
2018-03-12 13:07 ` Eric Blake
2018-03-09 17:27 ` [Qemu-devel] [PATCH 4/6] luks: Turn invalid assertion into check Kevin Wolf
2018-03-09 20:19 ` Eric Blake
2018-03-09 21:55 ` Kevin Wolf
2018-03-12 11:41 ` Daniel P. Berrangé
2018-03-09 17:27 ` [Qemu-devel] [PATCH 5/6] luks: Catch integer overflow for huge sizes Kevin Wolf
2018-03-09 20:21 ` Eric Blake
2018-03-12 11:42 ` Daniel P. Berrangé
2018-03-09 17:27 ` [Qemu-devel] [PATCH 6/6] qemu-iotests: Test luks QMP image creation Kevin Wolf
2018-03-09 20:26 ` Eric Blake
2018-03-12 11:45 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180312121441.GD31537@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.