X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Frculfhash.h;h=6ed7c8c75b1db697d78fe4c5c8efaef5601176ae;hp=6953ad12499b515819b73e56808106fdf55926e1;hb=b0b5525153fce8abae07b9573da1d5169e02eb2b;hpb=747d725c1dd45d5072e0e411642c4d5c6403b4be diff --git a/urcu/rculfhash.h b/urcu/rculfhash.h index 6953ad1..6ed7c8c 100644 --- a/urcu/rculfhash.h +++ b/urcu/rculfhash.h @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -94,6 +95,19 @@ enum { CDS_LFHT_ACCOUNTING = (1U << 1), }; +struct cds_lfht_mm_type { + struct cds_lfht *(*alloc_cds_lfht)(unsigned long min_nr_alloc_buckets, + unsigned long max_nr_buckets); + void (*alloc_bucket_table)(struct cds_lfht *ht, unsigned long order); + void (*free_bucket_table)(struct cds_lfht *ht, unsigned long order); + struct cds_lfht_node *(*bucket_at)(struct cds_lfht *ht, + unsigned long index); +}; + +extern const struct cds_lfht_mm_type cds_lfht_mm_order; +extern const struct cds_lfht_mm_type cds_lfht_mm_chunk; +extern const struct cds_lfht_mm_type cds_lfht_mm_mmap; + /* * _cds_lfht_new - API used by cds_lfht_new wrapper. Do not use directly. */ @@ -101,15 +115,8 @@ struct cds_lfht *_cds_lfht_new(unsigned long init_size, unsigned long min_nr_alloc_buckets, unsigned long max_nr_buckets, int flags, - void (*cds_lfht_call_rcu)(struct rcu_head *head, - void (*func)(struct rcu_head *head)), - void (*cds_lfht_synchronize_rcu)(void), - void (*cds_lfht_rcu_read_lock)(void), - void (*cds_lfht_rcu_read_unlock)(void), - void (*cds_lfht_rcu_thread_offline)(void), - void (*cds_lfht_rcu_thread_online)(void), - void (*cds_lfht_rcu_register_thread)(void), - void (*cds_lfht_rcu_unregister_thread)(void), + const struct cds_lfht_mm_type *mm, + const struct rcu_flavor_struct *flavor, pthread_attr_t *attr); /* @@ -146,11 +153,8 @@ struct cds_lfht *cds_lfht_new(unsigned long init_size, int flags, pthread_attr_t *attr) { - return _cds_lfht_new(init_size, min_nr_alloc_buckets, max_nr_buckets, flags, - call_rcu, synchronize_rcu, rcu_read_lock, - rcu_read_unlock, rcu_thread_offline, - rcu_thread_online, rcu_register_thread, - rcu_unregister_thread, attr); + return _cds_lfht_new(init_size, min_nr_alloc_buckets, max_nr_buckets, + flags, &cds_lfht_mm_order, &rcu_flavor, attr); } /*