Skip to contentSkip to conversation

fix for userspace usage of include/linux/crc-ccitt.h in 2.6.9-rc1

PATCH New Giacomo Lozito 1 participant 1 message Aug 28, 2004 CRC library

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix for userspace usage of include/linux/crc-ccitt.h in 2.6.9-rc1

This patch solves the issue described in this post:
http://lkml.org/lkml/2004/8/26/119
by using __u16 and __u8 in place of u16 and u8, that aren't exported outside the kernel.

If it's really trivial to use u16 and u8 for crc-ccitt.h, another way of solving this could be to use #ifdef __KERNEL__
in crc-ccitt.h to separate userspace usage from kernel matters.

Regards,
Giacomo Lozito

include/linux/crc-ccitt.h +3 -3
@@ -3,11 +3,11 @@
 
 #include <linux/types.h>
 
-extern u16 const crc_ccitt_table[256];
+extern __u16 const crc_ccitt_table[256];
 
-extern u16 crc_ccitt(u16 crc, const u8 *buffer, size_t len);
+extern __u16 crc_ccitt(__u16 crc, const __u8 *buffer, size_t len);
 
-static inline u16 crc_ccitt_byte(u16 crc, const u8 c)
+static inline __u16 crc_ccitt_byte(__u16 crc, const __u8 c)
 {
 	return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
 }