From: Simon Glass <simon.glass@canonical.com>
Update include/linux/crc32c.h to map crc32c() and crc32c_le() macros
to ext4l_crc32c(), which uses the correct Castagnoli polynomial
(0x82F63B78) required for ext4 checksums.
This avoids conflicts with other filesystems like btrfs that have
their own crc32c() implementation.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
include/linux/crc32c.h | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
@@ -1,21 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
- * CRC32C definitions
+ * CRC32C definitions for ext4l
*
- * Minimal version for U-Boot ext4l - based on Linux 6.18
+ * CRC32C (Castagnoli) uses polynomial 0x1EDC6F41 (bit-reflected: 0x82F63B78)
+ * This is different from standard CRC32 (IEEE 802.3) which uses 0x04C11DB7.
+ *
+ * ext4l provides its own implementation to avoid conflicts with other
+ * filesystems (e.g., btrfs) that have their own crc32c().
*/
#ifndef _LINUX_CRC32C_H
#define _LINUX_CRC32C_H
+#include <asm/byteorder.h>
#include <linux/types.h>
-#include <u-boot/crc.h>
-/* Use U-Boot's CRC32 implementation */
-static inline u32 crc32c(u32 crc, const void *address, unsigned int length)
-{
- return crc32(crc, address, length);
-}
+u32 ext4l_crc32c(u32 crc, const void *address, unsigned int length);
-#define crc32c_le(crc, p, len) crc32c(crc, p, len)
+#define crc32c(crc, p, len) ext4l_crc32c(crc, p, len)
+#define crc32c_le(crc, p, len) ext4l_crc32c(crc, p, len)
#endif /* _LINUX_CRC32C_H */