From e90b31d744aa397a64fb108cf4e8bd6754330056 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Tue, 20 Oct 2015 22:45:12 +0300 Subject: Updated from illumos-gate: added avl_swap --- usr/src/uts/common/sys/avl.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'usr/src/uts/common/sys') diff --git a/usr/src/uts/common/sys/avl.h b/usr/src/uts/common/sys/avl.h index ba305c9..cc4af82 100644 --- a/usr/src/uts/common/sys/avl.h +++ b/usr/src/uts/common/sys/avl.h @@ -23,14 +23,13 @@ * Use is subject to license terms. */ -#ifndef _AVL_H -#define _AVL_H - /* - * This is a private header file. Applications should not directly include - * this file. + * Copyright (c) 2014 by Delphix. All rights reserved. */ +#ifndef _AVL_H +#define _AVL_H + #ifdef __cplusplus extern "C" { #endif @@ -39,9 +38,9 @@ extern "C" { #include /* - * This is a generic implemenatation of AVL trees for use in the Solaris kernel. - * The interfaces provide an efficient way of implementing an ordered set of - * data structures. + * This is a generic implementation of AVL trees for use in the illumos. The + * interfaces provide an efficient way of implementing an ordered set of data + * structures. * * AVL trees provide an alternative to using an ordered linked list. Using AVL * trees will usually be faster, however they requires more storage. An ordered @@ -53,7 +52,7 @@ extern "C" { * --------- -------- -------- * lookup O(n) O(log(n)) * - * insert 1 node constant constant + * insert 1 node constant O(log(n)) * * delete 1 node constant between constant and O(log(n)) * @@ -175,7 +174,7 @@ extern void avl_insert(avl_tree_t *tree, void *node, avl_index_t where); * Insert "new_data" in "tree" in the given "direction" either after * or before the data "here". * - * This might be usefull for avl clients caching recently accessed + * This might be useful for avl clients caching recently accessed * data to avoid doing avl_find() again for insertion. * * new_data - new data to insert @@ -259,6 +258,11 @@ extern boolean_t avl_update(avl_tree_t *, void *); extern boolean_t avl_update_lt(avl_tree_t *, void *); extern boolean_t avl_update_gt(avl_tree_t *, void *); +/* + * Swaps the contents of the two trees. + */ +extern void avl_swap(avl_tree_t *tree1, avl_tree_t *tree2); + /* * Return the number of nodes in the tree */ -- cgit v1.2.3