patch-2.1.12 linux/include/asm-m68k/byteorder.h

Next file: linux/include/asm-m68k/elf.h
Previous file: linux/include/asm-m68k/atari_SLM.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.11/linux/include/asm-m68k/byteorder.h linux/include/asm-m68k/byteorder.h
@@ -9,6 +9,38 @@
 #define __BIG_ENDIAN_BITFIELD
 #endif
 
+#ifdef __KERNEL__
+#include <linux/config.h>
+#include <asm/types.h>
+
+/*
+ * In-kernel byte order macros to handle stuff like
+ * byte-order-dependent filesystems etc.
+ */
+
+#define le16_to_cpu(__val) __swab16(__val)
+#define le32_to_cpu(__val) __swab32(__val)
+#define cpu_to_le32(__val) __swab32(__val)
+#define cpu_to_le16(__val) __swab16(__val)
+
+extern __inline__ __u16 __swab16 (__u16 val)
+{
+	return (val << 8) | (val >> 8);
+}
+
+extern __inline__ __u32 __swab32 (__u32 val)
+{
+	__asm__ ("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
+	return val;
+}
+
+#define cpu_to_be32(x) (x)
+#define be32_to_cpu(x) (x)
+#define cpu_to_be16(x) (x)
+#define be16_to_cpu(x) (x)
+
+#endif
+
 #undef ntohl
 #undef ntohs
 #undef htonl
@@ -36,6 +68,11 @@
 
 #define __htonl(x) __ntohl(x)
 #define __htons(x) __ntohs(x)
+
+#define __constant_htonl(x) (x)
+#define __constant_htons(x) (x)
+#define __constant_ntohl(x) (x)
+#define __constant_ntohs(x) (x)
 
 #ifdef __OPTIMIZE__
 #define ntohl(x) __ntohl(x)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov