]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
s390/crc: drop "glue" from filenames
authorEric Biggers <ebiggers@google.com>
Thu, 24 Apr 2025 00:20:36 +0000 (17:20 -0700)
committerEric Biggers <ebiggers@google.com>
Mon, 28 Apr 2025 16:07:19 +0000 (09:07 -0700)
The use of the term "glue" in filenames is a Crypto API-ism that does
not show up elsewhere in lib/.  I think adopting it there was a mistake.
The library just uses standard functions, so the amount of code that
could be considered "glue" is quite small.  And while often the C
functions just wrap the assembly functions, there are also cases like
crc32c_arch() in arch/x86/lib/crc32-glue.c that blur the line by
in-lining the actual implementation into the C function.  That's not
"glue code", but rather the actual code.

Therefore, let's drop "glue" from the filenames and instead use e.g.
crc32.c instead of crc32-glue.c.

Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Link: https://lore.kernel.org/r/20250424002038.179114-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
arch/s390/lib/Makefile
arch/s390/lib/crc32-glue.c [deleted file]
arch/s390/lib/crc32.c [new file with mode: 0644]

index 14bbfe50033c7c0591bf699608cb410975c31621..271a1c407121c526bfda678c196833a1c88ff09e 100644 (file)
@@ -26,4 +26,4 @@ lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
 obj-$(CONFIG_EXPOLINE_EXTERN) += expoline.o
 
 obj-$(CONFIG_CRC32_ARCH) += crc32-s390.o
