1 #pragma ident "%Z%%M% %I% %E% SMI"
4 * Code corresponding to smb_apple.h
5 * XXX: Could merge this into smb_subr.h
6 * as long as that doesn't break smbfs
9 #ifndef _NETSMB_SMB_OSDEP_H_
10 #define _NETSMB_SMB_OSDEP_H_
17 #define min(a, b) (((a) < (b)) ? (a) : (b))
20 #define CAST_DOWN(type, addr) (((type)((uintptr_t)(addr))))
21 #define USER_ADDR_NULL ((user_addr_t)0)
22 #define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)(a_ptr))
25 * flags to (BSD) malloc
27 #define M_WAITOK 0x0000
28 #define M_NOWAIT 0x0001
29 #define M_ZERO 0x0004 /* bzero the allocation */
34 * Some UTF Related stuff. Will be deleting this once compiled and using
38 * UTF-8 encode/decode flags
40 #define UTF_REVERSE_ENDIAN 0x01 /* reverse UCS-2 byte order */
41 #define UTF_NO_NULL_TERM 0x02 /* do not add null termination */
42 #define UTF_DECOMPOSED 0x04 /* generate fully decomposed UCS-2 */
43 #define UTF_PRECOMPOSED 0x08 /* generate precomposed UCS-2 */
46 * These are actually included in sunddi.h. I am getting compilation
47 * errors right now. Adding the induvidual defines here again from sunddi.h
48 * Unicode encoding conversion functions and their macros.
50 #define UCONV_IN_BIG_ENDIAN 0x0001
51 #define UCONV_OUT_BIG_ENDIAN 0x0002
52 #define UCONV_IN_SYSTEM_ENDIAN 0x0004
53 #define UCONV_OUT_SYSTEM_ENDIAN 0x0008
54 #define UCONV_IN_LITTLE_ENDIAN 0x0010
55 #define UCONV_OUT_LITTLE_ENDIAN 0x0020
56 #define UCONV_IGNORE_NULL 0x0040
57 #define UCONV_IN_ACCEPT_BOM 0x0080
58 #define UCONV_OUT_EMIT_BOM 0x0100
60 extern int uconv_u8tou16(const uchar_t
*, size_t *, uint16_t *, size_t *, int);
62 /* Legacy type names for Solaris. */
63 typedef uint64_t u_int64_t
;
64 typedef uint32_t u_int32_t
;
65 typedef uint16_t u_int16_t
;
66 typedef uint8_t u_int8_t
;
68 typedef const char * c_caddr_t
;
69 typedef uint64_t user_addr_t
;
76 #define timespeccmp(tvp, uvp, cmp) \
77 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
78 ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
79 ((tvp)->tv_sec cmp (uvp)->tv_sec))
82 #define timespecadd(vvp, uvp) \
84 (vvp)->tv_sec += (uvp)->tv_sec; \
85 (vvp)->tv_nsec += (uvp)->tv_nsec; \
86 if ((vvp)->tv_nsec >= 1000000000) { \
88 (vvp)->tv_nsec -= 1000000000; \
92 #define timespecsub(vvp, uvp) \
94 (vvp)->tv_sec -= (uvp)->tv_sec; \
95 (vvp)->tv_nsec -= (uvp)->tv_nsec; \
96 if ((vvp)->tv_nsec < 0) { \
98 (vvp)->tv_nsec += 1000000000; \
102 #endif /* _NETSMB_SMB_OSDEP_H_ */