int mca_base_components_filter (const char *framework_name, opal_list_t *components, int output_id, const char *filter_names, uint32_t filter_flags) { mca_base_component_list_item_t *cli, *next; char **requested_component_names = NULL; bool include_mode, can_use; int ret; assert (NULL != components); if (0 == filter_flags && NULL == filter_names) { return OPAL_SUCCESS; } ret = mca_base_component_parse_requested (filter_names, &include_mode, &requested_component_names); if (OPAL_SUCCESS != ret) { return ret; } OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) { const mca_base_component_t *component = cli->cli_component; mca_base_open_only_dummy_component_t *dummy = (mca_base_open_only_dummy_component_t *) cli->cli_component; can_use = use_component (include_mode, (const char **) requested_component_names, cli->cli_component->mca_component_name); if (!can_use || (filter_flags & dummy->data.param_field) != filter_flags) { if (can_use && (filter_flags & MCA_BASE_METADATA_PARAM_CHECKPOINT) && !(MCA_BASE_METADATA_PARAM_CHECKPOINT & dummy->data.param_field)) { opal_output_verbose(10, output_id, "mca: base: components_filter: " "(%s) Component %s is *NOT* Checkpointable - Disabled", component->reserved, component->mca_component_name); } opal_list_remove_item (components, &cli->super); mca_base_component_unload (component, output_id); OBJ_RELEASE(cli); } else if (filter_flags & MCA_BASE_METADATA_PARAM_CHECKPOINT) { opal_output_verbose(10, output_id, "mca: base: components_filter: " "(%s) Component %s is Checkpointable", component->reserved, component->mca_component_name); } } if (include_mode) { ret = component_find_check (framework_name, requested_component_names, components); } else { ret = OPAL_SUCCESS; } if (NULL != requested_component_names) { opal_argv_free (requested_component_names); } return ret; }
/* * Function to find as many components of a given type as possible. This * includes statically-linked in components as well as opening up a * directory and looking for shared-library MCA components of the * appropriate type (load them if available). * * Return one consolidated array of (pmix_mca_base_component_t*) pointing to all * available components. */ int pmix_mca_base_component_find (const char *directory, pmix_mca_base_framework_t *framework, bool ignore_requested, bool open_dso_components) { const pmix_mca_base_component_t **static_components = framework->framework_static_components; char **requested_component_names = NULL; pmix_mca_base_component_list_item_t *cli; bool include_mode = true; int ret; pmix_output_verbose (PMIX_MCA_BASE_VERBOSE_COMPONENT, framework->framework_output, "mca: base: component_find: searching %s for %s components", directory, framework->framework_name); if (!ignore_requested) { ret = pmix_mca_base_component_parse_requested (framework->framework_selection, &include_mode, &requested_component_names); if (PMIX_SUCCESS != ret) { return ret; } } /* Find all the components that were statically linked in */ if (static_components) { for (int i = 0 ; NULL != static_components[i]; ++i) { if ( use_component(include_mode, (const char**)requested_component_names, static_components[i]->pmix_mca_component_name) ) { cli = PMIX_NEW(pmix_mca_base_component_list_item_t); if (NULL == cli) { ret = PMIX_ERR_OUT_OF_RESOURCE; goto component_find_out; } cli->cli_component = static_components[i]; pmix_list_append(&framework->framework_components, (pmix_list_item_t *) cli); } } } #if PMIX_HAVE_PDL_SUPPORT /* Find any available dynamic components in the specified directory */ if (open_dso_components && !pmix_mca_base_component_disable_dlopen) { find_dyn_components(directory, framework, (const char**)requested_component_names, include_mode); } else { pmix_output_verbose (PMIX_MCA_BASE_VERBOSE_INFO, 0, "pmix:mca: base: component_find: dso loading for %s MCA components disabled", framework->framework_name); } #endif if (include_mode) { ret = component_find_check (framework, requested_component_names); } else { ret = PMIX_SUCCESS; } component_find_out: if (NULL != requested_component_names) { pmix_argv_free(requested_component_names); } /* All done */ return ret; }
/* * Function to find as many components of a given type as possible. This * includes statically-linked in components as well as opening up a * directory and looking for shared-library MCA components of the * appropriate type (load them if available). * * Return one consolidated array of (mca_base_component_t*) pointing to all * available components. */ int mca_base_component_find(const char *directory, const char *type, const mca_base_component_t *static_components[], const char *requested_components, opal_list_t *found_components, bool open_dso_components) { char **requested_component_names = NULL; mca_base_component_list_item_t *cli; bool include_mode; int i, ret; ret = mca_base_component_parse_requested (requested_components, &include_mode, &requested_component_names); if (OPAL_SUCCESS != ret) { return ret; } /* Find all the components that were statically linked in */ OBJ_CONSTRUCT(found_components, opal_list_t); for (i = 0; NULL != static_components && NULL != static_components[i]; ++i) { if ( use_component(include_mode, (const char**)requested_component_names, static_components[i]->mca_component_name) ) { cli = OBJ_NEW(mca_base_component_list_item_t); if (NULL == cli) { ret = OPAL_ERR_OUT_OF_RESOURCE; goto component_find_out; } cli->cli_component = static_components[i]; opal_list_append(found_components, (opal_list_item_t *) cli); } } #if OPAL_WANT_LIBLTDL /* Find any available dynamic components in the specified directory */ if (open_dso_components && !mca_base_component_disable_dlopen) { find_dyn_components(directory, type, (const char**)requested_component_names, include_mode, found_components); } else { opal_output_verbose(40, 0, "mca: base: component_find: dso loading for %s MCA components disabled", type); } #endif if (include_mode) { ret = component_find_check (type, requested_component_names, found_components); } else { ret = OPAL_SUCCESS; } ret = OPAL_SUCCESS; component_find_out: if (NULL != requested_component_names) { opal_argv_free(requested_component_names); } /* All done */ return ret; }
int pmix_mca_base_components_filter (pmix_mca_base_framework_t *framework, uint32_t filter_flags) { pmix_list_t *components = &framework->framework_components; int output_id = framework->framework_output; pmix_mca_base_component_list_item_t *cli, *next; char **requested_component_names = NULL; bool include_mode, can_use; int ret; assert (NULL != components); if (0 == filter_flags && NULL == framework->framework_selection) { return PMIX_SUCCESS; } ret = pmix_mca_base_component_parse_requested (framework->framework_selection, &include_mode, &requested_component_names); if (PMIX_SUCCESS != ret) { return ret; } PMIX_LIST_FOREACH_SAFE(cli, next, components, pmix_mca_base_component_list_item_t) { const pmix_mca_base_component_t *component = cli->cli_component; pmix_mca_base_open_only_dummy_component_t *dummy = (pmix_mca_base_open_only_dummy_component_t *) cli->cli_component; can_use = use_component(include_mode, (const char **) requested_component_names, cli->cli_component->pmix_mca_component_name); if (!can_use || (filter_flags & dummy->data.param_field) != filter_flags) { if (can_use && (filter_flags & PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT) && !(PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT & dummy->data.param_field)) { pmix_output_verbose(PMIX_MCA_BASE_VERBOSE_COMPONENT, output_id, "pmix:mca: base: components_filter: " "(%s) Component %s is *NOT* Checkpointable - Disabled", component->reserved, component->pmix_mca_component_name); } pmix_list_remove_item(components, &cli->super); pmix_mca_base_component_unload(component, output_id); PMIX_RELEASE(cli); } else if (filter_flags & PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT) { pmix_output_verbose(PMIX_MCA_BASE_VERBOSE_COMPONENT, output_id, "pmix:mca: base: components_filter: " "(%s) Component %s is Checkpointable", component->reserved, component->pmix_mca_component_name); } } if (include_mode) { ret = component_find_check(framework, requested_component_names); } else { ret = PMIX_SUCCESS; } if (NULL != requested_component_names) { pmix_argv_free(requested_component_names); } return ret; }