rcuja: add shadow nodes hash table
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 12 Aug 2012 19:08:00 +0000 (15:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 14 May 2013 14:20:23 +0000 (16:20 +0200)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile.am
rcuja/rcuja-shadow-nodes.c [new file with mode: 0644]
rcuja/rcuja.c

index df170f3719fe82257ff9052cf34d1bbc2ad06220..8c552ce10ae61c0f4dea4f46fb69fd79e8baedb3 100644 (file)
@@ -45,7 +45,7 @@ endif
 RCULFHASH = rculfhash.c rculfhash-mm-order.c rculfhash-mm-chunk.c \
                rculfhash-mm-mmap.c
 
-RCUJA = rcuja/rcuja.c
+RCUJA = rcuja/rcuja.c rcuja/rcuja-shadow-nodes.c
 
 lib_LTLIBRARIES = liburcu-common.la \
                liburcu.la liburcu-qsbr.la \
@@ -75,9 +75,11 @@ liburcu_signal_la_LIBADD = liburcu-common.la
 liburcu_bp_la_SOURCES = urcu-bp.c urcu-pointer.c $(COMPAT)
 liburcu_bp_la_LIBADD = liburcu-common.la
 
+# liburcu-cds depends on liburcu for the judy array hash table
+# (internally used).
 liburcu_cds_la_SOURCES = rculfqueue.c rculfstack.c lfstack.c \
        $(RCULFHASH) $(RCUJA) $(COMPAT)
-liburcu_cds_la_LIBADD = liburcu-common.la
+liburcu_cds_la_LIBADD = liburcu-common.la liburcu.la
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = liburcu-cds.pc liburcu.pc liburcu-bp.pc liburcu-qsbr.pc \
diff --git a/rcuja/rcuja-shadow-nodes.c b/rcuja/rcuja-shadow-nodes.c
new file mode 100644 (file)
index 0000000..6094b7a
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * rcuja/rcuja-hashtable.c
+ *
+ * Userspace RCU library - RCU Judy Array Shadow Node Hash Table
+ *
+ * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define _LGPL_SOURCE
+#include <stdint.h>
+#include <errno.h>
+#include <limits.h>
+
+/*
+ * The hash table used by judy array updates only for the shadow node
+ * mapping rely on standard urcu_mb flavor. It does not put any
+ * requirement on the RCU flavor used by applications using the judy
+ * array.
+ */
+#include <urcu.h>
+
+#include <urcu/rcuja.h>
+#include <urcu/compiler.h>
+#include <urcu/arch.h>
+#include <assert.h>
+#include <urcu-pointer.h>
+
+#include "rcuja-internal.h"
+#include "bitfield.h"
+
+__attribute__((visibility("protected")))
+struct cds_lfht *rcuja_create_ht(void)
+{
+       return cds_lfht_new(1, 1, 0,
+               CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
+               NULL);
+}
+
+__attribute__((visibility("protected")))
+void rcuja_delete_ht(struct cds_lfht *ht)
+{
+       int ret;
+
+       ret = cds_lfht_destroy(ht, NULL);
+       assert(!ret);
+}
index 6d815e2009d76916bc0491d9cee1f7fc03a3d1b7..4b90aa62b7ffb56f5e7659c21df4b4bdc234d643 100644 (file)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#define _LGPL_SOURCE
 #include <stdint.h>
 #include <errno.h>
 #include <limits.h>
This page took 0.026797 seconds and 4 git commands to generate.