Fix: rcuja merge fixes
[userspace-rcu.git] / rcuja / rcuja-range.c
index 863c960ad616eb5e114f37e366d7b13c92c8e107..26a0c2e97b50e8d58987913772c25d93a29cfc1e 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,
@@ -219,6 +217,14 @@ void cds_ja_range_unlock(struct cds_ja_range *range)
        pthread_mutex_unlock(&range->lock);
 }
 
+void cds_ja_range_get_values(const struct cds_ja_range *range,
+       uint64_t *start, uint64_t *end, void **priv)
+{
+       *start = range->start;
+       *end = range->end;
+       *priv = range->priv;
+}
+
 static
 struct cds_ja_range *range_create(
                uint64_t start,         /* inclusive */
@@ -270,7 +276,7 @@ int cds_ja_range_add(struct cds_ja *ja,
        unsigned int nr_ranges, i;
        int ret;
 
-       if (start > end || end == UINT64_MAX)
+       if (start > end || end == UINT64_MAX || end > ja->key_max)
                return -EINVAL;
 
 retry:
@@ -514,13 +520,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);
This page took 0.024294 seconds and 4 git commands to generate.