push global_init_set_globals into preinit callers

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-06-23 13:31:50 -07:00
parent 116241ef10
commit 80df03d8ec
6 changed files with 9 additions and 12 deletions

View File

@ -31,8 +31,6 @@
#define _STR(x) #x
#define STRINGIFY(x) _STR(x)
void global_init_set_globals(CephContext *cct);
CephContext *common_preinit(const CephInitParameters &iparams,
enum code_environment_t code_env, int flags)
{
@ -42,8 +40,6 @@ CephContext *common_preinit(const CephInitParameters &iparams,
// Create a configuration object
CephContext *cct = new CephContext(iparams.module_type);
global_init_set_globals(cct); // TODO: fix #845
md_config_t *conf = cct->_conf;
// add config observers here

View File

@ -56,11 +56,4 @@ void global_init_chdir(const CephContext *cct);
*/
int global_init_shutdown_stderr(CephContext *cct);
/*
* NOTE: you probably don't need to use this function. Use global_init instead!
*
* Explicitly set up the process globals: g_ceph_context, g_conf, and _doss.
*/
void global_init_set_globals(CephContext *cct);
#endif

View File

@ -220,6 +220,8 @@ extern "C" int ceph_create_with_context(struct ceph_mount_info **cmount, CephCon
return 0;
}
void global_init_set_globals(CephContext *cct); // FIXME: bug #845
extern "C" int ceph_create(struct ceph_mount_info **cmount, const char * const id)
{
CephInitParameters iparams(CEPH_ENTITY_TYPE_CLIENT, CEPH_CONF_FILE_DEFAULT);
@ -229,6 +231,7 @@ extern "C" int ceph_create(struct ceph_mount_info **cmount, const char * const i
}
CephContext *cct = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
global_init_set_globals(cct); // FIXME: bug #845
cct->_conf->parse_env(); // environment variables coverride
cct->_conf->apply_changes();
return ceph_create_with_context(cmount, cct);

View File

@ -3130,6 +3130,8 @@ librados::ObjectOperation::~ObjectOperation()
}
void global_init_set_globals(CephContext *cct);
///////////////////////////// C API //////////////////////////////
extern "C" int rados_create(rados_t *pcluster, const char * const id)
{
@ -3140,6 +3142,7 @@ extern "C" int rados_create(rados_t *pcluster, const char * const id)
}
CephContext *cct = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
global_init_set_globals(cct); // FIXME: bug #845
cct->_conf->parse_env(); // environment variables override
cct->_conf->apply_changes();

View File

@ -25,6 +25,8 @@
#include <sstream>
#include <string.h>
void global_init_set_globals(CephContext *cct);
int librgw_create(librgw_t *rgw, const char * const id)
{
CephInitParameters iparams(CEPH_ENTITY_TYPE_CLIENT, CEPH_CONF_FILE_DEFAULT);
@ -33,6 +35,7 @@ int librgw_create(librgw_t *rgw, const char * const id)
iparams.name.set(CEPH_ENTITY_TYPE_CLIENT, id);
}
CephContext *cct = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
global_init_set_globals(cct); // FIXME: bug #845
cct->_conf->log_to_stderr = 1; // quiet by default
cct->_conf->parse_env(); // environment variables override
cct->_conf->apply_changes();

View File

@ -2,7 +2,6 @@
void global_init_set_globals(CephContext *cct)
{
// do nothing
}
/* This program exists to test that we can build libcommon without