Print this page
NEX-16818 Add fksmbcl development tool
NEX-17264 SMB client test tp_smbutil_013 fails after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (fix ref leaks)
   1 #pragma ident   "%Z%%M% %I%     %E% SMI"





















   2 
   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  */
   8 
   9 #ifndef _NETSMB_SMB_OSDEP_H_
  10 #define _NETSMB_SMB_OSDEP_H_
  11 
  12 #ifndef PRIVSYM
  13 #define PRIVSYM 
  14 #endif
  15 
  16 #ifndef min
  17 #define min(a, b)       (((a) < (b)) ? (a) : (b))
  18 #endif
  19 
  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))
  23 
  24 /*
  25  * flags to (BSD) malloc
  26  */


  48  * Unicode encoding conversion functions and their macros.
  49  */
  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
  59 
  60 extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
  61 
  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;
  67 
  68 typedef const char * c_caddr_t;
  69 typedef uint64_t        user_addr_t;


  70 




  71 /*
  72  * Time related calls.
  73  */
  74 
  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 */
  81 
  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                 }                                                       \
  90         }
   1 /*
   2  * Copyright (c) 2001 - 2012 Apple Inc. All rights reserved.
   3  *
   4  * @APPLE_LICENSE_HEADER_START@
   5  *
   6  * This file contains Original Code and/or Modifications of Original Code
   7  * as defined in and that are subject to the Apple Public Source License
   8  * Version 2.0 (the 'License'). You may not use this file except in
   9  * compliance with the License. Please obtain a copy of the License at
  10  * http://www.opensource.apple.com/apsl/ and read it before using this
  11  * file.
  12  *
  13  * The Original Code and all software distributed under the License are
  14  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  15  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  16  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  17  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  18  * Please see the License for the specific language governing rights and
  19  * limitations under the License.
  20  *
  21  * @APPLE_LICENSE_HEADER_END@
  22  */
  23 
  24 /*
  25  * Code corresponding to smb_apple.h


  26  */
  27 
  28 #ifndef _NETSMB_SMB_OSDEP_H_
  29 #define _NETSMB_SMB_OSDEP_H_
  30 
  31 #ifndef PRIVSYM
  32 #define PRIVSYM
  33 #endif
  34 
  35 #ifndef min
  36 #define min(a, b)       (((a) < (b)) ? (a) : (b))
  37 #endif
  38 
  39 #define CAST_DOWN(type, addr)  (((type)((uintptr_t)(addr))))
  40 #define USER_ADDR_NULL  ((user_addr_t)0)
  41 #define CAST_USER_ADDR_T(a_ptr)   ((user_addr_t)(a_ptr))
  42 
  43 /*
  44  * flags to (BSD) malloc
  45  */


  67  * Unicode encoding conversion functions and their macros.
  68  */
  69 #define UCONV_IN_BIG_ENDIAN             0x0001
  70 #define UCONV_OUT_BIG_ENDIAN            0x0002
  71 #define UCONV_IN_SYSTEM_ENDIAN          0x0004
  72 #define UCONV_OUT_SYSTEM_ENDIAN         0x0008
  73 #define UCONV_IN_LITTLE_ENDIAN          0x0010
  74 #define UCONV_OUT_LITTLE_ENDIAN         0x0020
  75 #define UCONV_IGNORE_NULL               0x0040
  76 #define UCONV_IN_ACCEPT_BOM             0x0080
  77 #define UCONV_OUT_EMIT_BOM              0x0100
  78 
  79 extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
  80 
  81 /* Legacy type names for Solaris. */
  82 typedef uint64_t u_int64_t;
  83 typedef uint32_t u_int32_t;
  84 typedef uint16_t u_int16_t;
  85 typedef uint8_t u_int8_t;
  86 
  87 typedef const char *c_caddr_t;
  88 typedef uint64_t        user_addr_t;
  89 typedef ssize_t         user_ssize_t;
  90 typedef size_t          user_size_t;
  91 
  92 #ifdef _FAKE_KERNEL
  93 #define ddi_get_cred()  CRED()
  94 #endif
  95 
  96 /*
  97  * Time related calls.
  98  */
  99 
 100 /* BEGIN CSTYLED */
 101 #define timespeccmp(tvp, uvp, cmp)                                      \
 102         (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
 103         ((tvp)->tv_nsec cmp (uvp)->tv_nsec) :                             \
 104         ((tvp)->tv_sec cmp (uvp)->tv_sec))
 105 /* END CSTYLED */
 106 
 107 #define timespecadd(vvp, uvp)                                           \
 108         {                                                               \
 109                 (vvp)->tv_sec += (uvp)->tv_sec;                           \
 110                 (vvp)->tv_nsec += (uvp)->tv_nsec;                 \
 111                 if ((vvp)->tv_nsec >= 1000000000) {                       \
 112                         (vvp)->tv_sec++;                             \
 113                         (vvp)->tv_nsec -= 1000000000;                        \
 114                 }                                                       \
 115         }