Fold common_set_defaults into common_init

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-02-23 05:50:10 -08:00
parent 5f73086852
commit 0f90d1564e
26 changed files with 17 additions and 41 deletions

View File

@ -53,7 +53,6 @@ int main(int argc, const char **argv)
env_to_vec(args);
DEFINE_CONF_VARS(usage);
common_set_defaults(false);
common_init(args, "cauthtool", STARTUP_FLAG_FORCE_FG_LOGGING);
const char *me = argv[0];

View File

@ -150,7 +150,6 @@ int main(int argc, const char **argv)
}
}
common_set_defaults(false);
common_init(nargs, type, STARTUP_FLAG_FORCE_FG_LOGGING);
if (do_help) {

View File

@ -53,8 +53,8 @@ int main(int argc, const char **argv, const char *envp[]) {
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
g_conf.daemonize = true;
g_conf.pid_file = 0;
g_conf.log_per_instance = true;
common_init(args, "cfuse", STARTUP_FLAG_INIT_KEYS);

View File

@ -65,7 +65,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(true);
#ifdef HAVE_LIBTCMALLOC
g_conf.profiler_start = HeapProfilerStart;
g_conf.profiler_running = IsHeapProfilerRunning;
@ -73,7 +72,7 @@ int main(int argc, const char **argv)
g_conf.profiler_dump = HeapProfilerDump;
g_conf.tcmalloc_have = true;
#endif //HAVE_LIBTCMALLOC
common_init(args, "mds", STARTUP_FLAG_INIT_KEYS);
common_init(args, "mds", STARTUP_FLAG_INIT_KEYS | STARTUP_FLAG_DAEMON);
// mds specific args
int shadow = 0;

View File

@ -61,8 +61,7 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(true);
common_init(args, "mon", STARTUP_FLAG_INIT_KEYS);
common_init(args, "mon", STARTUP_FLAG_INIT_KEYS | STARTUP_FLAG_DAEMON);
FOR_EACH_ARG(args) {
if (CONF_ARG_EQ("mkfs", '\0')) {

View File

@ -54,18 +54,6 @@ void set_foreground_logging()
g_conf.log_to_file = false;
}
void common_set_defaults(bool daemon)
{
if (daemon) {
cout << TEXT_YELLOW << " ** WARNING: Ceph is still under heavy development, and is only suitable for **" << TEXT_NORMAL << std::endl;
cout << TEXT_YELLOW << " ** testing and review. Do not trust it with important data. **" << TEXT_NORMAL << std::endl;
g_conf.daemonize = true;
} else {
g_conf.pid_file = 0;
}
}
static void keyring_init(const char *filesearch)
{
const char *filename = filesearch;
@ -121,6 +109,18 @@ static void keyring_init(const char *filesearch)
void common_init(std::vector<const char*>& args, const char *module_type, int flags)
{
bool force_fg_logging = false;
if (flags & STARTUP_FLAG_DAEMON) {
cout << TEXT_YELLOW << " ** WARNING: Ceph is still under heavy development, "
<< "and is only suitable for **" << TEXT_NORMAL << std::endl;
cout << TEXT_YELLOW << " ** testing and review. Do not trust it "
<< "with important data. **" << TEXT_NORMAL << std::endl;
g_conf.daemonize = true;
}
else {
g_conf.pid_file = 0;
}
parse_startup_config_options(args, module_type, flags, &force_fg_logging);
if (g_conf.log_to_syslog || g_conf.clog_to_syslog) {

View File

@ -6,9 +6,9 @@
enum {
STARTUP_FLAG_INIT_KEYS = 0x01,
STARTUP_FLAG_FORCE_FG_LOGGING = 0x02,
STARTUP_FLAG_DAEMON = 0x04,
};
void common_set_defaults(bool daemon);
void common_init(std::vector<const char*>& args,
const char *module_type,
int flags);

View File

@ -52,7 +52,7 @@ int main(int argc, const char **argv)
vector<const char*> args;
argv_to_vec(argc, argv, args);
env_to_vec(args);
int startup_flags = STARTUP_FLAG_INIT_KEYS;
int startup_flags = STARTUP_FLAG_INIT_KEYS | STARTUP_FLAG_DAEMON;
vector<const char *>::iterator args_iter;
for (args_iter = args.begin(); args_iter != args.end(); ++args_iter) {
@ -62,7 +62,6 @@ int main(int argc, const char **argv)
}
}
common_set_defaults(true);
#ifdef HAVE_LIBTCMALLOC
g_conf.profiler_start = HeapProfilerStart;
g_conf.profiler_running = IsHeapProfilerRunning;

View File

@ -46,7 +46,6 @@ int main(int argc, const char **argv, char *envp[])
vector<const char*> args;
argv_to_vec(argc, argv, args);
common_set_defaults(false);
common_init(args, "csyn",
STARTUP_FLAG_INIT_KEYS | STARTUP_FLAG_FORCE_FG_LOGGING);

View File

@ -81,7 +81,6 @@ int main(int argc, const char **argv, const char *envp[])
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "dumpjournal", STARTUP_FLAG_FORCE_FG_LOGGING);
vec_to_argv(args, argc, argv);

View File

@ -88,7 +88,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "dumpstore", STARTUP_FLAG_FORCE_FG_LOGGING);
// args

View File

@ -43,7 +43,6 @@ extern "C" int ceph_initialize(int argc, const char **argv)
//create everything to start a client
vector<const char*> args;
argv_to_vec(argc, argv, args);
common_set_defaults(false);
common_init(args, "libceph", STARTUP_FLAG_INIT_KEYS);
//monmap
monclient = new MonClient();

View File

@ -57,7 +57,6 @@ int main(int argc, const char **argv)
++i;
}
common_set_defaults(false);
common_init(args, "librados-config", STARTUP_FLAG_FORCE_FG_LOGGING);
FOR_EACH_ARG(args) {

View File

@ -1824,7 +1824,6 @@ int Rados::initialize(int argc, const char *argv[])
argv_to_vec(argc, argv, args);
env_to_vec(args);
}
common_set_defaults(false);
common_init(args, "librados", STARTUP_FLAG_INIT_KEYS);
return 0;
@ -2361,7 +2360,6 @@ extern "C" int rados_create(rados_t *pcluster)
vector<const char*> args;
env_to_vec(args);
common_set_defaults(false);
common_init(args, "librados", STARTUP_FLAG_INIT_KEYS);
++rados_initialized;

View File

@ -49,7 +49,6 @@ int main(int argc, const char **argv)
env_to_vec(args);
DEFINE_CONF_VARS(usage);
common_set_defaults(false);
common_init(args, "osdmaptool", STARTUP_FLAG_FORCE_FG_LOGGING);
const char *me = argv[0];

View File

@ -97,7 +97,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "rados",
STARTUP_FLAG_FORCE_FG_LOGGING | STARTUP_FLAG_INIT_KEYS);

View File

@ -576,7 +576,6 @@ int main(int argc, const char **argv)
env_to_vec(args);
int opt_cmd = OPT_NO_CMD;
common_set_defaults(false);
common_init(args, "rbd",
STARTUP_FLAG_FORCE_FG_LOGGING | STARTUP_FLAG_INIT_KEYS);

View File

@ -83,7 +83,6 @@ int main(int argc, char **argv)
argv_to_vec(argc, (const char **)argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "rgw",
STARTUP_FLAG_FORCE_FG_LOGGING | STARTUP_FLAG_INIT_KEYS);

View File

@ -97,7 +97,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, NULL,
STARTUP_FLAG_FORCE_FG_LOGGING | STARTUP_FLAG_INIT_KEYS);

View File

@ -36,7 +36,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "ceph", STARTUP_FLAG_FORCE_FG_LOGGING);
DoutStreambuf<char> *dos = new DoutStreambuf<char>();

View File

@ -94,7 +94,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "TestSignalHandlers", STARTUP_FLAG_FORCE_FG_LOGGING);
DEFINE_CONF_VARS(usage);

View File

@ -255,7 +255,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "ceph", STARTUP_FLAG_FORCE_FG_LOGGING);
int ret;

View File

@ -36,7 +36,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, NULL, STARTUP_FLAG_FORCE_FG_LOGGING);
// args

View File

@ -70,7 +70,6 @@ int main(int argc, const char **argv, const char *envp[]) {
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, NULL, STARTUP_FLAG_FORCE_FG_LOGGING);
vec_to_argv(args, argc, argv);

View File

@ -114,7 +114,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "ceph",
STARTUP_FLAG_INIT_KEYS | STARTUP_FLAG_FORCE_FG_LOGGING);

View File

@ -75,7 +75,6 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_set_defaults(false);
common_init(args, "cephtool",
STARTUP_FLAG_FORCE_FG_LOGGING | STARTUP_FLAG_INIT_KEYS);