move memory management code out as rculfhash-mm-order.c
[urcu.git] / urcu / rculfhash.h
index 6953ad12499b515819b73e56808106fdf55926e1..c03baf41a2b8405fda996ddb633a250a8bcdd89a 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdint.h>
 #include <urcu/compiler.h>
 #include <urcu-call-rcu.h>
+#include <urcu-flavor.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -94,6 +95,17 @@ 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;
+
 /*
  * _cds_lfht_new - API used by cds_lfht_new wrapper. Do not use directly.
  */
@@ -101,15 +113,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 +151,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);
 }
 
 /*
This page took 0.02262 seconds and 4 git commands to generate.