Print this page
patch uutil

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libuutil/common/uu_avl.c
          +++ new/usr/src/lib/libuutil/common/uu_avl.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  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 + *
       25 + * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  24   26   */
  25   27  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  27      -
  28   28  #include "libuutil_common.h"
  29   29  
  30   30  #include <stdlib.h>
  31   31  #include <string.h>
  32   32  #include <unistd.h>
  33   33  #include <sys/avl.h>
  34   34  
  35   35  static uu_avl_pool_t    uu_null_apool = { &uu_null_apool, &uu_null_apool };
  36   36  static pthread_mutex_t  uu_apool_list_lock = PTHREAD_MUTEX_INITIALIZER;
  37   37  
↓ open down ↓ 227 lines elided ↑ open up ↑
 265  265          UU_AVL_PTR(ap->ua_next_enc)->ua_prev_enc = ap->ua_prev_enc;
 266  266          UU_AVL_PTR(ap->ua_prev_enc)->ua_next_enc = ap->ua_next_enc;
 267  267          (void) pthread_mutex_unlock(&pp->uap_lock);
 268  268          ap->ua_prev_enc = UU_PTR_ENCODE(NULL);
 269  269          ap->ua_next_enc = UU_PTR_ENCODE(NULL);
 270  270  
 271  271          ap->ua_pool = NULL;
 272  272          avl_destroy(&ap->ua_tree);
 273  273  
 274  274          uu_free(ap);
      275 +}
      276 +
      277 +void
      278 +uu_avl_recreate(uu_avl_t *ap)
      279 +{
      280 +        uu_avl_pool_t *pp = ap->ua_pool;
      281 +
      282 +        avl_destroy(&ap->ua_tree);
      283 +        avl_create(&ap->ua_tree, &uu_avl_node_compare, pp->uap_objsize,
      284 +            pp->uap_nodeoffset);
 275  285  }
 276  286  
 277  287  size_t
 278  288  uu_avl_numnodes(uu_avl_t *ap)
 279  289  {
 280  290          return (avl_numnodes(&ap->ua_tree));
 281  291  }
 282  292  
 283  293  void *
 284  294  uu_avl_first(uu_avl_t *ap)
↓ open down ↓ 285 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX