+
+/**
+ * Initializes addition dummy resource allocator.
+ *
+ * This is intended for the use in automatic tests which need to work
+ * with multiple resources. The test can initialize several dummy
+ * resources, not just the default one with id 255.
+ *
+ * @param id
+ *
+ * @return Zero on success, non-zero error code on error.
+ */
+int fra_dummy_init_and_activate_id(frsh_resource_id_t res_id)
+{
+ struct fres_allocator *fra;
+ int ret;
+ fres_block_register_dummy();
+ fra = malloc(sizeof(*fra));
+ if (!fra)
+ goto err;
+ *fra = dummy_allocator;
+ fra->res_id = res_id;
+ fra->priv = malloc(sizeof(int));
+ ret = fra_register(fra);
+ if (ret)
+ goto err;
+ ret = fra_activate(fra->res_type, fra->res_id);
+ return ret;
+err:
+ return -1;
+}