1
1
This commit was SVN r27684.
Этот коммит содержится в:
Ralph Castain 2012-12-18 04:01:16 +00:00
родитель 0427a478b2
Коммит c5ba59ba67
6 изменённых файлов: 0 добавлений и 407 удалений

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

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

@ -1,38 +0,0 @@
#
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
db_dbase.h \
db_dbase_component.c \
db_dbase.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_db_dbase_DSO
component_noinst =
component_install = mca_db_dbase.la
else
component_noinst = libmca_db_dbase.la
component_install =
endif
mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_db_dbase_la_CPPFLAGS = $(db_dbase_CPPFLAGS)
mca_db_dbase_la_SOURCES = $(sources)
mca_db_dbase_la_LDFLAGS = -module -avoid-version $(db_dbase_LDFLAGS)
mca_db_dbase_la_LIBADD = $(db_dbase_LIBS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_db_dbase_la_CPPFLAGS = $(db_dbase_CPPFLAGS)
libmca_db_dbase_la_SOURCES =$(sources)
libmca_db_dbase_la_LDFLAGS = -module -avoid-version $(db_dbase_LDFLAGS)
libmca_db_dbase_la_LIBADD = $(db_dbase_LIBS)

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

@ -1,33 +0,0 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# MCA_db_dbase_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_orte_db_dbase_CONFIG], [
AC_CONFIG_FILES([orte/mca/db/dbase/Makefile])
# do not build if rte is disabled
AS_IF([test "$orte_without_full_support" = 0],
[OMPI_CHECK_PACKAGE([db_db],
[db.h],
[db],
[dbopen],
[],
[],
[],
[$1],
[$2])],
[$2])
AC_SUBST(db_dbase_CPPFLAGS)
AC_SUBST(db_dbase_LDFLAGS)
AC_SUBST(db_dbase_LIBS)
])dnl

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

@ -1,203 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "orte/constants.h"
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <stdio.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <db.h>
#include "opal/dss/dss_types.h"
#include "opal/util/os_dirpath.h"
#include "opal/util/os_path.h"
#include "opal/util/output.h"
#include "opal/util/malloc.h"
#include "opal/util/basename.h"
#include "opal/mca/pstat/base/base.h"
#include "opal/mca/paffinity/base/base.h"
#include "opal/mca/sysinfo/base/base.h"
#include "orte/util/show_help.h"
#include "orte/mca/errmgr/base/base.h"
#include "orte/runtime/orte_globals.h"
#include "db_dbase.h"
static int init(void);
static int finalize(void);
static int store(orte_process_name_t *proc, char *key, void *object, size_t size);
static int fetch(orte_process_name_t *proc,
char *key, void **object, size_t *size);
static int delete_data(orte_process_name_t *proc,char *key);
orte_db_base_module_t orte_db_dbase_module = {
init,
finalize,
store,
fetch,
delete_data
};
/* local variables */
static DB *save_dbase=NULL, *recover_dbase=NULL;
static int init(void)
{
char *path, *name;
/* setup the database */
if (ORTE_SUCCESS != opal_os_dirpath_create(orte_db_dbase_directory, S_IRWXU)) {
orte_show_help("help-db-dbase.txt", "cannot-create-dir", true,
orte_db_dbase_directory);
return ORTE_ERR_FILE_OPEN_FAILURE;
}
orte_util_convert_process_name_to_string(&name, ORTE_PROC_MY_NAME);
path = opal_os_path(false, orte_db_dbase_directory, name, NULL);
free(name);
if (NULL == (save_dbase = dbaseopen(path, O_CREAT | O_RDWR | O_TRUNC, S_IRWXU, DB_HASH, NULL))) {
orte_show_help("help-db-dbase.txt", "cannot-create-dbase", true, path);
free(path);
return ORTE_ERR_FILE_OPEN_FAILURE;
}
free(path);
return ORTE_SUCCESS;
}
static int finalize(void)
{
/* if we are normally terminating, remove the recovery file */
return ORTE_SUCCESS;
}
static int store(orte_process_name_t *proc, char *key, void *object, size_t size)
{
DBT key, data;
opal_buffer_t buf;
orte_job_t *jdata;
orte_proc_t *proc;
int rc=ORTE_SUCCESS, size;
/* construct the buffer we will use for packing the data */
OBJ_CONSTRUCT(&buf, opal_buffer_t);
key.data = inkey;
key.size = strlen(key.data);
switch (type) {
case ORTE_JOB:
jdata = (orte_job_t*)object;
opal_dss.pack(&buf, &jdata, 1, ORTE_JOB);
break;
case ORTE_PROC:
proc = (orte_proc_t*)object;
opal_dss.pack(&buf, &proc, 1, ORTE_PROC);
break;
default:
orte_show_help("help-db-dbase.txt", "unrecognized-type", true, type);
rc = ORTE_ERR_BAD_PARAM;
goto cleanup;
break;
}
/* unload the data */
opal_dss.unload(&buf, (void**)&data.data, &size);
data.size = size;
OBJ_DESTRUCT(&buf);
/* put the info into the dbase */
if (0 > save_dbase->put(save_dbase, &key, &data, 0)) {
orte_show_help("help-db-dbase.txt", "error-writing-dbase", true, (char*)key.data, strerror(errno));
rc = ORTE_ERR_FILE_WRITE_FAILURE;
}
/* sync it to force it to disk */
if (0 > save_dbase->sync(save_dbase, 0)) {
orte_show_help("help-db-dbase.txt", "error-syncing-dbase", true, (char*)key.data, strerror(errno));
rc = ORTE_ERR_FILE_WRITE_FAILURE;
}
cleanup:
/* cleanup */
if (NULL != key.data) {
free(key.data);
}
if (NULL != data.data) {
free(data.data);
}
return rc;
}
static int fetch(orte_process_name_t *proc,
char *key, void **object, size_t *size)
{
DBT key, data;
opal_buffer_t buf;
orte_job_t *jdata;
orte_proc_t *proc;
int rc=ORTE_SUCCESS;
int32_t n;
if (NULL == recover_dbase) {
orte_show_help("help-db-dbase.txt", "recover-source-undef", true);
rc = ORTE_ERR_NOT_FOUND;
}
/* construct the buffer we will use for unpacking the data */
OBJ_CONSTRUCT(&buf, opal_buffer_t);
key.data = inkey;
key.size = strlen(key.data);
/* get the specified data */
if (0 > recover_dbase->get(recover_dbase, &key, &data, 0)) {
orte_show_help("help-db-dbase.txt", "error-reading-dbase", true, (char*)key.data, strerror(errno));
rc = ORTE_ERR_FILE_READ_FAILURE;
goto cleanup;
}
/* populate the recovered info */
opal_dss.load(&buf, data.data, data.size);
switch (type) {
case ORTE_JOB:
n=1;
opal_dss.unpack(&buf, &jdata, &n, ORTE_JOB);
break;
case ORTE_PROC:
n=1;
opal_dss.unpack(&buf, &proc, &n, ORTE_PROC);
break;
default:
break;
}
cleanup:
OBJ_DESTRUCT(&buf);
return rc;
}
static int update(char *key, void *object, opal_data_type_t type)
{
return ORTE_ERR_NOT_IMPLEMENTED;
}
static int delete_data(char *key)
{
return ORTE_ERR_NOT_IMPLEMENTED;
}

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

