]> git.saurik.com Git - apple/xnu.git/blame - osfmk/ipc/ipc_splay.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / osfmk / ipc / ipc_splay.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
ff6e181a
A
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.
1c79356b 12 *
ff6e181a
A
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
1c79356b
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
ff6e181a
A
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.
1c79356b
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * @OSF_COPYRIGHT@
25 */
26/*
27 * Mach Operating System
28 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
29 * All Rights Reserved.
30 *
31 * Permission to use, copy, modify and distribute this software and its
32 * documentation is hereby granted, provided that both the copyright
33 * notice and this permission notice appear in all copies of the
34 * software, derivative works or modified versions, and any portions
35 * thereof, and that both notices appear in supporting documentation.
36 *
37 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
38 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
39 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 *
41 * Carnegie Mellon requests users of this software to return to
42 *
43 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
44 * School of Computer Science
45 * Carnegie Mellon University
46 * Pittsburgh PA 15213-3890
47 *
48 * any improvements or extensions that they make and grant Carnegie Mellon
49 * the rights to redistribute these changes.
50 */
51/*
52 */
53/*
54 * File: ipc/ipc_splay.h
55 * Author: Rich Draves
56 * Date: 1989
57 *
58 * Declarations of primitive splay tree operations.
59 */
60
61#ifndef _IPC_IPC_SPLAY_H_
62#define _IPC_IPC_SPLAY_H_
63
64#include <mach/port.h>
65#include <kern/assert.h>
66#include <kern/macro_help.h>
67#include <ipc/ipc_entry.h>
68
69typedef struct ipc_splay_tree {
70 mach_port_name_t ist_name; /* name used in last lookup */
71 ipc_tree_entry_t ist_root; /* root of middle tree */
72 ipc_tree_entry_t ist_ltree; /* root of left tree */
73 ipc_tree_entry_t *ist_ltreep; /* pointer into left tree */
74 ipc_tree_entry_t ist_rtree; /* root of right tree */
75 ipc_tree_entry_t *ist_rtreep; /* pointer into right tree */
76} *ipc_splay_tree_t;
77
78#define ist_lock(splay) /* no locking */
79#define ist_unlock(splay) /* no locking */
80
81/* Initialize a raw splay tree */
82extern void ipc_splay_tree_init(
83 ipc_splay_tree_t splay);
84
85/* Pick a random entry in a splay tree */
86extern boolean_t ipc_splay_tree_pick(
87 ipc_splay_tree_t splay,
88 mach_port_name_t *namep,
89 ipc_tree_entry_t *entryp);
90
91/* Find an entry in a splay tree */
92extern ipc_tree_entry_t ipc_splay_tree_lookup(
93 ipc_splay_tree_t splay,
94 mach_port_name_t name);
95
96/* Insert a new entry into a splay tree */
97extern void ipc_splay_tree_insert(
98 ipc_splay_tree_t splay,
99 mach_port_name_t name,
100 ipc_tree_entry_t entry);
101
102/* Delete an entry from a splay tree */
103extern void ipc_splay_tree_delete(
104 ipc_splay_tree_t splay,
105 mach_port_name_t name,
106 ipc_tree_entry_t entry);
107
108/* Split a splay tree */
109extern void ipc_splay_tree_split(
110 ipc_splay_tree_t splay,
111 mach_port_name_t name,
112 ipc_splay_tree_t entry);
113
114/* Join two splay trees */
115extern void ipc_splay_tree_join(
116 ipc_splay_tree_t splay,
117 ipc_splay_tree_t small);
118
119/* Do a bounded splay tree lookup */
120extern void ipc_splay_tree_bounds(
121 ipc_splay_tree_t splay,
122 mach_port_name_t name,
123 mach_port_name_t *lowerp,
124 mach_port_name_t *upperp);
125
126/* Initialize a symmetric order traversal of a splay tree */
127extern ipc_tree_entry_t ipc_splay_traverse_start(
128 ipc_splay_tree_t splay);
129
130/* Return the next entry in a symmetric order traversal of a splay tree */
131extern ipc_tree_entry_t ipc_splay_traverse_next(
132 ipc_splay_tree_t splay,
133 boolean_t delete);
134
135/* Terminate a symmetric order traversal of a splay tree */
136extern void ipc_splay_traverse_finish(
137 ipc_splay_tree_t splay);
138
139#endif /* _IPC_IPC_SPLAY_H_ */