1
1
openmpi/opal/mca/if/base/if_base_components.c
Nathan Hjelm 365cf48db5 Update OPAL frameworks to use the MCA framework system.
This commit was SVN r28239.
2013-03-27 21:11:47 +00:00

76 строки
2.5 KiB
C

/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"
#include "opal/mca/if/if.h"
#include "opal/mca/if/base/base.h"
#include "opal/mca/if/base/static-components.h"
/* instantiate the global list of interfaces */
opal_list_t opal_if_list;
bool opal_if_do_not_resolve = false;
bool opal_if_retain_loopback = false;
/* instance the opal_if_t object */
OBJ_CLASS_INSTANCE(opal_if_t, opal_list_item_t, NULL, NULL);
static int opal_if_base_register (mca_base_register_flag_t flags);
static int opal_if_base_open (mca_base_open_flag_t flags);
static int opal_if_base_close(void);
MCA_BASE_FRAMEWORK_DECLARE(opal, if, NULL, opal_if_base_register, opal_if_base_open, opal_if_base_close,
mca_if_base_static_components, 0);
static int opal_if_base_register (mca_base_register_flag_t flags)
{
opal_if_do_not_resolve = false;
(void) mca_base_framework_var_register (&opal_if_base_framework, "do_not_resolve",
"If nonzero, do not attempt to resolve interfaces",
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ,
&opal_if_do_not_resolve);
opal_if_retain_loopback = false;
(void) mca_base_framework_var_register (&opal_if_base_framework, "retain_loopback",
"If nonzero, retain loopback interfaces",
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ,
&opal_if_retain_loopback);
return OPAL_SUCCESS;
}
static int opal_if_base_open (mca_base_open_flag_t flags)
{
/* setup the global list */
OBJ_CONSTRUCT(&opal_if_list, opal_list_t);
return mca_base_framework_components_open (&opal_if_base_framework, flags);
}
static int opal_if_base_close(void)
{
opal_list_item_t *item;
while (NULL != (item = opal_list_remove_first(&opal_if_list))) {
OBJ_RELEASE(item);
}
OBJ_DESTRUCT(&opal_if_list);
return mca_base_framework_components_close (&opal_if_base_framework, NULL);
}