Rename crc functions to private namespace

Apparently we overlap with some gtk (?) crc32() functions, causing
ours to be called and subsequently crashing since the arguments
aren't the same.

Move everything to a fio_ protected namespace.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/crc/crc16.c b/crc/crc16.c
index d9c4e49..f593f71 100644
--- a/crc/crc16.c
+++ b/crc/crc16.c
@@ -43,7 +43,7 @@
 	0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
 };
 
-unsigned short crc16(const void *buffer, unsigned int len)
+unsigned short fio_crc16(const void *buffer, unsigned int len)
 {
 	const unsigned char *cp = (const unsigned char *) buffer;
 	unsigned short crc = 0;
diff --git a/crc/crc16.h b/crc/crc16.h
index 6c078a4..433a7b1 100644
--- a/crc/crc16.h
+++ b/crc/crc16.h
@@ -17,7 +17,7 @@
 
 extern unsigned short const crc16_table[256];
 
-extern unsigned short crc16(const void *buffer, unsigned int len);
+extern unsigned short fio_crc16(const void *buffer, unsigned int len);
 
 static inline unsigned short crc16_byte(unsigned short crc,
 					const unsigned char data)
diff --git a/crc/crc32.c b/crc/crc32.c
index 4afed1a..657031d 100644
--- a/crc/crc32.c
+++ b/crc/crc32.c
@@ -73,7 +73,7 @@
   0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4
 };
 
-uint32_t crc32(const void *buffer, unsigned long length)
+uint32_t fio_crc32(const void *buffer, unsigned long length)
 {
 	const unsigned char *cp = (const unsigned char *) buffer;
 	uint32_t crc = 0;
diff --git a/crc/crc32.h b/crc/crc32.h
index d59a560..674057b 100644
--- a/crc/crc32.h
+++ b/crc/crc32.h
@@ -18,6 +18,6 @@
 #ifndef CRC32_H
 #define CRC32_H
 
-extern uint32_t crc32(const void * const, unsigned long);
+extern uint32_t fio_crc32(const void * const, unsigned long);
 
 #endif
diff --git a/crc/crc32c.h b/crc/crc32c.h
index 46c1063..11bcf9c 100644
--- a/crc/crc32c.h
+++ b/crc/crc32c.h
@@ -33,7 +33,7 @@
 }
 #endif
 
-static inline uint32_t crc32c(unsigned char const *buf, unsigned long len)
+static inline uint32_t fio_crc32c(unsigned char const *buf, unsigned long len)
 {
 	if (crc32c_intel_available)
 		return crc32c_intel(buf, len);
diff --git a/crc/crc64.c b/crc/crc64.c
index a61d432..bf24a97 100644
--- a/crc/crc64.c
+++ b/crc/crc64.c
@@ -92,7 +92,7 @@
   0x29b7d047efec8728ULL
 };
 
-unsigned long long crc64(const unsigned char *buffer, unsigned long length)
+unsigned long long fio_crc64(const unsigned char *buffer, unsigned long length)
 {
 	unsigned long long crc = 0;
 
diff --git a/crc/crc64.h b/crc/crc64.h
index e4310c2..fe9cad3 100644
--- a/crc/crc64.h
+++ b/crc/crc64.h
@@ -1,6 +1,6 @@
 #ifndef CRC64_H
 #define CRC64_H
 
-unsigned long long crc64(const unsigned char *, unsigned long);
+unsigned long long fio_crc64(const unsigned char *, unsigned long);
 
 #endif
diff --git a/crc/crc7.c b/crc/crc7.c
index 47aa332..bf7fd1c 100644
--- a/crc/crc7.c
+++ b/crc/crc7.c
@@ -43,7 +43,7 @@
 	0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79
 };
 
-unsigned char crc7(const unsigned char *buffer, unsigned int len)
+unsigned char fio_crc7(const unsigned char *buffer, unsigned int len)
 {
 	unsigned char crc = 0;
 
diff --git a/crc/crc7.h b/crc/crc7.h
index 6ff3cd8..5d5d188 100644
--- a/crc/crc7.h
+++ b/crc/crc7.h
@@ -8,6 +8,6 @@
 	return crc7_syndrome_table[(crc << 1) ^ data];
 }
 
