From 80df03d8ecd1f83ad91401e3a82e941122eb9b0e Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Thu, 23 Jun 2011 13:31:50 -0700 Subject: [PATCH] push global_init_set_globals into preinit callers Signed-off-by: Colin McCabe --- src/common/common_init.cc | 4 ---- src/global/global_init.h | 7 ------- src/libceph.cc | 3 +++ src/librados.cc | 3 +++ src/rgw/librgw.cc | 3 +++ src/test/test_libcommon_build.cc | 1 - 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/common/common_init.cc b/src/common/common_init.cc index 63402c3a72936..f6a89fdea146b 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -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 diff --git a/src/global/global_init.h b/src/global/global_init.h index 68d07e20cb53c..af6034eea2c7f 100644 --- a/src/global/global_init.h +++ b/src/global/global_init.h @@ -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 diff --git a/src/libceph.cc b/src/libceph.cc index 91913c3f94ddc..f1cec734eeedc 100644 --- a/src/libceph.cc +++ b/src/libceph.cc @@ -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); diff --git a/src/librados.cc b/src/librados.cc index ba4034eba29b7..66b8f4659af97 100644 --- a/src/librados.cc +++ b/src/librados.cc @@ -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(); diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index 0ec6331cfe8aa..6d48b1c7666fe 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -25,6 +25,8 @@ #include #include +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(); diff --git a/src/test/test_libcommon_build.cc b/src/test/test_libcommon_build.cc index b86a996d165ca..e373d3af6a69f 100644 --- a/src/test/test_libcommon_build.cc +++ b/src/test/test_libcommon_build.cc @@ -2,7 +2,6 @@ void global_init_set_globals(CephContext *cct) { - // do nothing } /* This program exists to test that we can build libcommon without -- 2.39.5