From nobody Sun Nov 24 16:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722327235; cv=none; d=zohomail.com; s=zohoarc; b=f3nsPdrqvEZ0lmdG8Fjzg208a1KLa5qJNsEzM4cvd857DvIkawtkjYupLlQdXTIMFh8XOCx+C2KOLph2ExTH+AHjOrXePZkY4TKmdW8317YY1vKIQ+3aZ5Zejyuj3Dj5/oMAybcB18N7vD1rJgActNpMJ/+GM25V6d2/G/LB8bc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722327235; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/IcBJJUvdSdN0kBRVvjJDdC45PwUmOYNtwRnS1xygRQ=; b=IGC2Oz08pjjfPAqoqVaQfhaUXfpH2XYEE5olTQ13pH142Upf2yHQiBR8yd4WAgmJWLcn593Qbh6WnLVp9Q3myVF/p+oijh+zb/eWX69vraYXxVouKuZWAUqCezdMFEGr0Zfhz8sqHjwAuHbaIRJciNG4l1FHvTMx1eGvDlno5qw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722327235742786.3534836322888; Tue, 30 Jul 2024 01:13:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYhxl-0001Zw-UU; Tue, 30 Jul 2024 04:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sYhx3-0006rG-B0 for qemu-devel@nongnu.org; Tue, 30 Jul 2024 04:11:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sYhwj-0001ND-PU for qemu-devel@nongnu.org; Tue, 30 Jul 2024 04:11:21 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-282-SphhJlo4OpGi7sxY1Y86NA-1; Tue, 30 Jul 2024 04:10:52 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 040C51955D44; Tue, 30 Jul 2024 08:10:46 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.65]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B006300019A; Tue, 30 Jul 2024 08:10:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1FC2821F4BA3; Tue, 30 Jul 2024 10:10:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722327060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/IcBJJUvdSdN0kBRVvjJDdC45PwUmOYNtwRnS1xygRQ=; b=O4hGDP7y4IISVx/9CSgHK8u43r6FSAxTRp0emaG6VB06sbwj2t7LwoqD2+JnM7dP5AX9qm OHtzcHbuoE21AkolAx9VxOzscEc/1BS/DZqanHVCQKNwk4l4v6XaV7aUHAGkl3yfLLJGpl i/0w5Np4G+k1HBAQH4TEHGw9lkiUYQ4= X-MC-Unique: SphhJlo4OpGi7sxY1Y86NA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, andrew@codeconstruct.com.au, andrew@daynix.com, arei.gonglei@huawei.com, berrange@redhat.com, berto@igalia.com, borntraeger@linux.ibm.com, clg@kaod.org, david@redhat.com, den@openvz.org, eblake@redhat.com, eduardo@habkost.net, farman@linux.ibm.com, farosas@suse.de, hreitz@redhat.com, idryomov@gmail.com, iii@linux.ibm.com, jamin_lin@aspeedtech.com, jasowang@redhat.com, joel@jms.id.au, jsnow@redhat.com, kwolf@redhat.com, leetroy@gmail.com, marcandre.lureau@redhat.com, marcel.apfelbaum@gmail.com, michael.roth@amd.com, mst@redhat.com, mtosatti@redhat.com, nsg@linux.ibm.com, pasic@linux.ibm.com, pbonzini@redhat.com, peter.maydell@linaro.org, peterx@redhat.com, philmd@linaro.org, pizhenwei@bytedance.com, pl@dlhnet.de, richard.henderson@linaro.org, stefanha@redhat.com, steven_lee@aspeedtech.com, thuth@redhat.com, vsementsov@yandex-team.ru, wangyanan55@huawei.com, yuri.benditovich@daynix.com, zhao1.liu@intel.com, qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-s390x@nongnu.org, kvm@vger.kernel.org Subject: [PATCH 18/18] qapi/cryptodev: Rename QCryptodevBackendAlgType to *Algo, and drop prefix Date: Tue, 30 Jul 2024 10:10:32 +0200 Message-ID: <20240730081032.1246748-19-armbru@redhat.com> In-Reply-To: <20240730081032.1246748-1-armbru@redhat.com> References: <20240730081032.1246748-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722327237001116600 Content-Type: text/plain; charset="utf-8" QAPI's 'prefix' feature can make the connection between enumeration type and its constants less than obvious. It's best used with restraint. QCryptodevBackendAlgType 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 Reviewed-by: Daniel P. Berrang=C3=A9 --- qapi/cryptodev.json | 5 ++--- include/sysemu/cryptodev.h | 2 +- backends/cryptodev-builtin.c | 6 +++--- backends/cryptodev-lkcf.c | 4 ++-- backends/cryptodev.c | 6 +++--- hw/virtio/virtio-crypto.c | 14 +++++++------- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/qapi/cryptodev.json b/qapi/cryptodev.json index 65abc16842..5e417340dc 100644 --- a/qapi/cryptodev.json +++ b/qapi/cryptodev.json @@ -9,7 +9,7 @@ ## =20 ## -# @QCryptodevBackendAlgType: +# @QCryptodevBackendAlgoType: # # The supported algorithm types of a crypto device. # @@ -19,8 +19,7 @@ # # Since: 8.0 ## -{ 'enum': 'QCryptodevBackendAlgType', - 'prefix': 'QCRYPTODEV_BACKEND_ALG', +{ 'enum': 'QCryptodevBackendAlgoType', 'data': ['sym', 'asym']} =20 ## diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index 96d3998b93..b20822df0d 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -178,7 +178,7 @@ typedef struct CryptoDevBackendAsymOpInfo { typedef void (*CryptoDevCompletionFunc) (void *opaque, int ret); =20 typedef struct CryptoDevBackendOpInfo { - QCryptodevBackendAlgType algtype; + QCryptodevBackendAlgoType algtype; uint32_t op_code; uint32_t queue_index; CryptoDevCompletionFunc cb; diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index 170c93a6be..b1486be630 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -549,7 +549,7 @@ static int cryptodev_builtin_operation( CryptoDevBackendBuiltinSession *sess; CryptoDevBackendSymOpInfo *sym_op_info; CryptoDevBackendAsymOpInfo *asym_op_info; - QCryptodevBackendAlgType algtype =3D op_info->algtype; + QCryptodevBackendAlgoType algtype =3D op_info->algtype; int status =3D -VIRTIO_CRYPTO_ERR; Error *local_error =3D NULL; =20 @@ -561,11 +561,11 @@ static int cryptodev_builtin_operation( } =20 sess =3D builtin->sessions[op_info->session_id]; - if (algtype =3D=3D QCRYPTODEV_BACKEND_ALG_SYM) { + if (algtype =3D=3D QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) { sym_op_info =3D op_info->u.sym_op_info; status =3D cryptodev_builtin_sym_operation(sess, sym_op_info, &local_error); - } else if (algtype =3D=3D QCRYPTODEV_BACKEND_ALG_ASYM) { + } else if (algtype =3D=3D QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) { asym_op_info =3D op_info->u.asym_op_info; status =3D cryptodev_builtin_asym_operation(sess, op_info->op_code, asym_op_info, &local_err= or); diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c index 0dc4b067f5..38deac0717 100644 --- a/backends/cryptodev-lkcf.c +++ b/backends/cryptodev-lkcf.c @@ -474,7 +474,7 @@ static int cryptodev_lkcf_operation( CryptoDevBackendLKCF *lkcf =3D CRYPTODEV_BACKEND_LKCF(backend); CryptoDevBackendLKCFSession *sess; - QCryptodevBackendAlgType algtype =3D op_info->algtype; + QCryptodevBackendAlgoType algtype =3D op_info->algtype; CryptoDevLKCFTask *task; =20 if (op_info->session_id >=3D MAX_SESSIONS || @@ -485,7 +485,7 @@ static int cryptodev_lkcf_operation( } =20 sess =3D lkcf->sess[op_info->session_id]; - if (algtype !=3D QCRYPTODEV_BACKEND_ALG_ASYM) { + if (algtype !=3D QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) { error_report("algtype not supported: %u", algtype); return -VIRTIO_CRYPTO_NOTSUPP; } diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 76dfe65904..d8bd2a1ae6 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -185,10 +185,10 @@ static int cryptodev_backend_operation( static int cryptodev_backend_account(CryptoDevBackend *backend, CryptoDevBackendOpInfo *op_info) { - enum QCryptodevBackendAlgType algtype =3D op_info->algtype; + enum QCryptodevBackendAlgoType algtype =3D op_info->algtype; int len; =20 - if (algtype =3D=3D QCRYPTODEV_BACKEND_ALG_ASYM) { + if (algtype =3D=3D QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) { CryptoDevBackendAsymOpInfo *asym_op_info =3D op_info->u.asym_op_in= fo; len =3D asym_op_info->src_len; =20 @@ -212,7 +212,7 @@ static int cryptodev_backend_account(CryptoDevBackend *= backend, default: return -VIRTIO_CRYPTO_NOTSUPP; } - } else if (algtype =3D=3D QCRYPTODEV_BACKEND_ALG_SYM) { + } else if (algtype =3D=3D QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) { CryptoDevBackendSymOpInfo *sym_op_info =3D op_info->u.sym_op_info; len =3D sym_op_info->src_len; =20 diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 0ab8ae3282..6e9d8293da 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -461,7 +461,7 @@ static void virtio_crypto_init_request(VirtIOCrypto *vc= rypto, VirtQueue *vq, req->in_iov =3D NULL; req->in_num =3D 0; req->in_len =3D 0; - req->flags =3D QCRYPTODEV_BACKEND_ALG__MAX; + req->flags =3D QCRYPTODEV_BACKEND_ALGO_TYPE__MAX; memset(&req->op_info, 0x00, sizeof(req->op_info)); } =20 @@ -471,7 +471,7 @@ static void virtio_crypto_free_request(VirtIOCryptoReq = *req) return; } =20 - if (req->flags =3D=3D QCRYPTODEV_BACKEND_ALG_SYM) { + if (req->flags =3D=3D QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) { size_t max_len; CryptoDevBackendSymOpInfo *op_info =3D req->op_info.u.sym_op_info; =20 @@ -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 =3D=3D QCRYPTODEV_BACKEND_ALG_ASYM) { + } else if (req->flags =3D=3D QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) { CryptoDevBackendAsymOpInfo *op_info =3D req->op_info.u.asym_op_inf= o; if (op_info) { g_free(op_info->src); @@ -571,10 +571,10 @@ static void virtio_crypto_req_complete(void *opaque, = int ret) VirtIODevice *vdev =3D VIRTIO_DEVICE(vcrypto); uint8_t status =3D -ret; =20 - if (req->flags =3D=3D QCRYPTODEV_BACKEND_ALG_SYM) { + if (req->flags =3D=3D 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 =3D=3D QCRYPTODEV_BACKEND_ALG_ASYM) { + } else if (req->flags =3D=3D 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 =3D request->flags =3D QCRYPTODEV_BACKEND_ALG_SYM; + op_info->algtype =3D request->flags =3D QCRYPTODEV_BACKEND_ALGO_TY= PE_SYM; ret =3D 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 =3D request->flags =3D QCRYPTODEV_BACKEND_ALG_ASY= M; + op_info->algtype =3D request->flags =3D QCRYPTODEV_BACKEND_ALGO_TY= PE_ASYM; ret =3D virtio_crypto_handle_asym_req(vcrypto, &req.u.akcipher_req, op_info, out_iov, out_num); --=20 2.45.0