mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
qapi/cryptodev: Rename QCryptodevBackendAlgType to *Algo, and drop prefix
QAPI's 'prefix' feature can make the connection between enumeration type and its constants less than obvious. It's best used with restraint. QCryptodevBackendAlgType has a 'prefix' that overrides the generated enumeration constants' prefix to QCRYPTODEV_BACKEND_ALG. We could simply drop 'prefix', but I think the abbreviation "alg" is less than clear. Additionally rename the type to QCryptodevBackendAlgoType. The prefix becomes QCRYPTODEV_BACKEND_ALGO_TYPE. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240904111836.3273842-19-armbru@redhat.com>
This commit is contained in:
parent
d0917d79fd
commit
b1019999e8
6 changed files with 18 additions and 19 deletions
|
@ -461,7 +461,7 @@ static void virtio_crypto_init_request(VirtIOCrypto *vcrypto, VirtQueue *vq,
|
|||
req->in_iov = NULL;
|
||||
req->in_num = 0;
|
||||
req->in_len = 0;
|
||||
req->flags = QCRYPTODEV_BACKEND_ALG__MAX;
|
||||
req->flags = QCRYPTODEV_BACKEND_ALGO_TYPE__MAX;
|
||||
memset(&req->op_info, 0x00, sizeof(req->op_info));
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ static void virtio_crypto_free_request(VirtIOCryptoReq *req)
|
|||
return;
|
||||
}
|
||||
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALG_SYM) {
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) {
|
||||
size_t max_len;
|
||||
CryptoDevBackendSymOpInfo *op_info = req->op_info.u.sym_op_info;
|
||||
|
||||
|
@ -486,7 +486,7 @@ static void virtio_crypto_free_request(VirtIOCryptoReq *req)
|
|||
memset(op_info, 0, sizeof(*op_info) + max_len);
|
||||
g_free(op_info);
|
||||
}
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALG_ASYM) {
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) {
|
||||
CryptoDevBackendAsymOpInfo *op_info = req->op_info.u.asym_op_info;
|
||||
if (op_info) {
|
||||
g_free(op_info->src);
|
||||
|
@ -571,10 +571,10 @@ static void virtio_crypto_req_complete(void *opaque, int ret)
|
|||
VirtIODevice *vdev = VIRTIO_DEVICE(vcrypto);
|
||||
uint8_t status = -ret;
|
||||
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALG_SYM) {
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) {
|
||||
virtio_crypto_sym_input_data_helper(vdev, req, status,
|
||||
req->op_info.u.sym_op_info);
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALG_ASYM) {
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) {
|
||||
virtio_crypto_akcipher_input_data_helper(vdev, req, status,
|
||||
req->op_info.u.asym_op_info);
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request)
|
|||
switch (opcode) {
|
||||
case VIRTIO_CRYPTO_CIPHER_ENCRYPT:
|
||||
case VIRTIO_CRYPTO_CIPHER_DECRYPT:
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALG_SYM;
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALGO_TYPE_SYM;
|
||||
ret = virtio_crypto_handle_sym_req(vcrypto,
|
||||
&req.u.sym_req, op_info,
|
||||
out_iov, out_num);
|
||||
|
@ -894,7 +894,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request)
|
|||
case VIRTIO_CRYPTO_AKCIPHER_DECRYPT:
|
||||
case VIRTIO_CRYPTO_AKCIPHER_SIGN:
|
||||
case VIRTIO_CRYPTO_AKCIPHER_VERIFY:
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALG_ASYM;
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM;
|
||||
ret = virtio_crypto_handle_asym_req(vcrypto,
|
||||
&req.u.akcipher_req, op_info,
|
||||
out_iov, out_num);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue