XenevaOS
Loading...
Searching...
No Matches
rbtree_types.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2#ifndef _LINUX_RBTREE_TYPES_H
3#define _LINUX_RBTREE_TYPES_H
4
5#include <stdint.h>
6
7/*
8 * DCL delta -- `uintptr_t`, not mainline's `unsigned long`.
9 *
10 * This field is not a number: it is the parent pointer with the color bit
11 * folded into its bottom two bits, read back by rb_parent() and __rb_color().
12 * Its width therefore has to be pointer width. mainline gets that from
13 * `unsigned long` being 64-bit on arm64; this target is
14 * aarch64-unknown-windows, which is LLP64 (verified: sizeof(long) == 4), so
15 * `unsigned long` keeps the parent address's low 32 bits and every node
16 * above the 4 GB mark would walk to a parent in the low 4 GB that nothing
17 * maps -- the same narrowing serial_core.c's two address lines have, arriving
18 * through a struct field this time. The writers
19 * that fill the field are in rbtree.h and rbtree_augmented.h.
20 */
21struct rb_node {
25} __attribute__((aligned(sizeof(long))));
26/* The alignment might seem pointless, but allegedly CRIS needs it */
27
33
34struct rb_root {
36};
37
38/*
39 * Leftmost-cached rbtrees.
40 *
41 * We do not cache the rightmost node based on footprint
42 * size vs number of potential users that could benefit
43 * from O(1) rb_last(). Just not worth it, users that want
44 * this feature can always implement the logic explicitly.
45 * Furthermore, users that want to cache both pointers may
46 * find it a bit asymmetric, but that's ok.
47 */
52
53/*
54 * Leftmost tree with links. This would allow a trivial rb_rightmost update,
55 * but that has been omitted due to the lack of users.
56 */
61
62#define RB_ROOT (struct rb_root) { NULL, }
63#define RB_ROOT_CACHED (struct rb_root_cached) { {NULL, }, NULL }
64#define RB_ROOT_LINKED (struct rb_root_linked) { {NULL, }, NULL }
65
66#endif
unsigned int uintptr_t
Definition stdint.h:94
struct rb_node_linked __attribute__
Definition rbtree_types.h:28
struct rb_node node
Definition rbtree_types.h:29
struct rb_node_linked * prev
Definition rbtree_types.h:30
struct rb_node_linked * next
Definition rbtree_types.h:31
Definition rbtree_types.h:21
struct rb_node * rb_left
Definition rbtree_types.h:24
uintptr_t __rb_parent_color
Definition rbtree_types.h:22
struct rb_node * rb_right
Definition rbtree_types.h:23
Definition rbtree_types.h:48
struct rb_node * rb_leftmost
Definition rbtree_types.h:50
Definition rbtree_types.h:57
struct rb_node_linked * rb_leftmost
Definition rbtree_types.h:59
Definition rbtree_types.h:34
struct rb_node * rb_node
Definition rbtree_types.h:35