mirror of
https://github.com/ceph/ceph
synced 2025-02-19 17:08:05 +00:00
added a common initialization function
This commit is contained in:
parent
3ce47d046a
commit
c511d68dea
@ -192,6 +192,7 @@ libcommon_a_SOURCES = \
|
||||
osd/OSDMap.cc \
|
||||
mds/MDSMap.cc \
|
||||
common/tls.cc \
|
||||
common/common_init.cc \
|
||||
config.cc
|
||||
|
||||
libcrush_a_SOURCES = \
|
||||
@ -278,6 +279,7 @@ noinst_HEADERS = \
|
||||
common/lockdep.h\
|
||||
common/BackTrace.h\
|
||||
common/Clock.h\
|
||||
common/common_init.h\
|
||||
common/Cond.h\
|
||||
common/ConfUtils.h\
|
||||
common/DecayCounter.h\
|
||||
@ -290,6 +292,7 @@ noinst_HEADERS = \
|
||||
common/Thread.h\
|
||||
common/ThreadPool.h\
|
||||
common/Timer.h\
|
||||
common/tls.h\
|
||||
common/WorkQueue.h\
|
||||
common/LogClient.h\
|
||||
config.h\
|
||||
|
@ -26,6 +26,7 @@ using namespace std;
|
||||
#include "messages/MMonCommandAck.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#ifndef DARWIN
|
||||
#include <envz.h>
|
||||
@ -521,7 +522,7 @@ int main(int argc, const char **argv, const char *envp[]) {
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
vec_to_argv(args, argc, argv);
|
||||
|
||||
|
@ -28,6 +28,7 @@ using namespace std;
|
||||
#include "mon/MonClient.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#ifndef DARWIN
|
||||
#include <envz.h>
|
||||
@ -43,7 +44,7 @@ int main(int argc, const char **argv, const char *envp[]) {
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
// args for fuse
|
||||
vec_to_argv(args, argc, argv);
|
||||
|
@ -29,6 +29,7 @@ using namespace std;
|
||||
#include "msg/SimpleMessenger.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#include "mon/MonClient.h"
|
||||
|
||||
@ -37,7 +38,7 @@ int main(int argc, const char **argv)
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
// mds specific args
|
||||
const char *monhost = 0;
|
||||
|
@ -32,6 +32,7 @@ using namespace std;
|
||||
#include "include/nstring.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
void usage()
|
||||
{
|
||||
@ -50,7 +51,7 @@ int main(int argc, const char **argv)
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
// args
|
||||
const char *fsdir = 0;
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "BackTrace.h"
|
||||
|
||||
#include "common/tls.h"
|
||||
|
||||
void __ceph_assert_fail(const char *assertion, const char *file, int line, const char *func)
|
||||
{
|
||||
BackTrace bt(1);
|
||||
|
10
src/common/common_init.cc
Normal file
10
src/common/common_init.cc
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "tls.h"
|
||||
|
||||
void common_init(std::vector<const char*>& args, bool open)
|
||||
{
|
||||
parse_config_options(args, open);
|
||||
tls_init();
|
||||
}
|
||||
|
8
src/common/common_init.h
Normal file
8
src/common/common_init.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef __COMMON_INIT_H
|
||||
#define __COMMON_INIT_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
void common_init(std::vector<const char*>& args, bool open=true);
|
||||
|
||||
#endif
|
@ -32,6 +32,7 @@ using namespace std;
|
||||
#include "msg/SimpleMessenger.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
void usage()
|
||||
{
|
||||
@ -50,7 +51,7 @@ int main(int argc, const char **argv)
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
if (g_conf.clock_tare) g_clock.tare();
|
||||
|
||||
|
@ -27,6 +27,7 @@ using namespace std;
|
||||
#include "mon/MonClient.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#ifndef DARWIN
|
||||
#include <envz.h>
|
||||
@ -41,7 +42,7 @@ int main(int argc, const char **argv, char *envp[])
|
||||
//cerr << "csyn starting" << std::endl;
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
parse_syn_options(args); // for SyntheticClient
|
||||
|
||||
vec_to_argv(args, argc, argv);
|
||||
|
@ -29,6 +29,7 @@ using namespace std;
|
||||
#include "mds/mdstypes.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#ifndef DARWIN
|
||||
#include <envz.h>
|
||||
@ -74,7 +75,7 @@ int main(int argc, const char **argv, const char *envp[])
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
vec_to_argv(args, argc, argv);
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <iostream>
|
||||
#include "ebofs/Ebofs.h"
|
||||
#include "os/FileStore.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#include <ext/hash_map>
|
||||
using __gnu_cxx::hash_map;
|
||||
@ -85,7 +86,7 @@ int main(int argc, const char **argv)
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
// args
|
||||
if (args.size() != 4)
|
||||
|
@ -30,6 +30,7 @@ using namespace std;
|
||||
#include "client/fuse_ll.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#include "msg/FakeMessenger.h"
|
||||
#include "messages/MMonCommand.h"
|
||||
@ -68,7 +69,7 @@ int main(int argc, const char **argv) {
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
// start messenger thread
|
||||
fakemessenger_startthread();
|
||||
|
@ -33,6 +33,7 @@ using namespace std;
|
||||
#include "messages/MMonCommand.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
|
||||
class C_Test : public Context {
|
||||
@ -65,7 +66,7 @@ int main(int argc, const char **argv)
|
||||
g_conf.mon_stop_on_last_unmount = true;
|
||||
g_conf.mon_stop_with_last_mds = true;
|
||||
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
int start = 0;
|
||||
|
||||
|
@ -34,6 +34,7 @@ using namespace std;
|
||||
#include "msg/SimpleMessenger.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
|
||||
class C_Test : public Context {
|
||||
@ -201,7 +202,7 @@ int main(int argc, const char **argv)
|
||||
|
||||
env_to_vec(args);
|
||||
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
parse_syn_options(args);
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@ using namespace std;
|
||||
|
||||
#include "osd/OSDMap.h"
|
||||
#include "mon/MonMap.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
void usage(const char *me)
|
||||
{
|
||||
@ -43,7 +44,7 @@ int main(int argc, const char **argv)
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
const char *me = argv[0];
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <iostream>
|
||||
#include "ebofs/Ebofs.h"
|
||||
#include "os/FileStore.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#undef dout_prefix
|
||||
#define dout_prefix *_dout << dbeginl
|
||||
@ -76,7 +77,7 @@ int main(int argc, const char **argv)
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
// args
|
||||
if (args.size() < 3) return -1;
|
||||
|
@ -25,6 +25,7 @@ using namespace std;
|
||||
#include "messages/MPing.h"
|
||||
|
||||
#include "common/Timer.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#ifndef DARWIN
|
||||
#include <envz.h>
|
||||
@ -68,7 +69,7 @@ int main(int argc, const char **argv, const char *envp[]) {
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, argv, args);
|
||||
env_to_vec(args);
|
||||
parse_config_options(args);
|
||||
common_init(args);
|
||||
|
||||
vec_to_argv(args, argc, argv);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user