return 0;
}
-int CrushCompiler::decompile_ids(int *ids,
+int CrushCompiler::decompile_ids(__s32 *ids,
__u32 size,
ostream &out)
{
return -1;
}
arg->ids_size = size;
- arg->ids = (int *)calloc(arg->ids_size, sizeof(int));
+ arg->ids = (__s32 *)calloc(arg->ids_size, sizeof(__s32));
__u32 pos = 0;
for (iter_t p = i->children.begin() + 2; pos < size; p++, pos++)
arg->ids[pos] = int_node(*p);
weight_set->size = new_size;
}
if (arg->ids_size) {
- arg->ids = (int*)realloc(arg->ids, new_size * sizeof(int));
+ arg->ids = (__s32 *)realloc(arg->ids, new_size * sizeof(__s32));
assert(arg->ids_size + 1 == new_size);
arg->ids[arg->ids_size] = item;
arg->ids_size = new_size;
assert(arg->ids_size - 1 == new_size);
for (__u32 k = position; k < new_size; k++)
arg->ids[k] = arg->ids[k+1];
- arg->ids = (int*)realloc(arg->ids, new_size * sizeof(int));
+ arg->ids = (__s32 *)realloc(arg->ids, new_size * sizeof(__s32));
arg->ids_size = new_size;
}
}
::decode(weight_set->weights[l], blp);
}
::decode(arg->ids_size, blp);
- arg->ids = (int*)calloc(arg->ids_size, sizeof(int));
+ arg->ids = (__s32 *)calloc(arg->ids_size, sizeof(__s32));
for (__u32 k = 0; k < arg->ids_size; k++)
::decode(arg->ids[k], blp);
}
int size = (sizeof(struct crush_choose_arg) * map->max_buckets +
sizeof(struct crush_weight_set) * bucket_count * num_positions +
sizeof(__u32) * sum_bucket_size * num_positions + // weights
- sizeof(__u32) * sum_bucket_size); // ids
+ sizeof(__s32) * sum_bucket_size); // ids
char *space = malloc(size);
struct crush_choose_arg *arg = (struct crush_choose_arg *)space;
struct crush_weight_set *weight_set = (struct crush_weight_set *)(arg + map->max_buckets);
__u32 *weights = (__u32 *)(weight_set + bucket_count * num_positions);
char *weight_set_ends = (char*)weights;
- int *ids = (int *)(weights + sum_bucket_size * num_positions);
+ __s32 *ids = (__s32 *)(weights + sum_bucket_size * num_positions);
char *weights_end = (char *)ids;
char *ids_end = (char *)(ids + sum_bucket_size);
BUG_ON(space + size != ids_end);
arg[b].weight_set_size = num_positions;
weight_set += position;
- memcpy(ids, bucket->h.items, sizeof(int) * bucket->h.size);
+ memcpy(ids, bucket->h.items, sizeof(__s32) * bucket->h.size);
arg[b].ids = ids;
arg[b].ids_size = bucket->h.size;
ids += bucket->h.size;
*
*/
struct crush_choose_arg {
- int *ids; /*!< values to use instead of items */
+ __s32 *ids; /*!< values to use instead of items */
__u32 ids_size; /*!< size of the __ids__ array */
struct crush_weight_set *weight_set; /*!< weight replacements for a given position */
__u32 weight_set_size; /*!< size of the __weight_set__ array */
return arg->weight_set[position].weights;
}
-static inline int *get_choose_arg_ids(const struct crush_bucket_straw2 *bucket,
- const struct crush_choose_arg *arg)
+static inline __s32 *get_choose_arg_ids(const struct crush_bucket_straw2 *bucket,
+ const struct crush_choose_arg *arg)
{
if ((arg == NULL) || (arg->ids == NULL))
return bucket->h.items;
unsigned int u;
__s64 ln, draw, high_draw = 0;
__u32 *weights = get_choose_arg_weights(bucket, arg, position);
- int *ids = get_choose_arg_ids(bucket, arg);
+ __s32 *ids = get_choose_arg_ids(bucket, arg);
for (i = 0; i < bucket->h.size; i++) {
dprintk("weight 0x%x item %d\n", weights[i], ids[i]);
if (weights[i]) {