[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v1 02/15] block: add ability to set a prefix for
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v1 02/15] block: add ability to set a prefix for opt names |
Date: |
Mon, 16 Jan 2017 20:31:55 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
On 03.01.2017 19:27, Daniel P. Berrange wrote:
> When integrating the crypto support with qcow/qcow2, we don't
> want to use the bare LUKS option names "hash-alg", "key-secret",
> etc. We want to namespace them "luks-hash-alg", "luks-key-secret"
> so that they don't clash with any general qcow options at a later
> date.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> block/crypto.c | 110
> +++++++++++++++++++++++++++++++++++++++++++++++++--------
> block/crypto.h | 42 +++++++++++-----------
> 2 files changed, 118 insertions(+), 34 deletions(-)
>
> diff --git a/block/crypto.c b/block/crypto.c
> index d281de6..1037c70 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
[...]
> +static int block_crypto_copy_value(void *opaque, const char *name,
> + const char *value, Error **errp)
> +{
> + struct BlockCryptoCopyData *data = opaque;
> +
> + if (g_str_has_prefix(name, data->prefix)) {
> + Error *local_err = NULL;
> + const char *newname = name + strlen(data->prefix);
strstart() would be shorter:
const char *newname;
if (strstart(name, data->prefix, &newname)) {
/* ... */
}
> +
> + qemu_opt_set(data->opts, newname, value, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return 1;
I'd prefer -1, because 0/1 looks more like false/true to me, which in
turn looks like failure/success.
Both optional suggestions, so either way:
Reviewed-by: Max Reitz <address@hidden>
> + }
> + }
> +
> + return 0;
> +}
[...]
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v1 00/15] Convert QCow[2] to QCryptoBlock & add LUKS support, Daniel P. Berrange, 2017/01/03
- [Qemu-block] [PATCH v1 01/15] block: expose crypto option names / defs to other drivers, Daniel P. Berrange, 2017/01/03
- [Qemu-block] [PATCH v1 02/15] block: add ability to set a prefix for opt names, Daniel P. Berrange, 2017/01/03
- Re: [Qemu-block] [PATCH v1 02/15] block: add ability to set a prefix for opt names,
Max Reitz <=
- [Qemu-block] [PATCH v1 03/15] qcow: document another weakness of qcow AES encryption, Daniel P. Berrange, 2017/01/03
- [Qemu-block] [PATCH v1 04/15] qcow: require image size to be > 1 for new images, Daniel P. Berrange, 2017/01/03
- [Qemu-block] [PATCH v1 05/15] iotests: skip 042 with qcow which dosn't support zero sized images, Daniel P. Berrange, 2017/01/03
- [Qemu-block] [PATCH v1 06/15] iotests: skip 048 with qcow which doesn't support resize, Daniel P. Berrange, 2017/01/03