rcuja: add shadow nodes hash table
[userspace-rcu.git] / rcuja / rcuja-shadow-nodes.c
1 /*
2 * rcuja/rcuja-hashtable.c
3 *
4 * Userspace RCU library - RCU Judy Array Shadow Node Hash Table
5 *
6 * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #define _LGPL_SOURCE
24 #include <stdint.h>
25 #include <errno.h>
26 #include <limits.h>
27
28 /*
29 * The hash table used by judy array updates only for the shadow node
30 * mapping rely on standard urcu_mb flavor. It does not put any
31 * requirement on the RCU flavor used by applications using the judy
32 * array.
33 */
34 #include <urcu.h>
35
36 #include <urcu/rcuja.h>
37 #include <urcu/compiler.h>
38 #include <urcu/arch.h>
39 #include <assert.h>
40 #include <urcu-pointer.h>
41
42 #include "rcuja-internal.h"
43 #include "bitfield.h"
44
45 __attribute__((visibility("protected")))
46 struct cds_lfht *rcuja_create_ht(void)
47 {
48 return cds_lfht_new(1, 1, 0,
49 CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
50 NULL);
51 }
52
53 __attribute__((visibility("protected")))
54 void rcuja_delete_ht(struct cds_lfht *ht)
55 {
56 int ret;
57
58 ret = cds_lfht_destroy(ht, NULL);
59 assert(!ret);
60 }
This page took 0.034751 seconds and 5 git commands to generate.