public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* u_int32_t causes cross-compile problems [PATCH]
@ 2004-01-27 20:05 Pratik Solanki
  0 siblings, 0 replies; only message in thread
From: Pratik Solanki @ 2004-01-27 20:05 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 406 bytes --]

I came across this C standards issue while cross-compiling the Linux 
kernel with gcc on Solaris. The file gen_crc32table.c uses the 
non-standard type u_int32_t. It's possible that the host machine's 
sys/types.h does not define u_int32_t. The attached patch replaces 
u_int32_t with the POSIX standard uint32_t and includes POSIX inttypes.h 
instead of sys/types.h.

Please CC me when replying.

Pratik.

[-- Attachment #2: gen_crc32table.patch --]
[-- Type: text/plain, Size: 1111 bytes --]

===== lib/gen_crc32table.c 1.1 vs edited =====
--- 1.1/lib/gen_crc32table.c	Sun Nov 24 04:58:41 2002
+++ edited/lib/gen_crc32table.c	Fri Jan 23 11:06:00 2004
@@ -1,14 +1,14 @@
 #include <stdio.h>
 #include "crc32defs.h"
-#include <sys/types.h>
+#include <inttypes.h>
 
 #define ENTRIES_PER_LINE 4
 
 #define LE_TABLE_SIZE (1 << CRC_LE_BITS)
 #define BE_TABLE_SIZE (1 << CRC_BE_BITS)
 
-static u_int32_t crc32table_le[LE_TABLE_SIZE];
-static u_int32_t crc32table_be[BE_TABLE_SIZE];
+static uint32_t crc32table_le[LE_TABLE_SIZE];
+static uint32_t crc32table_be[BE_TABLE_SIZE];
 
 /**
  * crc32init_le() - allocate and initialize LE table data
@@ -20,7 +20,7 @@
 static void crc32init_le(void)
 {
 	unsigned i, j;
-	u_int32_t crc = 1;
+	uint32_t crc = 1;
 
 	crc32table_le[0] = 0;
 
@@ -37,7 +37,7 @@
 static void crc32init_be(void)
 {
 	unsigned i, j;
-	u_int32_t crc = 0x80000000;
+	uint32_t crc = 0x80000000;
 
 	crc32table_be[0] = 0;
 
@@ -48,7 +48,7 @@
 	}
 }
 
-static void output_table(u_int32_t table[], int len, char *trans)
+static void output_table(uint32_t table[], int len, char *trans)
 {
 	int i;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-27 20:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-27 20:05 u_int32_t causes cross-compile problems [PATCH] Pratik Solanki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox