Commit 380ebe45 authored by Philip Carns's avatar Philip Carns
Browse files

walk target list per backend

parent e29153c0
......@@ -74,4 +74,10 @@ static const int json_type_int64 = json_type_int;
#define CONFIG_HAS(__config, __key, __out) \
((__out = json_object_object_get(__config, __key)) != NULL)
#define json_array_foreach(__array, __index, __element) \
for (__index = 0; \
__index < json_object_array_length(__array) \
&& (__element = json_object_array_get_idx(__array, __index)); \
__index++)
#endif /* __BAKE_MACROS */
......@@ -1061,14 +1061,33 @@ static int configure_targets(bake_provider_t provider,
struct json_object* _config)
{
struct json_object* val;
struct json_object* targets;
struct json_object* _target;
unsigned i = 0;
if (CONFIG_HAS(_config, "file_backend", val)) {
BAKE_TRACE(provider->mid, "checking file_backend object in json");
if (CONFIG_HAS(val, "targets", targets)) {
json_array_foreach(targets, i, _target)
{
BAKE_TRACE(provider->mid, "target: %s",
json_object_get_string(_target));
}
}
/* TODO: walk target list and try to attach or create */
}
if (CONFIG_HAS(_config, "pmem_backend", val)) {
BAKE_TRACE(provider->mid, "checking pmem_backend object in json");
if (CONFIG_HAS(val, "targets", targets)) {
json_array_foreach(targets, i, _target)
{
BAKE_TRACE(provider->mid, "target: %s",
json_object_get_string(_target));
}
}
/* TODO: walk target list and try to attach or create */
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment