Remove stale component
This commit was SVN r27683.
Этот коммит содержится в:
родитель
82f1ba0ea8
Коммит
0427a478b2
@ -1,38 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
sources = \
|
||||
db_dbm.h \
|
||||
db_dbm_component.c \
|
||||
db_dbm.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_dbm_DSO
|
||||
component_noinst =
|
||||
component_install = mca_db_dbm.la
|
||||
else
|
||||
component_noinst = libmca_db_dbm.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(pkglibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_db_dbm_la_CPPFLAGS = $(db_dbm_CPPFLAGS)
|
||||
mca_db_dbm_la_SOURCES = $(sources)
|
||||
mca_db_dbm_la_LDFLAGS = -module -avoid-version $(db_dbm_LDFLAGS)
|
||||
mca_db_dbm_la_LIBADD = $(db_dbm_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_db_dbm_la_CPPFLAGS = $(db_dbm_CPPFLAGS)
|
||||
libmca_db_dbm_la_SOURCES =$(sources)
|
||||
libmca_db_dbm_la_LDFLAGS = -module -avoid-version $(db_dbm_LDFLAGS)
|
||||
libmca_db_dbm_la_LIBADD = $(db_dbm_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_dbm_CONFIG([action-if-found], [action-if-not-found])
|
||||
# -----------------------------------------------------------
|
||||
AC_DEFUN([MCA_orte_db_dbm_CONFIG], [
|
||||
AC_CONFIG_FILES([orte/mca/db/dbm/Makefile])
|
||||
|
||||
# do not build if rte is disabled
|
||||
AS_IF([test "$orte_without_full_support" = 0],
|
||||
[OMPI_CHECK_PACKAGE([db_dbm],
|
||||
[ndbm.h],
|
||||
[dbm],
|
||||
[dbm_open],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[$1],
|
||||
[$2])],
|
||||
[$2])
|
||||
|
||||
AC_SUBST(db_dbm_CPPFLAGS)
|
||||
AC_SUBST(db_dbm_LDFLAGS)
|
||||
AC_SUBST(db_dbm_LIBS)
|
||||
])dnl
|
@ -1,221 +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 <ndbm.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 "orte/util/show_help.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
#include "db_dbm.h"
|
||||
|
||||
static int init(void);
|
||||
static int finalize(void);
|
||||
static int insert(char *key, void *object, opal_data_type_t type);
|
||||
static int set_recover_source(orte_process_name_t *name);
|
||||
static int select_data(char *key, void *object, opal_data_type_t type);
|
||||
static int update(char *key, void *object, opal_data_type_t type);
|
||||
static int delete_data(char *key);
|
||||
|
||||
orte_db_base_module_t orte_db_dbm_module = {
|
||||
init,
|
||||
finalize,
|
||||
insert,
|
||||
set_recover_source,
|
||||
select_data,
|
||||
update,
|
||||
delete_data
|
||||
};
|
||||
|
||||
/* local variables */
|
||||
static DBM *save_dbm=NULL, *recover_dbm=NULL;
|
||||
|
||||
static int init(void)
|
||||
{
|
||||
char *path, *name;
|
||||
|
||||
/* setup the database */
|
||||
if (ORTE_SUCCESS != opal_os_dirpath_create(orte_db_dbm_directory, S_IRWXU)) {
|
||||
orte_show_help("help-db-dbm.txt", "cannot-create-dir", true,
|
||||
orte_db_dbm_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_dbm_directory, name, NULL);
|
||||
free(name);
|
||||
if (NULL == (save_dbm = dbm_open(path, O_CREAT | O_RDWR | O_TRUNC, S_IRWXU))) {
|
||||
orte_show_help("help-db-dbm.txt", "cannot-create-dbm", 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 insert(char *inkey, void *object, opal_data_type_t type)
|
||||
{
|
||||
datum 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.dptr = inkey;
|
||||
key.dsize = strlen(key.dptr);
|
||||
data.dptr = NULL;
|
||||
|
||||
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-db.txt", "unrecognized-type", true, type);
|
||||
rc = ORTE_ERR_BAD_PARAM;
|
||||
goto cleanup;
|
||||
break;
|
||||
}
|
||||
|
||||
/* unload the data */
|
||||
opal_dss.unload(&buf, (void**)&data.dptr, &size);
|
||||
data.dsize = size;
|
||||
OBJ_DESTRUCT(&buf);
|
||||
|
||||
/* put the info into the dbm */
|
||||
if (0 > dbm_store(save_dbm, key, data, DBM_REPLACE)) {
|
||||
orte_show_help("help-db-dbm.txt", "error-writing-dbm", true, (char*)key.dptr, strerror(errno));
|
||||
rc = ORTE_ERR_FILE_WRITE_FAILURE;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
/* cleanup */
|
||||
if (NULL != key.dptr) {
|
||||
free(key.dptr);
|
||||
}
|
||||
if (NULL != data.dptr) {
|
||||
free(data.dptr);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int set_recover_source(orte_process_name_t *name)
|
||||
{
|
||||
char *path, *pname;
|
||||
int rc=ORTE_SUCCESS;
|
||||
|
||||
/* setup the database */
|
||||
orte_util_convert_process_name_to_string(&pname, name);
|
||||
path = opal_os_path(false, orte_db_dbm_directory, pname, NULL);
|
||||
free(pname);
|
||||
if (NULL == (recover_dbm = dbm_open(path, O_RDONLY, S_IRWXU))) {
|
||||
orte_show_help("help-db-dbm.txt", "cannot-open-dbm", true, path);
|
||||
free(path);
|
||||
return ORTE_ERR_FILE_OPEN_FAILURE;
|
||||
}
|
||||
free(path);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int select_data(char *inkey, void *object, opal_data_type_t type)
|
||||
{
|
||||
datum key, data;
|
||||
opal_buffer_t buf;
|
||||
orte_job_t *jdata;
|
||||
orte_proc_t *proc;
|
||||
int rc=ORTE_SUCCESS;
|
||||
int32_t n;
|
||||
|
||||
if (NULL == recover_dbm) {
|
||||
orte_show_help("help-db-dbm.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.dptr = inkey;
|
||||
key.dsize = strlen(key.dptr);
|
||||
data.dptr = NULL;
|
||||
|
||||
/* get the specified data */
|
||||
data = dbm_fetch(recover_dbm, key);
|
||||
if (NULL == data.dptr) {
|
||||
orte_show_help("help-db-dbm.txt", "error-reading-dbm", true, (char*)key.dptr, strerror(errno));
|
||||
rc = ORTE_ERR_FILE_READ_FAILURE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* populate the recovered info */
|
||||
opal_dss.load(&buf, data.dptr, data.dsize);
|
||||
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_DBM_H
|
||||
#define ORTE_DB_DBM_H
|
||||
|
||||
#include "orte/mca/db/db.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* Module open / close
|
||||
*/
|
||||
int orte_db_dbm_component_open(void);
|
||||
int orte_db_dbm_component_close(void);
|
||||
int orte_db_dbm_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
|
||||
ORTE_MODULE_DECLSPEC extern orte_db_base_component_t mca_db_dbm_component;
|
||||
ORTE_DECLSPEC extern orte_db_base_module_t orte_db_dbm_module;
|
||||
extern char *orte_db_dbm_directory;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* ORTE_DB_DBM_H */
|
@ -1,92 +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_dbm.h"
|
||||
|
||||
extern orte_db_base_module_t orte_db_dbm_module;
|
||||
char *orte_db_dbm_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_dbm_component = {
|
||||
{
|
||||
ORTE_DB_BASE_VERSION_1_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
"dbm",
|
||||
ORTE_MAJOR_VERSION,
|
||||
ORTE_MINOR_VERSION,
|
||||
ORTE_RELEASE_VERSION,
|
||||
|
||||
/* Component open and close functions */
|
||||
orte_db_dbm_component_open,
|
||||
orte_db_dbm_component_close,
|
||||
orte_db_dbm_component_query
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
orte_db_dbm_component_open(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int orte_db_dbm_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
mca_base_component_t *c = &mca_db_dbm_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_dbm_directory);
|
||||
|
||||
if (NULL != orte_db_dbm_directory) {
|
||||
*priority = 50;
|
||||
*module = (mca_base_module_t*)&orte_db_dbm_module;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
*priority = 0;
|
||||
*module = NULL;
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
orte_db_dbm_component_close(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user