From: Mathieu Desnoyers Date: Mon, 27 May 2013 18:59:01 +0000 (-0400) Subject: rcuja: Add missing header X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d553beef47f7dfb7e60af14a93e34f60940207ea;p=userspace-rcu.git rcuja: Add missing header Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/rcuja.h b/urcu/rcuja.h new file mode 100644 index 0000000..9a006a3 --- /dev/null +++ b/urcu/rcuja.h @@ -0,0 +1,84 @@ +#ifndef _URCU_RCUJA_H +#define _URCU_RCUJA_H + +/* + * urcu/rcuja.h + * + * Userspace RCU library - RCU Judy Array + * + * Copyright 2012 - Mathieu Desnoyers + * + * 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 + * + * Include this file _after_ including your URCU flavor. + */ + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct cds_ja_node { + /* Linked list of nodes with same key */ + struct cds_hlist_node list; + /* delayed reclaim */ + struct rcu_head head; +}; + +struct cds_ja; + +/* + * cds_ja_node_init - initialize a judy array node + * @node: the node to initialize. + * + * This function is kept to be eventually used for debugging purposes + * (detection of memory corruption). + */ +static inline +void cds_ja_node_init(struct cds_ja_node *node) +{ +} + +struct cds_hlist_head cds_ja_lookup(struct cds_ja *ja, uint64_t key); + +int cds_ja_add(struct cds_ja *ja, uint64_t key, + struct cds_ja_node *new_node); + +int cds_ja_del(struct cds_ja *ja, uint64_t key, + struct cds_ja_node *node); + +struct cds_ja *_cds_ja_new(unsigned int key_bits, + const struct rcu_flavor_struct *flavor); + +static inline +struct cds_ja *cds_ja_new(unsigned int key_bits) +{ + return _cds_ja_new(key_bits, &rcu_flavor); +} + +int cds_ja_destroy(struct cds_ja *ja, + void (*free_node_cb)(struct rcu_head *head)); + +#ifdef __cplusplus +} +#endif + +#endif /* _URCU_RCUJA_H */