-extern unsigned char crc7(const unsigned char *buffer, unsigned int len);
+extern unsigned char fio_crc7(const unsigned char *buffer, unsigned int len);
 
 #endif
diff --git a/crc/md5.c b/crc/md5.c
index 8f9adb2..0da85e4 100644
--- a/crc/md5.c
+++ b/crc/md5.c
@@ -88,7 +88,7 @@
 	hash[3] += d;
 }
 
-void md5_init(struct md5_ctx *mctx)
+void fio_md5_init(struct fio_md5_ctx *mctx)
 {
 	mctx->hash[0] = 0x67452301;
 	mctx->hash[1] = 0xefcdab89;
@@ -96,7 +96,8 @@
 	mctx->hash[3] = 0x10325476;
 }
 
-void md5_update(struct md5_ctx *mctx, const uint8_t *data, unsigned int len)
+void fio_md5_update(struct fio_md5_ctx *mctx, const uint8_t *data,
+		    unsigned int len)
 {
 	const uint32_t avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f);
 
diff --git a/crc/md5.h b/crc/md5.h
index 6747d30..668f0e9 100644
--- a/crc/md5.h
+++ b/crc/md5.h
@@ -16,13 +16,13 @@
 #define MD5STEP(f, w, x, y, z, in, s) \
 	(w += f(x, y, z) + in, w = (w<<s | w>>(32-s)) + x)
 
