PERFORCE change 86661 for review

Todd Miller millert at FreeBSD.org
Fri Nov 11 18:42:09 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=86661

Change 86661 by millert at millert_ibook on 2005/11/11 18:41:54

	Fix yesterday's change here by explicitly including endian
	and byte order includes again.  They are implicitly included
	by the BSD sys/types but *not* by the mach sys/types.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/linux-compat.h#10 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/linux-compat.h#10 (text+ko) ====

@@ -43,7 +43,9 @@
  * diffs to the SELinux tree will be quite a bit smaller.
  */
 
-#include <sys/types.h>
+#include <sys/types.h>			/* NOTE: mach sys/types, not BSD one. */
+#include <machine/endian.h>		/* We need to explicitly include */
+#include <architecture/byte_order.h>	/* byte order includes for mach. */
 
 typedef u_int64_t u64;
 typedef u_int32_t u32;
@@ -51,16 +53,20 @@
 typedef u_int8_t  u8;
 
 
-#if BYTE_ORDER == LITTLE_ENDIAN
+#if !defined(BYTE_ORDER)
+#error BYTE_ORDER not defined
+#elif BYTE_ORDER == LITTLE_ENDIAN
 #define	cpu_to_le32(x)	((__uint32_t)(x))
 #define	cpu_to_le64(x)	((__uint64_t)(x))
 #define	le32_to_cpu(x)	((__uint32_t)(x))
 #define	le64_to_cpu(x)	((__uint64_t)(x))
-#else /* BYTE_ORDER != LITTLE_ENDIAN */
+#elif BYTE_ORDER == BIG_ENDIAN
+#define	cpu_to_le32(x)	NXSwapHostLongToLittle(x)
+#define	cpu_to_le64(x)	NXSwapHostLongLongToLittle(x)
 #define	le32_to_cpu(x)	NXSwapLittleLongToHost(x)
 #define	le64_to_cpu(x)	NXSwapLittleLongLongToHost(x)
-#define	cpu_to_le32(x)	NXSwapHostLongToLittle(x)
-#define	cpu_to_le64(x)	NXSwapHostLongLongToLittle(x)
+#else
+#error unsupported BYTE_ORDER
 #endif /* BYTE_ORDER */
 
 #if !defined(_KERNEL) && !defined(KERNEL)
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list