@ -1,31 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_DB_DBASE_H
#define ORTE_DB_DBASE_H
#include "orte/mca/db/db.h"
BEGIN_C_DECLS
/*
* Module open / close
*/
int orte_db_dbase_component_open(void);
int orte_db_dbase_component_close(void);
int orte_db_dbase_component_query(mca_base_module_t **module, int *priority);
ORTE_MODULE_DECLSPEC extern orte_db_base_component_t mca_db_dbase_component;
ORTE_DECLSPEC extern orte_db_base_module_t orte_db_dbase_module;
extern char *orte_db_dbase_directory;
END_C_DECLS
#endif /* ORTE_DB_DBASE_H */

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

@ -1,102 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "orte/util/proc_info.h"
#include "orte/mca/db/db.h"
#include "orte/mca/db/base/base.h"
#include "db_dbase.h"
extern orte_db_base_module_t orte_db_dbase_module;
char *orte_db_dbase_directory;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_db_base_component_t mca_db_dbase_component = {
{
ORTE_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"dbase",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_db_dbase_component_open,
orte_db_dbase_component_close,
orte_db_dbase_component_query
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
int
orte_db_dbase_component_open(void)
{
return ORTE_SUCCESS;
}
int orte_db_dbase_component_query(mca_base_module_t **module, int *priority)
{
/* we are the file module - we need to be selected
* IFF we are requested
*/
bool is_required = false;
mca_base_component_t *c = &mca_db_dbase_component.base_version;
/* retrieve the name of the file to be used */
mca_base_param_reg_string(c, "dir",
"Name of directory to be used for storing and recovering db information",
false, false, NULL, &orte_db_dbase_directory);
mca_base_is_component_required(&orte_db_base_components_available,
&mca_db_dbase_component.base_version,
true,
&is_required);
if (is_required && NULL != orte_db_dbase_directory) {
*priority = 1000;
*module = (mca_base_module_t*)&orte_db_dbase_module;
return ORTE_SUCCESS;
}
*priority = 0;
*module = NULL;
return ORTE_ERROR;
}
int
orte_db_dbase_component_close(void)
{
return ORTE_SUCCESS;
}