const-ify integer config values

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-09-14 14:54:35 -07:00
parent a052c2e450
commit dd01df7612
6 changed files with 25 additions and 11 deletions

View File

@ -170,7 +170,10 @@ int main(int argc, const char **argv)
}
dout(0) << "requesting oneshot_replay for mds" << r << dendl;
shadow = MDSMap::STATE_ONESHOT_REPLAY;
g_conf->mds_standby_for_rank = r;
char rb[32];
snprintf(rb, sizeof(rb), "%d", r);
g_conf->set_val("mds_standby_for_rank", rb);
g_conf->apply_changes(NULL);
}
else if (ceph_argparse_witharg(args, i, &val, "--hot-standby", (char*)NULL)) {
int r = parse_rank("hot-standby", val);
@ -180,7 +183,10 @@ int main(int argc, const char **argv)
}
dout(0) << "requesting standby_replay for mds" << r << dendl;
shadow = MDSMap::STATE_STANDBY_REPLAY;
g_conf->mds_standby_for_rank = r;
char rb[32];
snprintf(rb, sizeof(rb), "%d", r);
g_conf->set_val("mds_standby_for_rank", rb);
g_conf->apply_changes(NULL);
}
else {
derr << "Error: can't understand argument: " << *i << "\n" << dendl;

View File

@ -157,7 +157,7 @@ private:
public:
EntityName name;
#define OPTION_OPT_INT(name) int name;
#define OPTION_OPT_INT(name) const int name;
#define OPTION_OPT_LONGLONG(name) long long name;
#define OPTION_OPT_STR(name) std::string name;
#define OPTION_OPT_DOUBLE(name) double name;

View File

@ -6151,10 +6151,14 @@ void MDCache::shutdown_check()
dout(0) << "shutdown_check at " << ceph_clock_now(g_ceph_context) << dendl;
// cache
int o = g_conf->debug_mds;
g_conf->debug_mds = 10;
char old_val[32] = { 0 };
char *o = old_val;
g_conf->get_val("debug_mds", &o, sizeof(old_val));
g_conf->set_val("debug_mds", "10");
g_conf->apply_changes(NULL);
show_cache();
g_conf->debug_mds = o;
g_conf->set_val("debug_mds", old_val);
g_conf->apply_changes(NULL);
mds->timer.add_event_after(g_conf->mds_shutdown_check, new C_MDC_ShutdownCheck(this));
// this

View File

@ -32,7 +32,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);
cct->_conf->log_to_stderr = 1; // quiet by default
cct->_conf->set_val("log_to_stderr", "1"); // quiet by default
cct->_conf->parse_env(); // environment variables override
cct->_conf->apply_changes(NULL);

View File

@ -1501,9 +1501,12 @@ int RGWHandler::init(struct req_state *_s, FCGX_Request *fcgx)
RGWConf *conf = s->env->conf;
if (conf->log_level >= 0)
g_conf->rgw_log = conf->log_level;
if (conf->log_level >= 0) {
char buf[32];
snprintf(buf, sizeof(buf), "%d", conf->log_level);
g_conf->set_val("rgw_log", buf);
g_conf->apply_changes(NULL);
}
if (g_conf->rgw_log >= 20) {
char *p;
for (int i=0; (p = fcgx->envp[i]); ++i) {

View File

@ -527,7 +527,8 @@ int main(int argc, char **argv) {
global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
common_init_finish(g_ceph_context);
g_ceph_context->_conf->osd_journal_size = 400;
g_ceph_context->_conf->set_val("osd_journal_size", "400");
g_ceph_context->_conf->apply_changes(NULL);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();