mirror of https://github.com/xemu-project/xemu.git
qapi/crypto: Drop temporary 'prefix'
Recent commit "qapi: Smarter camel_to_upper() to reduce need for 'prefix'" added two temporary 'prefix' to delay changing the generated code. Revert them. This improves QCryptoBlockFormat's generated enumeration constant prefix from Q_CRYPTO_BLOCK_FORMAT to QCRYPTO_BLOCK_FORMAT, and QCryptoBlockLUKSKeyslotState's from Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE to QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240904111836.3273842-6-armbru@redhat.com>
This commit is contained in:
parent
55872c7061
commit
d23d2ef3d0
|
@ -682,7 +682,7 @@ err:
|
||||||
static int block_crypto_probe_luks(const uint8_t *buf,
|
static int block_crypto_probe_luks(const uint8_t *buf,
|
||||||
int buf_size,
|
int buf_size,
|
||||||
const char *filename) {
|
const char *filename) {
|
||||||
return block_crypto_probe_generic(Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
return block_crypto_probe_generic(QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
buf, buf_size, filename);
|
buf, buf_size, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,7 +691,7 @@ static int block_crypto_open_luks(BlockDriverState *bs,
|
||||||
int flags,
|
int flags,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
return block_crypto_open_generic(Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
return block_crypto_open_generic(QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
&block_crypto_runtime_opts_luks,
|
&block_crypto_runtime_opts_luks,
|
||||||
bs, options, flags, errp);
|
bs, options, flags, errp);
|
||||||
}
|
}
|
||||||
|
@ -724,7 +724,7 @@ block_crypto_co_create_luks(BlockdevCreateOptions *create_options, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
create_opts = (QCryptoBlockCreateOptions) {
|
create_opts = (QCryptoBlockCreateOptions) {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
.u.luks = *qapi_BlockdevCreateOptionsLUKS_base(luks_opts),
|
.u.luks = *qapi_BlockdevCreateOptionsLUKS_base(luks_opts),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -889,7 +889,7 @@ block_crypto_get_specific_info_luks(BlockDriverState *bs, Error **errp)
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
assert(info->format == Q_CRYPTO_BLOCK_FORMAT_LUKS);
|
assert(info->format == QCRYPTO_BLOCK_FORMAT_LUKS);
|
||||||
|
|
||||||
spec_info = g_new(ImageInfoSpecific, 1);
|
spec_info = g_new(ImageInfoSpecific, 1);
|
||||||
spec_info->type = IMAGE_INFO_SPECIFIC_KIND_LUKS;
|
spec_info->type = IMAGE_INFO_SPECIFIC_KIND_LUKS;
|
||||||
|
@ -1002,7 +1002,7 @@ coroutine_fn block_crypto_co_amend_luks(BlockDriverState *bs,
|
||||||
QCryptoBlockAmendOptions amend_opts;
|
QCryptoBlockAmendOptions amend_opts;
|
||||||
|
|
||||||
amend_opts = (QCryptoBlockAmendOptions) {
|
amend_opts = (QCryptoBlockAmendOptions) {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
.u.luks = *qapi_BlockdevAmendOptionsLUKS_base(&opts->u.luks),
|
.u.luks = *qapi_BlockdevAmendOptionsLUKS_base(&opts->u.luks),
|
||||||
};
|
};
|
||||||
return block_crypto_amend_options_generic_luks(bs, &amend_opts,
|
return block_crypto_amend_options_generic_luks(bs, &amend_opts,
|
||||||
|
|
|
@ -831,7 +831,7 @@ qcow_co_create(BlockdevCreateOptions *opts, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qcow_opts->encrypt &&
|
if (qcow_opts->encrypt &&
|
||||||
qcow_opts->encrypt->format != Q_CRYPTO_BLOCK_FORMAT_QCOW)
|
qcow_opts->encrypt->format != QCRYPTO_BLOCK_FORMAT_QCOW)
|
||||||
{
|
{
|
||||||
error_setg(errp, "Unsupported encryption format");
|
error_setg(errp, "Unsupported encryption format");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -3214,10 +3214,10 @@ qcow2_set_up_encryption(BlockDriverState *bs,
|
||||||
int fmt, ret;
|
int fmt, ret;
|
||||||
|
|
||||||
switch (cryptoopts->format) {
|
switch (cryptoopts->format) {
|
||||||
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
|
case QCRYPTO_BLOCK_FORMAT_LUKS:
|
||||||
fmt = QCOW_CRYPT_LUKS;
|
fmt = QCOW_CRYPT_LUKS;
|
||||||
break;
|
break;
|
||||||
case Q_CRYPTO_BLOCK_FORMAT_QCOW:
|
case QCRYPTO_BLOCK_FORMAT_QCOW:
|
||||||
fmt = QCOW_CRYPT_AES;
|
fmt = QCOW_CRYPT_AES;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -5306,10 +5306,10 @@ qcow2_get_specific_info(BlockDriverState *bs, Error **errp)
|
||||||
ImageInfoSpecificQCow2Encryption *qencrypt =
|
ImageInfoSpecificQCow2Encryption *qencrypt =
|
||||||
g_new(ImageInfoSpecificQCow2Encryption, 1);
|
g_new(ImageInfoSpecificQCow2Encryption, 1);
|
||||||
switch (encrypt_info->format) {
|
switch (encrypt_info->format) {
|
||||||
case Q_CRYPTO_BLOCK_FORMAT_QCOW:
|
case QCRYPTO_BLOCK_FORMAT_QCOW:
|
||||||
qencrypt->format = BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_AES;
|
qencrypt->format = BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_AES;
|
||||||
break;
|
break;
|
||||||
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
|
case QCRYPTO_BLOCK_FORMAT_LUKS:
|
||||||
qencrypt->format = BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_LUKS;
|
qencrypt->format = BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_LUKS;
|
||||||
qencrypt->u.luks = encrypt_info->u.luks;
|
qencrypt->u.luks = encrypt_info->u.luks;
|
||||||
break;
|
break;
|
||||||
|
@ -5948,7 +5948,7 @@ static int coroutine_fn qcow2_co_amend(BlockDriverState *bs,
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qopts->encrypt->format != Q_CRYPTO_BLOCK_FORMAT_LUKS) {
|
if (qopts->encrypt->format != QCRYPTO_BLOCK_FORMAT_LUKS) {
|
||||||
error_setg(errp,
|
error_setg(errp,
|
||||||
"Amend can't be used to change the qcow2 encryption format");
|
"Amend can't be used to change the qcow2 encryption format");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
|
@ -1861,11 +1861,11 @@ qcrypto_block_luks_amend_options(QCryptoBlock *block,
|
||||||
QCryptoBlockAmendOptionsLUKS *opts_luks = &options->u.luks;
|
QCryptoBlockAmendOptionsLUKS *opts_luks = &options->u.luks;
|
||||||
|
|
||||||
switch (opts_luks->state) {
|
switch (opts_luks->state) {
|
||||||
case Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE_ACTIVE:
|
case QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE_ACTIVE:
|
||||||
return qcrypto_block_luks_amend_add_keyslot(block, readfunc,
|
return qcrypto_block_luks_amend_add_keyslot(block, readfunc,
|
||||||
writefunc, opaque,
|
writefunc, opaque,
|
||||||
opts_luks, force, errp);
|
opts_luks, force, errp);
|
||||||
case Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE_INACTIVE:
|
case QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE_INACTIVE:
|
||||||
return qcrypto_block_luks_amend_erase_keyslots(block, readfunc,
|
return qcrypto_block_luks_amend_erase_keyslots(block, readfunc,
|
||||||
writefunc, opaque,
|
writefunc, opaque,
|
||||||
opts_luks, force, errp);
|
opts_luks, force, errp);
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#include "block-luks.h"
|
#include "block-luks.h"
|
||||||
|
|
||||||
static const QCryptoBlockDriver *qcrypto_block_drivers[] = {
|
static const QCryptoBlockDriver *qcrypto_block_drivers[] = {
|
||||||
[Q_CRYPTO_BLOCK_FORMAT_QCOW] = &qcrypto_block_driver_qcow,
|
[QCRYPTO_BLOCK_FORMAT_QCOW] = &qcrypto_block_driver_qcow,
|
||||||
[Q_CRYPTO_BLOCK_FORMAT_LUKS] = &qcrypto_block_driver_luks,
|
[QCRYPTO_BLOCK_FORMAT_LUKS] = &qcrypto_block_driver_luks,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,6 @@
|
||||||
# Since: 2.6
|
# Since: 2.6
|
||||||
##
|
##
|
||||||
{ 'enum': 'QCryptoBlockFormat',
|
{ 'enum': 'QCryptoBlockFormat',
|
||||||
'prefix': 'Q_CRYPTO_BLOCK_FORMAT', # TODO drop
|
|
||||||
'data': ['qcow', 'luks']}
|
'data': ['qcow', 'luks']}
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -360,7 +359,6 @@
|
||||||
# Since: 5.1
|
# Since: 5.1
|
||||||
##
|
##
|
||||||
{ 'enum': 'QCryptoBlockLUKSKeyslotState',
|
{ 'enum': 'QCryptoBlockLUKSKeyslotState',
|
||||||
'prefix': 'Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE', # TODO drop
|
|
||||||
'data': [ 'active', 'inactive' ] }
|
'data': [ 'active', 'inactive' ] }
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -39,14 +39,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static QCryptoBlockCreateOptions qcow_create_opts = {
|
static QCryptoBlockCreateOptions qcow_create_opts = {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_QCOW,
|
.format = QCRYPTO_BLOCK_FORMAT_QCOW,
|
||||||
.u.qcow = {
|
.u.qcow = {
|
||||||
.key_secret = (char *)"sec0",
|
.key_secret = (char *)"sec0",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static QCryptoBlockOpenOptions qcow_open_opts = {
|
static QCryptoBlockOpenOptions qcow_open_opts = {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_QCOW,
|
.format = QCRYPTO_BLOCK_FORMAT_QCOW,
|
||||||
.u.qcow = {
|
.u.qcow = {
|
||||||
.key_secret = (char *)"sec0",
|
.key_secret = (char *)"sec0",
|
||||||
},
|
},
|
||||||
|
@ -55,7 +55,7 @@ static QCryptoBlockOpenOptions qcow_open_opts = {
|
||||||
|
|
||||||
#ifdef TEST_LUKS
|
#ifdef TEST_LUKS
|
||||||
static QCryptoBlockOpenOptions luks_open_opts = {
|
static QCryptoBlockOpenOptions luks_open_opts = {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
.u.luks = {
|
.u.luks = {
|
||||||
.key_secret = (char *)"sec0",
|
.key_secret = (char *)"sec0",
|
||||||
},
|
},
|
||||||
|
@ -64,7 +64,7 @@ static QCryptoBlockOpenOptions luks_open_opts = {
|
||||||
|
|
||||||
/* Creation with all default values */
|
/* Creation with all default values */
|
||||||
static QCryptoBlockCreateOptions luks_create_opts_default = {
|
static QCryptoBlockCreateOptions luks_create_opts_default = {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
.u.luks = {
|
.u.luks = {
|
||||||
.key_secret = (char *)"sec0",
|
.key_secret = (char *)"sec0",
|
||||||
},
|
},
|
||||||
|
@ -73,7 +73,7 @@ static QCryptoBlockCreateOptions luks_create_opts_default = {
|
||||||
|
|
||||||
/* ...and with explicit values */
|
/* ...and with explicit values */
|
||||||
static QCryptoBlockCreateOptions luks_create_opts_aes256_cbc_plain64 = {
|
static QCryptoBlockCreateOptions luks_create_opts_aes256_cbc_plain64 = {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
.u.luks = {
|
.u.luks = {
|
||||||
.key_secret = (char *)"sec0",
|
.key_secret = (char *)"sec0",
|
||||||
.has_cipher_alg = true,
|
.has_cipher_alg = true,
|
||||||
|
@ -87,7 +87,7 @@ static QCryptoBlockCreateOptions luks_create_opts_aes256_cbc_plain64 = {
|
||||||
|
|
||||||
|
|
||||||
static QCryptoBlockCreateOptions luks_create_opts_aes256_cbc_essiv = {
|
static QCryptoBlockCreateOptions luks_create_opts_aes256_cbc_essiv = {
|
||||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||||
.u.luks = {
|
.u.luks = {
|
||||||
.key_secret = (char *)"sec0",
|
.key_secret = (char *)"sec0",
|
||||||
.has_cipher_alg = true,
|
.has_cipher_alg = true,
|
||||||
|
@ -572,7 +572,7 @@ int main(int argc, char **argv)
|
||||||
g_assert(qcrypto_init(NULL) == 0);
|
g_assert(qcrypto_init(NULL) == 0);
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS(test_data); i++) {
|
for (i = 0; i < G_N_ELEMENTS(test_data); i++) {
|
||||||
if (test_data[i].open_opts->format == Q_CRYPTO_BLOCK_FORMAT_LUKS &&
|
if (test_data[i].open_opts->format == QCRYPTO_BLOCK_FORMAT_LUKS &&
|
||||||
!qcrypto_hash_supports(test_data[i].hash_alg)) {
|
!qcrypto_hash_supports(test_data[i].hash_alg)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue