1
1

Rename the module registry to be the module repository

This commit was SVN r927.
Этот коммит содержится в:
Jeff Squyres 2004-03-19 03:24:46 +00:00
родитель b195c85f60
Коммит 304400d32b
9 изменённых файлов: 69 добавлений и 68 удалений

Просмотреть файл

@ -25,7 +25,7 @@ libmca_base_la_SOURCES = \
mca_base_module_exchange.c \
mca_base_module_find.c \
mca_base_init_select_modules.c \
mca_base_module_registry.c \
mca_base_module_repository.c \
mca_base_modules_open.c \
mca_base_modules_close.c \
mca_base_open.c \

Просмотреть файл

@ -89,15 +89,16 @@ extern "C" {
/* mca_base_module_register.c */
int mca_base_module_registry_construct(void);
int mca_base_module_registry_retain(char *type, lt_dlhandle module_handle,
const mca_base_module_t *module_struct);
int mca_base_module_registry_link(const char *src_type,
const char *src_name,
const char *depend_type,
const char *depend_name);
void mca_base_module_registry_release(const mca_base_module_t *module);
void mca_base_module_registry_finalize(void);
int mca_base_module_repository_construct(void);
int mca_base_module_repository_retain(char *type,
lt_dlhandle module_handle,
const mca_base_module_t *module_struct);
int mca_base_module_repository_link(const char *src_type,
const char *src_name,
const char *depend_type,
const char *depend_name);
void mca_base_module_repository_release(const mca_base_module_t *module);
void mca_base_module_repository_finalize(void);
/* mca_base_modules_open.c */

Просмотреть файл

@ -20,9 +20,9 @@ int mca_base_close(void)
mca_base_param_finalize();
/* Close down the module registry */
/* Close down the module repository */
mca_base_module_registry_finalize();
mca_base_module_repository_finalize();
}
mca_base_opened = false;

Просмотреть файл

@ -392,20 +392,20 @@ static int open_module(module_file_item_t *target_file,
mitem->mli_module = module_struct;
lam_list_append(found_modules, (lam_list_item_t *) mitem);
mca_base_module_registry_retain(target_file->type, module_handle,
module_struct);
mca_base_module_repository_retain(target_file->type, module_handle,
module_struct);
/* Now that that's all done, link all the dependencies in to this
module's registry entry */
module's repository entry */
for (cur = lam_list_remove_first(&dependencies);
NULL != cur;
cur = lam_list_remove_first(&dependencies)) {
ditem = (dependency_item_t *) cur;
mca_base_module_registry_link(target_file->type,
target_file->name,
ditem->di_module_file_item->type,
ditem->di_module_file_item->name);
mca_base_module_repository_link(target_file->type,
target_file->name,
ditem->di_module_file_item->type,
ditem->di_module_file_item->name);
free(ditem);
}
OBJ_DESTRUCT(&dependencies);

Просмотреть файл

@ -21,7 +21,7 @@
/*
* Private types
*/
struct registry_item_t {
struct repository_item_t {
lam_list_item_t super;
char ri_type[MCA_BASE_MAX_TYPE_NAME_LEN];
@ -30,12 +30,12 @@ struct registry_item_t {
int ri_refcount;
lam_list_t ri_dependencies;
};
typedef struct registry_item_t registry_item_t;
typedef struct repository_item_t repository_item_t;
struct dependency_item_t {
lam_list_item_t super;
registry_item_t *di_registry_entry;
repository_item_t *di_repository_entry;
};
typedef struct dependency_item_t dependency_item_t;
@ -44,21 +44,21 @@ typedef struct dependency_item_t dependency_item_t;
* Private variables
*/
static bool initialized = false;
static lam_list_t registry;
static lam_list_t repository;
/*
* Private functions
*/
static registry_item_t *find_module(const char *type, const char *name);
static int link_items(registry_item_t *src, registry_item_t *depend);
static void release_registry_item(registry_item_t *ri);
static repository_item_t *find_module(const char *type, const char *name);
static int link_items(repository_item_t *src, repository_item_t *depend);
static void release_repository_item(repository_item_t *ri);
/*
* Initialize the registry
* Initialize the repository
*/
int mca_base_module_registry_construct(void)
int mca_base_module_repository_construct(void)
{
/* Setup internal structures */
@ -69,7 +69,7 @@ int mca_base_module_registry_construct(void)
if (lt_dlinit() != 0)
return LAM_ERR_OUT_OF_RESOURCE;
OBJ_CONSTRUCT(&registry, lam_list_t);
OBJ_CONSTRUCT(&repository, lam_list_t);
initialized = true;
}
@ -80,21 +80,21 @@ int mca_base_module_registry_construct(void)
/*
* Add a newly-opened dyanmic module to the registry of open modules.
* Add a newly-opened dyanmic module to the repository of open modules.
* The module's type, handle, and public struct are saved.
*/
int mca_base_module_registry_retain(char *type, lt_dlhandle module_handle,
int mca_base_module_repository_retain(char *type, lt_dlhandle module_handle,
const mca_base_module_t *module_struct)
{
registry_item_t *ri;
repository_item_t *ri;
/* Allocate a new registry item */
/* Allocate a new repository item */
ri = malloc(sizeof(registry_item_t));
ri = malloc(sizeof(repository_item_t));
if (NULL == ri)
return LAM_ERR_OUT_OF_RESOURCE;
/* Initialize the registry item */
/* Initialize the repository item */
OBJ_CONSTRUCT(ri, lam_list_item_t);
strcpy(ri->ri_type, type);
@ -103,9 +103,9 @@ int mca_base_module_registry_retain(char *type, lt_dlhandle module_handle,
ri->ri_refcount = 1;
OBJ_CONSTRUCT(&ri->ri_dependencies, lam_list_t);
/* Append the new item to the registry */
/* Append the new item to the repository */
lam_list_append(&registry, (lam_list_item_t *) ri);
lam_list_append(&repository, (lam_list_item_t *) ri);
/* All done */
@ -116,12 +116,12 @@ int mca_base_module_registry_retain(char *type, lt_dlhandle module_handle,
/*
* Create a dependency from one module entry to another
*/
int mca_base_module_registry_link(const char *src_type,
int mca_base_module_repository_link(const char *src_type,
const char *src_name,
const char *depend_type,
const char *depend_name)
{
registry_item_t *src, *depend;
repository_item_t *src, *depend;
/* Look up the two modules */
@ -140,24 +140,24 @@ int mca_base_module_registry_link(const char *src_type,
/*
* If it's in the registr, close a specified module and remove it from
* the registry.
* the repository.
*/
void mca_base_module_registry_release(const mca_base_module_t *module)
void mca_base_module_repository_release(const mca_base_module_t *module)
{
registry_item_t *ri = find_module(module->mca_type_name,
repository_item_t *ri = find_module(module->mca_type_name,
module->mca_module_name);
if (NULL != ri)
release_registry_item(ri);
release_repository_item(ri);
}
/*
* Finalize the registry -- close everything that's still open.
* Finalize the repository -- close everything that's still open.
*/
void mca_base_module_registry_finalize(void)
void mca_base_module_repository_finalize(void)
{
lam_list_item_t *item;
registry_item_t *ri;
repository_item_t *ri;
bool changed;
if (initialized) {
@ -177,17 +177,17 @@ void mca_base_module_registry_finalize(void)
do {
changed = false;
for (item = lam_list_get_first(&registry);
lam_list_get_end(&registry) != item && changed;
for (item = lam_list_get_first(&repository);
lam_list_get_end(&repository) != item && changed;
item = lam_list_get_next(item)) {
ri = (registry_item_t *) ri;
ri = (repository_item_t *) ri;
if (ri->ri_refcount == 1) {
release_registry_item(ri);
release_repository_item(ri);
changed = true;
}
}
} while (lam_list_get_size(&registry) > 0 && changed);
} while (lam_list_get_size(&repository) > 0 && changed);
/* Close down libltdl */
@ -197,15 +197,15 @@ void mca_base_module_registry_finalize(void)
}
static registry_item_t *find_module(const char *type, const char *name)
static repository_item_t *find_module(const char *type, const char *name)
{
lam_list_item_t *item;
registry_item_t *ri;
repository_item_t *ri;
for (item = lam_list_get_first(&registry);
lam_list_get_end(&registry) != item;
for (item = lam_list_get_first(&repository);
lam_list_get_end(&repository) != item;
item = lam_list_get_next(item)) {
ri = (registry_item_t *) ri;
ri = (repository_item_t *) ri;
if (0 == strcmp(ri->ri_type, type) &&
0 == strcmp(ri->ri_module_struct->mca_module_name, name))
return ri;
@ -217,7 +217,7 @@ static registry_item_t *find_module(const char *type, const char *name)
}
static int link_items(registry_item_t *src, registry_item_t *depend)
static int link_items(repository_item_t *src, repository_item_t *depend)
{
dependency_item_t *di;
@ -235,9 +235,9 @@ static int link_items(registry_item_t *src, registry_item_t *depend)
/* Initialize the new dependency item */
OBJ_CONSTRUCT((lam_list_item_t *) di, lam_list_item_t);
di->di_registry_entry = depend;
di->di_repository_entry = depend;
/* Add it to the dependency list on the source registry entry */
/* Add it to the dependency list on the source repository entry */
lam_list_append(&src->ri_dependencies, (lam_list_item_t *) di);
@ -251,7 +251,7 @@ static int link_items(registry_item_t *src, registry_item_t *depend)
}
static void release_registry_item(registry_item_t *ri)
static void release_repository_item(repository_item_t *ri)
{
dependency_item_t *di;
lam_list_item_t *item;
@ -274,7 +274,7 @@ static void release_registry_item(registry_item_t *ri)
NULL != item;
item = lam_list_remove_first(&ri->ri_dependencies)) {
di = (dependency_item_t *) item;
--di->di_registry_entry->ri_refcount;
--di->di_repository_entry->ri_refcount;
free(di);
}
@ -283,8 +283,8 @@ static void release_registry_item(registry_item_t *ri)
pointer is no longer valid because it has [potentially] been
unloaded from memory. So don't try to use it. :-) */
OBJ_DESTRUCT(&di->di_registry_entry->ri_dependencies);
lam_list_remove_item(&registry, (lam_list_item_t *) ri);
OBJ_DESTRUCT(&di->di_repository_entry->ri_dependencies);
lam_list_remove_item(&repository, (lam_list_item_t *) ri);
free(ri);
}
}

Просмотреть файл

@ -41,7 +41,7 @@ int mca_base_modules_close(int output_id, lam_list_t *modules_available,
/* Unload */
mca_base_module_registry_release((mca_base_module_t *) module);
mca_base_module_repository_release((mca_base_module_t *) module);
lam_output_verbose(10, output_id, "close: module %s unloaded",
module->mca_module_name);
}

Просмотреть файл

@ -231,7 +231,7 @@ static int open_modules(const char *type_name, int output_id,
module->mca_module_name);
called_open = false;
}
mca_base_module_registry_release(module);
mca_base_module_repository_release(module);
lam_output_verbose(10, output_id,
"open: module %s unloaded",
module->mca_module_name);

Просмотреть файл

@ -61,9 +61,9 @@ int mca_base_open(void)
lam_output_reopen(0, &lds);
lam_output_verbose(0, 5, " Opening");
/* Open up the module registry */
/* Open up the module repository */
return mca_base_module_registry_construct();
return mca_base_module_repository_construct();
}

Просмотреть файл

@ -233,7 +233,7 @@ int mca_base_param_find(const char *type_name, const char *module_name,
*
* @returns LAM_SUCCESS This function never fails.
*
* This function shuts down the MCA parameter registry and frees all
* This function shuts down the MCA parameter repository and frees all
* associated memory. No other mca_base_param*() functions can be
* invoked after this function.
*