/* * Aug 8, 2011 Bob Pearson with help from Joakim Tjernlund and George Spelvin * cleaned up code to current version of sparse and added the slicing-by-8 * algorithm to the closely similar existing slicing-by-4 algorithm. * * Oct 15, 2000 Matt Domsch <[email protected]> * Nicer crc32 functions/docs submitted by [email protected]. Thanks! * Code was from the public domain, copyright abandoned. Code was * subsequently included in the kernel, thus was re-licensed under the * GNU GPL v2. * * Oct 12, 2000 Matt Domsch <[email protected]> * Same crc32 function was used in 5 other places in the kernel. * I made one version, and deleted the others. * There are various incantations of crc32(). Some use a seed of 0 or ~0. * Some xor at the end with ~0. The generic crc32() function takes * seed as an argument, and doesn't xor at the end. Then individual * users can do whatever they need. * drivers/net/smc9194.c uses seed ~0, doesn't xor with ~0. * fs/jffs2 uses seed 0, doesn't xor with ~0. * fs/partitions/efi.c uses seed ~0, xor's with ~0. * * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ #include <linux/crc32.h> #include <linux/module.h> #include <linux/sched.h> #include "crc32defs.h" /* 4096 random bytes */ static u8 const __aligned(8) test_buf[] __initconst = …; /* 100 test cases */ static struct crc_test { … } const test[] __initconst = …; #include <linux/time.h> static int __init crc32c_test(void) { … } static int __init crc32c_combine_test(void) { … } static int __init crc32_test(void) { … } static int __init crc32_combine_test(void) { … } static int __init crc32test_init(void) { … } static void __exit crc32_exit(void) { … } module_init(…) …; module_exit(crc32_exit); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;