-struct md5_ctx {
+struct fio_md5_ctx {
 	uint32_t *hash;
 	uint32_t block[MD5_BLOCK_WORDS];
 	uint64_t byte_count;
 };
 
-extern void md5_update(struct md5_ctx *, const uint8_t *, unsigned int);
-extern void md5_init(struct md5_ctx *);
+extern void fio_md5_update(struct fio_md5_ctx *, const uint8_t *, unsigned int);
+extern void fio_md5_init(struct fio_md5_ctx *);
 
 #endif
diff --git a/crc/sha1.c b/crc/sha1.c
index 6206797..117fbd9 100644
--- a/crc/sha1.c
+++ b/crc/sha1.c
@@ -10,9 +10,9 @@
 #include "sha1.h"
 
 /* Hash one 64-byte block of data */
-static void blk_SHA1Block(struct sha1_ctx *ctx, const unsigned int *data);
+static void blk_SHA1Block(struct fio_sha1_ctx *ctx, const unsigned int *data);
 
-void sha1_init(struct sha1_ctx *ctx)
+void fio_sha1_init(struct fio_sha1_ctx *ctx)
 {
 	ctx->size = 0;
 
@@ -25,7 +25,8 @@
 	ctx->H[4] = 0xc3d2e1f0;
 }
 
-void sha1_update(struct sha1_ctx *ctx, const void *data, unsigned long len)
+void fio_sha1_update(struct fio_sha1_ctx *ctx, const void *data,
+		     unsigned long len)
 {
 	int lenW = ctx->size & 63;
 
@@ -54,7 +55,7 @@
 		memcpy(ctx->W, data, len);
 }
 
-void sha1_final(unsigned char hashout[20], struct sha1_ctx *ctx)
+void fio_sha1_final(unsigned char hashout[20], struct fio_sha1_ctx *ctx)
 {
 	static const unsigned char pad[64] = { 0x80 };
 	unsigned int padlen[2];
@@ -66,8 +67,8 @@
 	padlen[1] = htonl(ctx->size << 3);
 
 	i = ctx->size & 63;
-	sha1_update(ctx, pad, 1+ (63 & (55 - i)));
-	sha1_update(ctx, padlen, 8);
+	fio_sha1_update(ctx, pad, 1+ (63 & (55 - i)));
+	fio_sha1_update(ctx, padlen, 8);
 
 	/* Output hash
 	 */
@@ -111,7 +112,7 @@
 #define T_40_59(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, ((B&C)+(D&(B^C))) , 0x8f1bbcdc, A, B, C, D, E )
 #define T_60_79(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) ,  0xca62c1d6, A, B, C, D, E )
 
-static void blk_SHA1Block(struct sha1_ctx *ctx, const unsigned int *data)
+static void blk_SHA1Block(struct fio_sha1_ctx *ctx, const unsigned int *data)
 {
 	unsigned int A,B,C,D,E;
 	unsigned int array[16];
diff --git a/crc/sha1.h b/crc/sha1.h
index af4165a..14af44a 100644
--- a/crc/sha1.h
+++ b/crc/sha1.h
@@ -7,14 +7,14 @@
  * and to avoid unnecessary copies into the context array.
  */
 
-struct sha1_ctx {
+struct fio_sha1_ctx {
 	uint32_t *H;
 	unsigned int W[16];
 	unsigned long long size;
 };
 
-void sha1_init(struct sha1_ctx *);
-void sha1_update(struct sha1_ctx *, const void *dataIn, unsigned long len);
-void sha1_final(unsigned char hashout[20], struct sha1_ctx *);
+void fio_sha1_init(struct fio_sha1_ctx *);
+void fio_sha1_update(struct fio_sha1_ctx *, const void *dataIn, unsigned long len);
+void fio_sha1_final(unsigned char hashout[20], struct fio_sha1_ctx *);
 
 #endif
diff --git a/crc/sha256.c b/crc/sha256.c
index dcb1677..3a72a5b 100644
--- a/crc/sha256.c
+++ b/crc/sha256.c
@@ -227,7 +227,7 @@
 	memset(W, 0, 64 * sizeof(uint32_t));
 }
 
-void sha256_init(struct sha256_ctx *sctx)
+void fio_sha256_init(struct fio_sha256_ctx *sctx)
 {
 	sctx->state[0] = H0;
 	sctx->state[1] = H1;
@@ -240,8 +240,8 @@
 	sctx->count[0] = sctx->count[1] = 0;
 }
 
-void sha256_update(struct sha256_ctx *sctx, const uint8_t *data,
-		   unsigned int len)
+void fio_sha256_update(struct fio_sha256_ctx *sctx, const uint8_t *data,
+		       unsigned int len)
 {
 	unsigned int i, idx, part_len;
 
diff --git a/crc/sha256.h b/crc/sha256.h
index a3ca0e6..c7aa28f 100644
--- a/crc/sha256.h
+++ b/crc/sha256.h
@@ -1,13 +1,13 @@
 #ifndef FIO_SHA256_H
 #define FIO_SHA256_H
 
-struct sha256_ctx {
+struct fio_sha256_ctx {
 	uint32_t count[2];
 	uint32_t state[8];
 	uint8_t *buf;
 };
 
-void sha256_init(struct sha256_ctx *);
-void sha256_update(struct sha256_ctx *, const uint8_t *, unsigned int);
+void fio_sha256_init(struct fio_sha256_ctx *);
+void fio_sha256_update(struct fio_sha256_ctx *, const uint8_t *, unsigned int);
 
 #endif
diff --git a/crc/sha512.c b/crc/sha512.c
index 9268a49..e069a44 100644
--- a/crc/sha512.c
+++ b/crc/sha512.c
@@ -146,7 +146,7 @@
 	a = b = c = d = e = f = g = h = t1 = t2 = 0;
 }
 
-void sha512_init(struct sha512_ctx *sctx)
+void fio_sha512_init(struct fio_sha512_ctx *sctx)
 {
 	sctx->state[0] = H0;
 	sctx->state[1] = H1;
@@ -159,8 +159,8 @@
 	sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0;
 }
 
-void sha512_update(struct sha512_ctx *sctx, const uint8_t *data,
-		   unsigned int len)
+void fio_sha512_update(struct fio_sha512_ctx *sctx, const uint8_t *data,
+		       unsigned int len)
 {
 	unsigned int i, idx, part_len;
 
diff --git a/crc/sha512.h b/crc/sha512.h
index 46e10cb..f8b2112 100644
--- a/crc/sha512.h
+++ b/crc/sha512.h
@@ -1,14 +1,14 @@
 #ifndef FIO_SHA512_H
 #define FIO_SHA512_H
 
-struct sha512_ctx {
+struct fio_sha512_ctx {
 	uint64_t state[8];
 	uint32_t count[4];
 	uint8_t *buf;
 	uint64_t W[80];
 };
 
-void sha512_init(struct sha512_ctx *);
-void sha512_update(struct sha512_ctx *, const uint8_t *, unsigned int);
+void fio_sha512_init(struct fio_sha512_ctx *);
+void fio_sha512_update(struct fio_sha512_ctx *, const uint8_t *, unsigned int);
 
 #endif