8592 ZFS channel programs - rollback
[unleashed.git] / usr / src / uts / common / fs / smbclnt / netsmb / smb_osdep.h
blob712acb6f3b04e4cc177d5ff8cb6cb6356a5a9c32
1 #pragma ident "%Z%%M% %I% %E% SMI"
3 /*
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
7 */
9 #ifndef _NETSMB_SMB_OSDEP_H_
10 #define _NETSMB_SMB_OSDEP_H_
12 #ifndef PRIVSYM
13 #define PRIVSYM
14 #endif
16 #ifndef min
17 #define min(a, b) (((a) < (b)) ? (a) : (b))
18 #endif
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 */
31 /* Iconv stuff */
34 * Some UTF Related stuff. Will be deleting this once compiled and using
35 * ienup's code.
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;
72 * Time related calls.
75 /* BEGIN CSTYLED */
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))
80 /* END CSTYLED */
82 #define timespecadd(vvp, uvp) \
83 { \
84 (vvp)->tv_sec += (uvp)->tv_sec; \
85 (vvp)->tv_nsec += (uvp)->tv_nsec; \
86 if ((vvp)->tv_nsec >= 1000000000) { \
87 (vvp)->tv_sec++; \
88 (vvp)->tv_nsec -= 1000000000; \
89 } \
92 #define timespecsub(vvp, uvp) \
93 { \
94 (vvp)->tv_sec -= (uvp)->tv_sec; \
95 (vvp)->tv_nsec -= (uvp)->tv_nsec; \
96 if ((vvp)->tv_nsec < 0) { \
97 (vvp)->tv_sec--; \
98 (vvp)->tv_nsec += 1000000000; \
99 } \
102 #endif /* _NETSMB_SMB_OSDEP_H_ */