blob: 5194d244f13666730a35c57fb3240cfe883ce1ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#ifndef COMPAT_H_
#define COMPAT_H_
#include "config.h"
#include <sys/types.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_ASM_BYTEORDER_H
#include <asm/byteorder.h>
#endif
#ifdef HAVE_SYS_BYTEORDER_H
# include <sys/byteorder.h>
# if defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
# undef _BIG_ENDIAN
# define _BIG_ENDIAN 4321
# define _BYTE_ORDER _BIG_ENDIAN
# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
# undef _LITTLE_ENDIAN
# define _LITTLE_ENDIAN 1234
# define _BYTE_ORDER _LITTLE_ENDIAN
# endif
#endif
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#endif
#ifdef HAVE_MACHINE_ENDIAN_H
#include <machine/endian.h>
#endif
#ifdef HAVE_LIBKERN_OSBYTEORDER_H
#include <libkern/OSByteOrder.h>
#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif
#ifndef __UNCONST
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
#endif
#ifdef HAVE_HTOBE64
# define ISCSI_HTOBE64(x) htobe64(x)
# define ISCSI_BE64TOH(x) be64toh(x)
#else
# if defined(HAVE_LIBKERN_OSBYTEORDER_H)
# define ISCSI_HTOBE64(x) (x) = OSSwapBigToHostInt64((u_int64_t)(x))
# elif _BYTE_ORDER == _BIG_ENDIAN
# define ISCSI_HTOBE64(x) (x)
# elif defined(HAVE___BSWAP64)
# define ISCSI_HTOBE64(x) (x) = __bswap64((u_int64_t)(x))
# else /* LITTLE_ENDIAN */
# define ISCSI_HTOBE64(x) (((uint64_t)(ISCSI_NTOHL((uint32_t)(((x) << 32) >> 32))) << 32) | (uint32_t)ISCSI_NTOHL(((uint32_t)((x) >> 32))))
# endif /* LITTLE_ENDIAN */
# define ISCSI_BE64TOH(x) ISCSI_HTOBE64(x)
#endif
#ifndef _DIAGASSERT
# ifndef __static_cast
# define __static_cast(x,y) (x)y
# endif
#define _DIAGASSERT(e) (__static_cast(void,0))
#endif
/* Added for busybox, which doesn't define INFTIM */
#ifndef INFTIM
#define INFTIM -1
#endif
#endif /* COMPAT_H_ */
|