[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180826024006.13800-3-martin.petersen@oracle.com>
Date: Sat, 25 Aug 2018 22:40:05 -0400
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: herbert@...dor.apana.org.au
Cc: Jeff.Lien@....com, ard.biesheuvel@...aro.org,
david.darrington@....com, hch@...radead.org, jeff.furlong@....com,
linux-block@...r.kernel.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
martin.petersen@...cle.com, tim.c.chen@...ux.intel.com
Subject: [PATCH 3/4] 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@...cle.com>
---
lib/crc-t10dif.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c
index 72076a902df5..21c9b35a656f 100644
--- a/lib/crc-t10dif.c
+++ b/lib/crc-t10dif.c
@@ -107,6 +107,17 @@ static void __exit crc_t10dif_mod_fini(void)
module_init(crc_t10dif_mod_init);
module_exit(crc_t10dif_mod_fini);
+static int crc_t10dif_transform_show(char *buffer, const struct kernel_param *kp)
+{
+ if (static_key_false(&crct10dif_fallback))
+ return sprintf(buffer, "fallback\n");
+
+ return sprintf(buffer, "%s\n",
+ crypto_tfm_alg_driver_name(crypto_shash_tfm(crct10dif_tfm)));
+}
+
+module_param_call(transform, NULL, crc_t10dif_transform_show, NULL, 0644);
+
MODULE_DESCRIPTION("T10 DIF CRC calculation");
MODULE_LICENSE("GPL");
MODULE_SOFTDEP("pre: crct10dif");
--
2.17.1
Powered by blists - more mailing lists