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)
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/sys/modhash.h
          +++ new/usr/src/uts/common/sys/modhash.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  #ifndef _SYS_MODHASH_H
  
    | 
      ↓ open down ↓ | 
    26 lines elided | 
    
      ↑ open up ↑ | 
  
  27   27  #define _SYS_MODHASH_H
  28   28  
  29   29  /*
  30   30   * Generic hash implementation for the kernel.
  31   31   */
  32   32  
  33   33  #ifdef __cplusplus
  34   34  extern "C" {
  35   35  #endif
  36   36  
  37      -#ifdef _KERNEL
       37 +#if defined(_KERNEL) || defined(_FAKE_KERNEL)
  38   38  
  39   39  #include <sys/types.h>
  40   40  
  41   41  /*
  42   42   * Opaque data types for storing keys and values
  43   43   */
  44   44  typedef void *mod_hash_val_t;
  45   45  typedef void *mod_hash_key_t;
  46   46  
  47   47  /*
  48   48   * Opaque data type for reservation
  49   49   */
  50   50  typedef void *mod_hash_hndl_t;
  51   51  
  52   52  /*
  53   53   * Opaque type for hash itself.
  54   54   */
  55   55  struct mod_hash;
  56   56  typedef struct mod_hash mod_hash_t;
  57   57  
  58   58  /*
  59   59   * String hash table
  60   60   */
  61   61  mod_hash_t *mod_hash_create_strhash(char *, size_t, void (*)(mod_hash_val_t));
  62   62  void mod_hash_destroy_strhash(mod_hash_t *);
  63   63  int mod_hash_strkey_cmp(mod_hash_key_t, mod_hash_key_t);
  64   64  void mod_hash_strkey_dtor(mod_hash_key_t);
  65   65  void mod_hash_strval_dtor(mod_hash_val_t);
  66   66  uint_t mod_hash_bystr(void *, mod_hash_key_t);
  67   67  
  68   68  /*
  69   69   * Pointer hash table
  70   70   */
  71   71  mod_hash_t *mod_hash_create_ptrhash(char *, size_t, void (*)(mod_hash_val_t),
  72   72      size_t);
  73   73  void mod_hash_destroy_ptrhash(mod_hash_t *);
  74   74  int mod_hash_ptrkey_cmp(mod_hash_key_t, mod_hash_key_t);
  75   75  uint_t mod_hash_byptr(void *, mod_hash_key_t);
  76   76  
  77   77  /*
  78   78   * ID hash table
  79   79   */
  80   80  mod_hash_t *mod_hash_create_idhash(char *, size_t, void (*)(mod_hash_val_t));
  81   81  void mod_hash_destroy_idhash(mod_hash_t *);
  82   82  int mod_hash_idkey_cmp(mod_hash_key_t, mod_hash_key_t);
  83   83  uint_t mod_hash_byid(void *, mod_hash_key_t);
  84   84  uint_t mod_hash_iddata_gen(size_t);
  85   85  
  86   86  /*
  87   87   * Hash management functions
  88   88   */
  89   89  mod_hash_t *mod_hash_create_extended(char *, size_t, void (*)(mod_hash_key_t),
  90   90      void (*)(mod_hash_val_t), uint_t (*)(void *, mod_hash_key_t), void *,
  91   91      int (*)(mod_hash_key_t, mod_hash_key_t), int);
  92   92  
  93   93  void mod_hash_destroy_hash(mod_hash_t *);
  94   94  void mod_hash_clear(mod_hash_t *);
  95   95  
  96   96  /*
  97   97   * Null key and value destructors
  98   98   */
  99   99  void mod_hash_null_keydtor(mod_hash_key_t);
 100  100  void mod_hash_null_valdtor(mod_hash_val_t);
 101  101  
 102  102  /*
 103  103   * Basic hash operations
 104  104   */
 105  105  
 106  106  /*
 107  107   * Error codes for insert, remove, find, destroy.
 108  108   */
 109  109  #define MH_ERR_NOMEM -1
 110  110  #define MH_ERR_DUPLICATE -2
 111  111  #define MH_ERR_NOTFOUND -3
 112  112  
 113  113  /*
 114  114   * Return codes for hash walkers
 115  115   */
 116  116  #define MH_WALK_CONTINUE 0
 117  117  #define MH_WALK_TERMINATE 1
 118  118  
 119  119  /*
 120  120   * Basic hash operations
 121  121   */
 122  122  int mod_hash_insert(mod_hash_t *, mod_hash_key_t, mod_hash_val_t);
 123  123  int mod_hash_replace(mod_hash_t *, mod_hash_key_t, mod_hash_val_t);
 124  124  int mod_hash_remove(mod_hash_t *, mod_hash_key_t, mod_hash_val_t *);
 125  125  int mod_hash_destroy(mod_hash_t *, mod_hash_key_t);
 126  126  int mod_hash_find(mod_hash_t *, mod_hash_key_t, mod_hash_val_t *);
 127  127  int mod_hash_find_cb(mod_hash_t *, mod_hash_key_t, mod_hash_val_t *,
 128  128      void (*)(mod_hash_key_t, mod_hash_val_t));
 129  129  int mod_hash_find_cb_rval(mod_hash_t *, mod_hash_key_t, mod_hash_val_t *,
 130  130      int (*)(mod_hash_key_t, mod_hash_val_t), int *);
 131  131  void mod_hash_walk(mod_hash_t *,
 132  132      uint_t (*)(mod_hash_key_t, mod_hash_val_t *, void *), void *);
 133  133  
 134  134  /*
 135  135   * Reserving hash operations
 136  136   */
 137  137  int mod_hash_reserve(mod_hash_t *, mod_hash_hndl_t *);
 138  138  int mod_hash_reserve_nosleep(mod_hash_t *, mod_hash_hndl_t *);
 139  139  void mod_hash_cancel(mod_hash_t *, mod_hash_hndl_t *);
 140  140  int mod_hash_insert_reserve(mod_hash_t *, mod_hash_key_t, mod_hash_val_t,
 141  141      mod_hash_hndl_t);
 142  142  
 143  143  #endif /* _KERNEL */
 144  144  
 145  145  #ifdef __cplusplus
 146  146  }
 147  147  #endif
 148  148  
 149  149  #endif /* _SYS_MODHASH_H */
  
    | 
      ↓ open down ↓ | 
    102 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX