diff --git a/maestro/ofi.c b/maestro/ofi.c index 386cdf7baf8adf60b5df31cacde48aec6387d1b6..66e20d6863a0c9a3c99c3df6f6c92b3c5a57b27e 100644 --- a/maestro/ofi.c +++ b/maestro/ofi.c @@ -1975,44 +1975,54 @@ mstro_ofi__msg_context_destroy(mstro_ofi_msg_context ctx) return MSTRO_OK; } -/** Check the schema list provided from pm is compatible with the component schema list */ -/* compatible means that pm supports all of the schemas in the component schema list or more */ -/* FIXME check that the schema versions are compatible between the pm and the component */ -bool schema_list_compatible_p(const char * component_schema_list, const char * pm_schema_list) +/** Check the schema list provided from pm is compatible with the + * component schema list */ +/* compatible means that PM supports all of the schemas in the + * component schema list or more */ + +/* FIXME check that the schema versions are compatible between the PM + * and the component (= version check or better) */ +static +bool schema_list_compatible_p(char * component_schema_list, + const char * pm_schema_list) { char *schema_name; char *end_list_token; - if (component_schema_list == NULL) - { + if (component_schema_list == NULL) { /*nothing to look for here*/ //DEBUG("[schema_list_compatible_p] component schema list is NULL"); return true; - } - else if (pm_schema_list ==NULL) { + } else if (pm_schema_list ==NULL) { /*component_schema_list is not empty but pm_schema_list is empty ... we should look no further*/ //DEBUG("[schema_list_compatible_p] pm schema list is NULL"); return false; } + // split the schema names in the component_schema_list - schema_name = strtok_r(component_schema_list, SCHEMA_LIST_SEP, &end_list_token); - // for each schema name in the component_schema_list ...try to find it in the pm_schema_list - while( schema_name != NULL ) - { + schema_name = strtok_r(component_schema_list, + SCHEMA_LIST_SEP, + &end_list_token); + + // for each schema name in the component_schema_list ...try to find + // it in the pm_schema_list + while( schema_name != NULL ) { DEBUG("Looking for schema %s \n", schema_name); - /*if we did not find the component schema name in the pm_schema_list*/ + + /* if we did not find the component schema name in the pm_schema_list */ if(strstr(pm_schema_list, schema_name) == NULL) { - DEBUG("Schema %s not found in pm schema list\n", schema_name); + DEBUG("Schema %s not found in PM schema list\n", schema_name); return false; } DEBUG("Found schema %s in %s\n", schema_name, pm_schema_list); + // read the next schema name schema_name = strtok_r(NULL, SCHEMA_LIST_SEP, &end_list_token); } - /*We reach here only if all component schemas were found in the pm_schema_list*/ + /* We reach here only if all component schemas were found in the + * pm_schema_list*/ return true; - } /** select the best match between remote and local endpoints */ @@ -2163,8 +2173,8 @@ mstro_ofi__select_endpoint(struct mstro_endpoint_descriptor_ *remote, } DEBUG("PM schema list %s \n", g_pm_component_descriptor.schema_list); DEBUG("Component schema list %s \n", g_component_descriptor.schema_list); - if(!schema_list_compatible_p(g_component_descriptor.schema_list, g_pm_component_descriptor.schema_list)) - { + if(!schema_list_compatible_p(g_component_descriptor.schema_list, + g_pm_component_descriptor.schema_list)) { INFO("Component descriptor mismatch, PM does not support the schema list of component, skipping\n"); continue; }