12 #ifdef HAVE_ASM_BYTEORDER_H
13 #include <asm/byteorder.h>
16 #ifdef HAVE_SYS_BYTEORDER_H
17 # include <sys/byteorder.h>
18 # if defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
20 # define _BIG_ENDIAN 4321
21 # define _BYTE_ORDER _BIG_ENDIAN
22 # elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
23 # undef _LITTLE_ENDIAN
24 # define _LITTLE_ENDIAN 1234
25 # define _BYTE_ORDER _LITTLE_ENDIAN
29 #ifdef HAVE_BYTESWAP_H
33 #ifdef HAVE_MACHINE_ENDIAN_H
34 #include <machine/endian.h>
37 #ifdef HAVE_LIBKERN_OSBYTEORDER_H
38 #include <libkern/OSByteOrder.h>
42 size_t strlcpy(char *, const char *, size_t);
46 #define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
50 # define ISCSI_HTOBE64(x) htobe64(x)
51 # define ISCSI_BE64TOH(x) be64toh(x)
53 # if defined(HAVE_LIBKERN_OSBYTEORDER_H)
54 # define ISCSI_HTOBE64(x) (x) = OSSwapBigToHostInt64((u_int64_t)(x))
55 # elif _BYTE_ORDER == _BIG_ENDIAN
56 # define ISCSI_HTOBE64(x) (x)
57 # elif defined(HAVE___BSWAP64)
58 # define ISCSI_HTOBE64(x) (x) = __bswap64((u_int64_t)(x))
59 # else /* LITTLE_ENDIAN */
60 # define ISCSI_HTOBE64(x) (((uint64_t)(ISCSI_NTOHL((uint32_t)(((x) << 32) >> 32))) << 32) | (uint32_t)ISCSI_NTOHL(((uint32_t)((x) >> 32))))
61 # endif /* LITTLE_ENDIAN */
62 # define ISCSI_BE64TOH(x) ISCSI_HTOBE64(x)
66 # ifndef __static_cast
67 # define __static_cast(x,y) (x)y
69 #define _DIAGASSERT(e) (__static_cast(void,0))
72 /* Added for busybox, which doesn't define INFTIM */
77 #endif /* COMPAT_H_ */