rcuja-range: allow variable number of bits for key
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 11 Jun 2013 12:38:26 +0000 (08:38 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 11 Jun 2013 12:38:26 +0000 (08:38 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rcuja/rcuja-range.c
tests/test_urcu_ja_range.c
urcu/rcuja-range.h

index 863c960ad616eb5e114f37e366d7b13c92c8e107..72a7609e11badfca7b7313fca71617497d3f3a17 100644 (file)
@@ -136,8 +136,6 @@ do {                                                                \
 } while (0)
 #endif
 
-#define CDS_JA_RANGE_KEY_BITS  64
-
 enum cds_ja_range_type {
        CDS_JA_RANGE_ALLOCATED,
        CDS_JA_RANGE_FREE,
@@ -514,13 +512,14 @@ unlock_error:
        return ret;
 }
 
-struct cds_ja *_cds_ja_range_new(const struct rcu_flavor_struct *flavor)
+struct cds_ja *_cds_ja_range_new(unsigned int key_bits,
+               const struct rcu_flavor_struct *flavor)
 {
        struct cds_ja_range *range;
        struct cds_ja *ja;
        int ret;
 
-       ja = _cds_ja_new(CDS_JA_RANGE_KEY_BITS, flavor);
+       ja = _cds_ja_new(key_bits, flavor);
        if (!ja)
                return NULL;
        range = range_create(0, UINT64_MAX - 1, NULL, CDS_JA_RANGE_FREE);
index 898adafc126a74b7cf9a4d26b668ef7d4cdb62b1..12abcc51465b64a7124fb3e48a2150e225e145af 100644 (file)
@@ -405,8 +405,9 @@ int do_mt_test(void)
        count_reader = malloc(sizeof(*count_reader) * nr_readers);
        count_writer = malloc(sizeof(*count_writer) * nr_writers);
 
-       printf("Allocating Judy Array for ranges\n");
-       test_ja = cds_ja_range_new();
+       printf("Allocating %u-bit Judy Array for ranges\n",
+               key_bits);
+       test_ja = cds_ja_range_new(key_bits);
        if (!test_ja) {
                printf("Error allocating judy array.\n");
                ret = -1;
index 3a22a5b092a7e389b1ff9b15f18ffc64d738fb93..05ba08aa17264adf5f0960b97db427022e074b1a 100644 (file)
@@ -45,12 +45,13 @@ int cds_ja_range_add(struct cds_ja *ja,
 
 int cds_ja_range_del(struct cds_ja *ja, struct cds_ja_range *range);
 
-struct cds_ja *_cds_ja_range_new(const struct rcu_flavor_struct *flavor);
+struct cds_ja *_cds_ja_range_new(unsigned int key_bits,
+               const struct rcu_flavor_struct *flavor);
 
 static inline
-struct cds_ja *cds_ja_range_new(void)
+struct cds_ja *cds_ja_range_new(unsigned int key_bits)
 {
-       return _cds_ja_range_new(&rcu_flavor);
+       return _cds_ja_range_new(key_bits, &rcu_flavor);
 }
 
 int cds_ja_range_destroy(struct cds_ja *ja,
This page took 0.027649 seconds and 4 git commands to generate.