diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2018-08-30 11:00:16 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-09-03 23:37:05 -0400 |
commit | 11dcb1037f40a19f298845a9b2ec093f7b8b958b (patch) | |
tree | ca65e8fbec63102f141b0020031af7c16eb096ac | |
parent | b76377543b738a6b58b0a7b0a42dd9e16436fee1 (diff) |
crc-t10dif: Allow current transform to be inspected in sysfs
Add a way to print the currently active CRC algorithm in:
/sys/module/crc_t10dif/parameters/transform
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | lib/crc-t10dif.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c index 52f577a3868d..6507fa101eff 100644 --- a/lib/crc-t10dif.c +++ b/lib/crc-t10dif.c | |||
@@ -107,6 +107,17 @@ static void __exit crc_t10dif_mod_fini(void) | |||
107 | module_init(crc_t10dif_mod_init); | 107 | module_init(crc_t10dif_mod_init); |
108 | module_exit(crc_t10dif_mod_fini); | 108 | module_exit(crc_t10dif_mod_fini); |
109 | 109 | ||
110 | static int crc_t10dif_transform_show(char *buffer, const struct kernel_param *kp) | ||
111 | { | ||
112 | if (static_key_false(&crct10dif_fallback)) | ||
113 | return sprintf(buffer, "fallback\n"); | ||
114 | |||
115 | return sprintf(buffer, "%s\n", | ||
116 | crypto_tfm_alg_driver_name(crypto_shash_tfm(crct10dif_tfm))); | ||
117 | } | ||
118 | |||
119 | module_param_call(transform, NULL, crc_t10dif_transform_show, NULL, 0644); | ||
120 | |||
110 | MODULE_DESCRIPTION("T10 DIF CRC calculation"); | 121 | MODULE_DESCRIPTION("T10 DIF CRC calculation"); |
111 | MODULE_LICENSE("GPL"); | 122 | MODULE_LICENSE("GPL"); |
112 | MODULE_SOFTDEP("pre: crct10dif"); | 123 | MODULE_SOFTDEP("pre: crct10dif"); |