xref: /illumos-gate/usr/src/man/man3avl/avl_update.3avl (revision 8119dad84d6416f13557b0ba8e2aaf9064cbcfd3)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright 2024 Oxide Computer Company
13.\"
14.Dd Jan 27, 2024
15.Dt AVL_UPDATE 3AVL
16.Os
17.Sh NAME
18.Nm avl_update ,
19.Nm avl_update_gt ,
20.Nm avl_update_lt
21.Nd reinsert a node if its order has changed
22.Sh SYNOPSIS
23.Lb libavl
24.In sys/avl.h
25.Ft boolean_t
26.Fo avl_update
27.Fa "avl_tree_t *tree"
28.Fa "void *node"
29.Fc
30.Ft boolean_t
31.Fo avl_update_gt
32.Fa "avl_tree_t *tree"
33.Fa "void *node"
34.Fc
35.Ft boolean_t
36.Fo avl_update_lt
37.Fa "avl_tree_t *tree"
38.Fa "void *node"
39.Fc
40.Sh DESCRIPTION
41The
42.Fn avl_update
43function re-inserts
44.Fa node
45into
46.Fa tree
47only if its order has changed relative to its nearest neighbors.
48To optimize performance,
49.Fn avl_update_lt
50checks only the previous node and
51.Fn avl_update_gt
52checks only the next node.
53Use
54.Fn avl_update_lt
55and
56.Fn avl_update_gt
57only if you know the direction in which the order of the node may change.
58.Sh RETURN VALUES
59The
60.Fn avl_update ,
61.Fn avl_update_lt
62and
63.Fn avl_update_gt
64functions return
65.Sy B_TRUE
66if it was necessary to relocate the node due its order having changed
67relative to its nearest neighbors and
68.Sy B_FALSE
69otherwise.
70.Sh EXAMPLES
71See the
72.Sy EXAMPLES
73section in
74.Xr libavl 3LIB .
75.Sh INTERFACE STABILITY
76.Sy Committed
77.Sh MT-Level
78See
79.Sx Locking
80in
81.Xr libavl 3LIB .
82.Sh SEE ALSO
83.Xr libavl 3LIB
84