-crc32-s390-y := crc32-glue.o crc32le-vx.o crc32be-vx.o
+crc32-s390-y := crc32.o crc32le-vx.o crc32be-vx.o
diff --git a/arch/s390/lib/crc32-glue.c b/arch/s390/lib/crc32-glue.c
deleted file mode 100644 (file)
index 3c4b344..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * CRC-32 implemented with the z/Architecture Vector Extension Facility.
- *
- * Copyright IBM Corp. 2015
- * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
- */
-#define KMSG_COMPONENT "crc32-vx"
-#define pr_fmt(fmt)    KMSG_COMPONENT ": " fmt
-
-#include <linux/module.h>
-#include <linux/cpufeature.h>
-#include <linux/crc32.h>
-#include <asm/fpu.h>
-#include "crc32-vx.h"
-
-#define VX_MIN_LEN             64
-#define VX_ALIGNMENT           16L
-#define VX_ALIGN_MASK          (VX_ALIGNMENT - 1)
-
-/*
- * DEFINE_CRC32_VX() - Define a CRC-32 function using the vector extension
- *
- * Creates a function to perform a particular CRC-32 computation. Depending
- * on the message buffer, the hardware-accelerated or software implementation
- * is used.   Note that the message buffer is aligned to improve fetch
- * operations of VECTOR LOAD MULTIPLE instructions.
- */
-#define DEFINE_CRC32_VX(___fname, ___crc32_vx, ___crc32_sw)                \
-       u32 ___fname(u32 crc, const u8 *data, size_t datalen)               \
-       {                                                                   \
-               unsigned long prealign, aligned, remaining;                 \
-               DECLARE_KERNEL_FPU_ONSTACK16(vxstate);                      \
-                                                                           \
-               if (datalen < VX_MIN_LEN + VX_ALIGN_MASK || !cpu_has_vx())  \
-                       return ___crc32_sw(crc, data, datalen);             \
-                                                                           \
-               if ((unsigned long)data & VX_ALIGN_MASK) {                  \
-                       prealign = VX_ALIGNMENT -                           \
-                                 ((unsigned long)data & VX_ALIGN_MASK);    \
-                       datalen -= prealign;                                \
-                       crc = ___crc32_sw(crc, data, prealign);             \
-                       data = (void *)((unsigned long)data + prealign);    \
-               }                                                           \
-                                                                           \
-               aligned = datalen & ~VX_ALIGN_MASK;                         \
-               remaining = datalen & VX_ALIGN_MASK;                        \
-                                                                           \
-               kernel_fpu_begin(&vxstate, KERNEL_VXR_LOW);                 \
-               crc = ___crc32_vx(crc, data, aligned);                      \
-               kernel_fpu_end(&vxstate, KERNEL_VXR_LOW);                   \
-                                                                           \
-               if (remaining)                                              \
-                       crc = ___crc32_sw(crc, data + aligned, remaining);  \
-                                                                           \
-               return crc;                                                 \
-       }                                                                   \
-       EXPORT_SYMBOL(___fname);
-
-DEFINE_CRC32_VX(crc32_le_arch, crc32_le_vgfm_16, crc32_le_base)
-DEFINE_CRC32_VX(crc32_be_arch, crc32_be_vgfm_16, crc32_be_base)
-DEFINE_CRC32_VX(crc32c_arch, crc32c_le_vgfm_16, crc32c_base)
-
-u32 crc32_optimizations(void)
-{
-       if (cpu_has_vx()) {
-               return CRC32_LE_OPTIMIZATION |
-                      CRC32_BE_OPTIMIZATION |
-                      CRC32C_OPTIMIZATION;
-       }
-       return 0;
-}
-EXPORT_SYMBOL(crc32_optimizations);
-
-MODULE_AUTHOR("Hendrik Brueckner <brueckner@linux.vnet.ibm.com>");
-MODULE_DESCRIPTION("CRC-32 algorithms using z/Architecture Vector Extension Facility");
-MODULE_LICENSE("GPL");
diff --git a/arch/s390/lib/crc32.c b/arch/s390/lib/crc32.c
new file mode 100644 (file)
index 0000000..3c4b344
--- /dev/null
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * CRC-32 implemented with the z/Architecture Vector Extension Facility.
+ *
+ * Copyright IBM Corp. 2015
+ * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+ */
+#define KMSG_COMPONENT "crc32-vx"
+#define pr_fmt(fmt)    KMSG_COMPONENT ": " fmt
+
+#include <linux/module.h>
+#include <linux/cpufeature.h>
+#include <linux/crc32.h>
+#include <asm/fpu.h>
+#include "crc32-vx.h"
+
+#define VX_MIN_LEN             64
+#define VX_ALIGNMENT           16L
+#define VX_ALIGN_MASK          (VX_ALIGNMENT - 1)
+
+/*
+ * DEFINE_CRC32_VX() - Define a CRC-32 function using the vector extension
+ *
+ * Creates a function to perform a particular CRC-32 computation. Depending
+ * on the message buffer, the hardware-accelerated or software implementation
+ * is used.   Note that the message buffer is aligned to improve fetch
+ * operations of VECTOR LOAD MULTIPLE instructions.
+ */
+#define DEFINE_CRC32_VX(___fname, ___crc32_vx, ___crc32_sw)                \
+       u32 ___fname(u32 crc, const u8 *data, size_t datalen)               \
+       {                                                                   \
+               unsigned long prealign, aligned, remaining;                 \
+               DECLARE_KERNEL_FPU_ONSTACK16(vxstate);                      \
+                                                                           \
+               if (datalen < VX_MIN_LEN + VX_ALIGN_MASK || !cpu_has_vx())  \
+                       return ___crc32_sw(crc, data, datalen);             \
+                                                                           \
+               if ((unsigned long)data & VX_ALIGN_MASK) {                  \
+                       prealign = VX_ALIGNMENT -                           \
+                                 ((unsigned long)data & VX_ALIGN_MASK);    \
+                       datalen -= prealign;                                \
+                       crc = ___crc32_sw(crc, data, prealign);             \
+                       data = (void *)((unsigned long)data + prealign);    \
+               }                                                           \
+                                                                           \
+               aligned = datalen & ~VX_ALIGN_MASK;                         \
+               remaining = datalen & VX_ALIGN_MASK;                        \
+                                                                           \
+               kernel_fpu_begin(&vxstate, KERNEL_VXR_LOW);                 \
+               crc = ___crc32_vx(crc, data, aligned);                      \
+               kernel_fpu_end(&vxstate, KERNEL_VXR_LOW);                   \
+                                                                           \
+               if (remaining)                                              \
+                       crc = ___crc32_sw(crc, data + aligned, remaining);  \
+                                                                           \
+               return crc;                                                 \
+       }                                                                   \
+       EXPORT_SYMBOL(___fname);
+
+DEFINE_CRC32_VX(crc32_le_arch, crc32_le_vgfm_16, crc32_le_base)
+DEFINE_CRC32_VX(crc32_be_arch, crc32_be_vgfm_16, crc32_be_base)
+DEFINE_CRC32_VX(crc32c_arch, crc32c_le_vgfm_16, crc32c_base)
+
+u32 crc32_optimizations(void)
+{
+       if (cpu_has_vx()) {
+               return CRC32_LE_OPTIMIZATION |
+                      CRC32_BE_OPTIMIZATION |
+                      CRC32C_OPTIMIZATION;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(crc32_optimizations);
+
+MODULE_AUTHOR("Hendrik Brueckner <brueckner@linux.vnet.ibm.com>");
+MODULE_DESCRIPTION("CRC-32 algorithms using z/Architecture Vector Extension Facility");
+MODULE_LICENSE("GPL");