module/*.ko: prune .data, global .rodata

Evaluated every variable that lives in .data (and globals in .rodata)
in the kernel modules, and constified/eliminated/localised them
appropriately. This means that all read-only data is now actually
read-only data, and, if possible, at file scope. A lot of previously-
global-symbols became inlinable (and inlined!) constants. Probably
not in a big Wowee Performance Moment, but hey.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12899
This commit is contained in:
наб
2022-01-15 00:37:55 +01:00
committed by GitHub
parent 7adc190098
commit 18168da727
147 changed files with 781 additions and 876 deletions
+8 -8
View File
@@ -39,7 +39,7 @@
/*
* Mechanism info structure passed to KCF during registration.
*/
static crypto_mech_info_t aes_mech_info_tab[] = {
static const crypto_mech_info_t aes_mech_info_tab[] = {
/* AES_ECB */
{SUN_CKM_AES_ECB, AES_ECB_MECH_INFO_TYPE,
CRYPTO_FG_ENCRYPT | CRYPTO_FG_ENCRYPT_ATOMIC |
@@ -77,7 +77,7 @@ static crypto_mech_info_t aes_mech_info_tab[] = {
static void aes_provider_status(crypto_provider_handle_t, uint_t *);
static crypto_control_ops_t aes_control_ops = {
static const crypto_control_ops_t aes_control_ops = {
aes_provider_status
};
@@ -110,7 +110,7 @@ static int aes_decrypt_atomic(crypto_provider_handle_t, crypto_session_id_t,
crypto_mechanism_t *, crypto_key_t *, crypto_data_t *,
crypto_data_t *, crypto_spi_ctx_template_t, crypto_req_handle_t);
static crypto_cipher_ops_t aes_cipher_ops = {
static const crypto_cipher_ops_t aes_cipher_ops = {
.encrypt_init = aes_encrypt_init,
.encrypt = aes_encrypt,
.encrypt_update = aes_encrypt_update,
@@ -130,7 +130,7 @@ static int aes_mac_verify_atomic(crypto_provider_handle_t, crypto_session_id_t,
crypto_mechanism_t *, crypto_key_t *, crypto_data_t *, crypto_data_t *,
crypto_spi_ctx_template_t, crypto_req_handle_t);
static crypto_mac_ops_t aes_mac_ops = {
static const crypto_mac_ops_t aes_mac_ops = {
.mac_init = NULL,
.mac = NULL,
.mac_update = NULL,
@@ -144,12 +144,12 @@ static int aes_create_ctx_template(crypto_provider_handle_t,
size_t *, crypto_req_handle_t);
static int aes_free_context(crypto_ctx_t *);
static crypto_ctx_ops_t aes_ctx_ops = {
static const crypto_ctx_ops_t aes_ctx_ops = {
.create_ctx_template = aes_create_ctx_template,
.free_context = aes_free_context
};
static crypto_ops_t aes_crypto_ops = {{{{{
static const crypto_ops_t aes_crypto_ops = {{{{{
&aes_control_ops,
NULL,
&aes_cipher_ops,
@@ -166,13 +166,13 @@ static crypto_ops_t aes_crypto_ops = {{{{{
&aes_ctx_ops
}}}}};
static crypto_provider_info_t aes_prov_info = {{{{
static const crypto_provider_info_t aes_prov_info = {{{{
CRYPTO_SPI_VERSION_1,
"AES Software Provider",
CRYPTO_SW_PROVIDER,
NULL,
&aes_crypto_ops,
sizeof (aes_mech_info_tab)/sizeof (crypto_mech_info_t),
sizeof (aes_mech_info_tab) / sizeof (crypto_mech_info_t),
aes_mech_info_tab
}}}};
+8 -8
View File
@@ -60,7 +60,7 @@
/*
* Mechanism info structure passed to KCF during registration.
*/
static crypto_mech_info_t sha2_mech_info_tab[] = {
static const crypto_mech_info_t sha2_mech_info_tab[] = {
/* SHA256 */
{SUN_CKM_SHA256, SHA256_MECH_INFO_TYPE,
CRYPTO_FG_DIGEST | CRYPTO_FG_DIGEST_ATOMIC,
@@ -107,7 +107,7 @@ static crypto_mech_info_t sha2_mech_info_tab[] = {
static void sha2_provider_status(crypto_provider_handle_t, uint_t *);
static crypto_control_ops_t sha2_control_ops = {
static const crypto_control_ops_t sha2_control_ops = {
sha2_provider_status
};
@@ -123,7 +123,7 @@ static int sha2_digest_atomic(crypto_provider_handle_t, crypto_session_id_t,
crypto_mechanism_t *, crypto_data_t *, crypto_data_t *,
crypto_req_handle_t);
static crypto_digest_ops_t sha2_digest_ops = {
static const crypto_digest_ops_t sha2_digest_ops = {
.digest_init = sha2_digest_init,
.digest = sha2_digest,
.digest_update = sha2_digest_update,
@@ -144,7 +144,7 @@ static int sha2_mac_verify_atomic(crypto_provider_handle_t, crypto_session_id_t,
crypto_mechanism_t *, crypto_key_t *, crypto_data_t *, crypto_data_t *,
crypto_spi_ctx_template_t, crypto_req_handle_t);
static crypto_mac_ops_t sha2_mac_ops = {
static const crypto_mac_ops_t sha2_mac_ops = {
.mac_init = sha2_mac_init,
.mac = NULL,
.mac_update = sha2_mac_update,
@@ -158,12 +158,12 @@ static int sha2_create_ctx_template(crypto_provider_handle_t,
size_t *, crypto_req_handle_t);
static int sha2_free_context(crypto_ctx_t *);
static crypto_ctx_ops_t sha2_ctx_ops = {
static const crypto_ctx_ops_t sha2_ctx_ops = {
.create_ctx_template = sha2_create_ctx_template,
.free_context = sha2_free_context
};
static crypto_ops_t sha2_crypto_ops = {{{{{
static const crypto_ops_t sha2_crypto_ops = {{{{{
&sha2_control_ops,
&sha2_digest_ops,
NULL,
@@ -180,13 +180,13 @@ static crypto_ops_t sha2_crypto_ops = {{{{{
&sha2_ctx_ops
}}}}};
static crypto_provider_info_t sha2_prov_info = {{{{
static const crypto_provider_info_t sha2_prov_info = {{{{
CRYPTO_SPI_VERSION_1,
"SHA2 Software Provider",
CRYPTO_SW_PROVIDER,
NULL,
&sha2_crypto_ops,
sizeof (sha2_mech_info_tab)/sizeof (crypto_mech_info_t),
sizeof (sha2_mech_info_tab) / sizeof (crypto_mech_info_t),
sha2_mech_info_tab
}}}};
+7 -7
View File
@@ -30,7 +30,7 @@
#define SKEIN_MODULE_IMPL
#include <sys/skein.h>
static crypto_mech_info_t skein_mech_info_tab[] = {
static const crypto_mech_info_t skein_mech_info_tab[] = {
{CKM_SKEIN_256, SKEIN_256_MECH_INFO_TYPE,
CRYPTO_FG_DIGEST | CRYPTO_FG_DIGEST_ATOMIC,
0, 0, CRYPTO_KEYSIZE_UNIT_IN_BITS},
@@ -53,7 +53,7 @@ static crypto_mech_info_t skein_mech_info_tab[] = {
static void skein_provider_status(crypto_provider_handle_t, uint_t *);
static crypto_control_ops_t skein_control_ops = {
static const crypto_control_ops_t skein_control_ops = {
skein_provider_status
};
@@ -67,7 +67,7 @@ static int skein_digest_atomic(crypto_provider_handle_t, crypto_session_id_t,
crypto_mechanism_t *, crypto_data_t *, crypto_data_t *,
crypto_req_handle_t);
static crypto_digest_ops_t skein_digest_ops = {
static const crypto_digest_ops_t skein_digest_ops = {
.digest_init = skein_digest_init,
.digest = skein_digest,
.digest_update = skein_update,
@@ -82,7 +82,7 @@ static int skein_mac_atomic(crypto_provider_handle_t, crypto_session_id_t,
crypto_mechanism_t *, crypto_key_t *, crypto_data_t *, crypto_data_t *,
crypto_spi_ctx_template_t, crypto_req_handle_t);
static crypto_mac_ops_t skein_mac_ops = {
static const crypto_mac_ops_t skein_mac_ops = {
.mac_init = skein_mac_init,
.mac = NULL,
.mac_update = skein_update, /* using regular digest update is OK here */
@@ -96,12 +96,12 @@ static int skein_create_ctx_template(crypto_provider_handle_t,
size_t *, crypto_req_handle_t);
static int skein_free_context(crypto_ctx_t *);
static crypto_ctx_ops_t skein_ctx_ops = {
static const crypto_ctx_ops_t skein_ctx_ops = {
.create_ctx_template = skein_create_ctx_template,
.free_context = skein_free_context
};
static crypto_ops_t skein_crypto_ops = {{{{{
static const crypto_ops_t skein_crypto_ops = {{{{{
&skein_control_ops,
&skein_digest_ops,
NULL,
@@ -118,7 +118,7 @@ static crypto_ops_t skein_crypto_ops = {{{{{
&skein_ctx_ops,
}}}}};
static crypto_provider_info_t skein_prov_info = {{{{
static const crypto_provider_info_t skein_prov_info = {{{{
CRYPTO_SPI_VERSION_1,
"Skein Software Provider",
CRYPTO_SW_PROVIDER,