urcu_sys/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
mod bindings {
    #![allow(warnings)]
    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}

pub use bindings::{
    rcu_flavor_struct as RcuFlavorApi,
    rcu_head as RcuHead,
    urcu_atfork as RcuAtFork,
    urcu_gp_poll_state as RcuPollState,
};

pub use bindings::{
    rcu_cmpxchg_pointer_sym as rcu_cmpxchg_pointer,
    rcu_dereference_sym as rcu_dereference,
    rcu_set_pointer_sym as rcu_set_pointer,
    rcu_xchg_pointer_sym as rcu_xchg_pointer,
};

pub mod lfht {
    pub use crate::bindings::{
        cds_lfht as HashTable,
        cds_lfht_iter as HashTableIterator,
        cds_lfht_mm_type as HashTableMemoryManagement,
        cds_lfht_node as HashTableNode,
    };

    pub use crate::bindings::{
        cds_lfht_add as add,
        cds_lfht_add_replace as add_replace,
        cds_lfht_add_unique as add_unique,
        cds_lfht_count_nodes as count_nodes,
        cds_lfht_del as del,
        cds_lfht_destroy as destroy,
        cds_lfht_first as first,
        cds_lfht_is_node_deleted as is_node_deleted,
        cds_lfht_iter_get_node as iter_get_node,
        cds_lfht_lookup as lookup,
        cds_lfht_new as new,
        cds_lfht_new_flavor as new_flavor,
        cds_lfht_next as next,
        cds_lfht_next_duplicate as next_duplicate,
        cds_lfht_node_init as node_init,
        cds_lfht_node_init_deleted as node_init_deleted,
        cds_lfht_replace as replace,
        cds_lfht_resize as resize,
    };

    pub use crate::bindings::{
        cds_lfht_mm_chunk as MEMORY_MANAGEMENT_CHUNK,
        cds_lfht_mm_mmap as MEMORY_MANAGEMENT_MMAP,
        cds_lfht_mm_order as MEMORY_MANAGEMENT_ORDER,
        CDS_LFHT_ACCOUNTING as ACCOUNTING,
        CDS_LFHT_AUTO_RESIZE as AUTO_RESIZE,
    };
}

pub mod list {
    pub use crate::bindings::cds_list_head as ListHead;

    pub use crate::bindings::{
        cds_list_add as add,
        cds_list_add_rcu as add_rcu,
        cds_list_add_tail as add_tail,
        cds_list_add_tail_rcu as add_tail_rcu,
        cds_list_del as del,
        cds_list_del_init as del_init,
        cds_list_del_rcu as del_rcu,
        cds_list_empty as empty,
        cds_list_move as r#move,
        cds_list_replace as replace,
        cds_list_replace_init as replace_init,
        cds_list_replace_rcu as replace_rcu,
        cds_list_splice as splice,
    };
}

pub mod wfcq {
    pub use crate::bindings::cds_wfcq_node as QueueNode;
}

pub mod lfq {
    pub use crate::bindings::{cds_lfq_node_rcu as QueueNode, cds_lfq_queue_rcu as Queue};

    pub use crate::bindings::{
        cds_lfq_dequeue_rcu as dequeue,
        cds_lfq_destroy_rcu as destroy,
        cds_lfq_enqueue_rcu as enqueue,
        cds_lfq_init_rcu as init,
        cds_lfq_node_init_rcu as node_init,
    };
}

pub mod lfs {
    pub use crate::bindings::{
        __cds_lfs_stack as Stack,
        cds_lfs_head as StackHead,
        cds_lfs_node as StackNode,
        cds_lfs_stack as StackLock,
        cds_lfs_stack_ptr_t as StackPtr,
    };

    pub use crate::bindings::{
        __cds_lfs_init as init,
        __cds_lfs_pop as pop,
        __cds_lfs_pop_all as pop_all,
        cds_lfs_destroy as destroy,
        cds_lfs_empty as empty,
        cds_lfs_init as init_lock,
        cds_lfs_node_init as node_init,
        cds_lfs_pop_all_blocking as pop_all_blocking,
        cds_lfs_pop_blocking as pop_blocking,
        cds_lfs_pop_lock as pop_lock,
        cds_lfs_pop_unlock as pop_unlock,
        cds_lfs_push as push,
    };
}

/*************/
/* rculfhash */
/*************/

// #define cds_lfht_for_each(ht, iter, node)				\
// 	for (cds_lfht_first(ht, iter),					\
// 			node = cds_lfht_iter_get_node(iter);		\
// 		node != NULL;						\
// 		cds_lfht_next(ht, iter),				\
// 			node = cds_lfht_iter_get_node(iter))

// #define cds_lfht_for_each_duplicate(ht, hash, match, key, iter, node)	\
// 	for (cds_lfht_lookup(ht, hash, match, key, iter),		\
// 			node = cds_lfht_iter_get_node(iter);		\
// 		node != NULL;						\
// 		cds_lfht_next_duplicate(ht, match, key, iter),		\
// 			node = cds_lfht_iter_get_node(iter))

// #define cds_lfht_for_each_entry(ht, iter, pos, member)			\
// 	for (cds_lfht_first(ht, iter),					\
// 			pos = caa_container_of(cds_lfht_iter_get_node(iter), \
// 					__typeof__(*(pos)), member);	\
// 		cds_lfht_iter_get_node(iter) != NULL;			\
// 		cds_lfht_next(ht, iter),				\
// 			pos = caa_container_of(cds_lfht_iter_get_node(iter), \
// 					__typeof__(*(pos)), member))

// #define cds_lfht_for_each_entry_duplicate(ht, hash, match, key,		\
// 				iter, pos, member)			\
// 	for (cds_lfht_lookup(ht, hash, match, key, iter),		\
// 			pos = caa_container_of(cds_lfht_iter_get_node(iter), \
// 					__typeof__(*(pos)), member);	\
// 		cds_lfht_iter_get_node(iter) != NULL;			\
// 		cds_lfht_next_duplicate(ht, match, key, iter),		\
// 			pos = caa_container_of(cds_lfht_iter_get_node(iter), \
// 					__typeof__(*(pos)), member))