From: Max Reitz <mreitz@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Subject: Re: [PATCH v2 1/4] luks: extract block_crypto_calculate_payload_offset()
Date: Tue, 14 Jan 2020 16:25:44 +0100 [thread overview]
Message-ID: <7ea9cf7e-2622-c17a-6936-3109e4cd228a@redhat.com> (raw)
In-Reply-To: <20200109111012.559052-2-stefanha@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1860 bytes --]
On 09.01.20 12:10, Stefan Hajnoczi wrote:
> The qcow2 .bdrv_measure() code calculates the crypto payload offset.
> This logic really belongs in block/crypto.c where it can be reused by
> other image formats.
>
> The "luks" block driver will need this same logic in order to implement
> .bdrv_measure(), so extract the block_crypto_calculate_payload_offset()
> function now.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> block/crypto.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
> block/crypto.h | 5 ++++
> block/qcow2.c | 59 ++++------------------------------------------
> 3 files changed, 73 insertions(+), 55 deletions(-)
>
> diff --git a/block/crypto.c b/block/crypto.c
> index 24823835c1..ed32202fa2 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
> @@ -185,6 +185,70 @@ block_crypto_create_opts_init(QDict *opts, Error **errp)
[...]
> +/* Determine the number of bytes for the crypto header */
> +bool block_crypto_calculate_payload_offset(QemuOpts *opts,
> + const char *optprefix,
> + size_t *len,
> + Error **errp)
> +{
> + QDict *cryptoopts_qdict;
> + QCryptoBlockCreateOptions *cryptoopts;
> + QCryptoBlock *crypto;
> +
> + /* Extract options into a qdict */
> + if (optprefix) {
> + QDict *opts_qdict = qemu_opts_to_qdict(opts, NULL);
> +
> + qdict_extract_subqdict(opts_qdict, &cryptoopts_qdict, optprefix);
> + qobject_unref(opts_qdict);
> + } else {
> + cryptoopts_qdict = qemu_opts_to_qdict(opts, NULL);
> + }
> +
> + /* Build QCryptoBlockCreateOptions object from qdict */
> + qdict_put_str(cryptoopts_qdict, "format", "luks");
Should this be a parameter?
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-01-14 15:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-09 11:10 [PATCH v2 0/4] luks: add qemu-img measure support Stefan Hajnoczi
2020-01-09 11:10 ` [PATCH v2 1/4] luks: extract block_crypto_calculate_payload_offset() Stefan Hajnoczi
2020-01-14 15:25 ` Max Reitz [this message]
2020-01-15 13:40 ` Stefan Hajnoczi
2020-01-15 14:35 ` Max Reitz
2020-01-09 11:10 ` [PATCH v2 2/4] luks: implement .bdrv_measure() Stefan Hajnoczi
2020-01-14 15:43 ` Max Reitz
2020-01-15 13:41 ` Stefan Hajnoczi
2020-01-09 11:10 ` [PATCH v2 3/4] qemu-img: allow qemu-img measure --object without a filename Stefan Hajnoczi
2020-01-14 15:44 ` Max Reitz
2020-01-09 11:10 ` [PATCH v2 4/4] iotests: add 282 luks qemu-img measure test Stefan Hajnoczi
2020-01-14 15:48 ` Max Reitz
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=7ea9cf7e-2622-c17a-6936-3109e4cd228a@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).